From 9c6ede2d9b4e3785f29ffd28e55218fecc74fb50 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 14 Feb 2011 21:52:15 +0100 Subject: [PATCH] [entropy.db] EntropyRepositoryBase.__atomMatchValidateCache(): fix bug in validation code (check rc after type validation) --- libraries/entropy/db/skel.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/entropy/db/skel.py b/libraries/entropy/db/skel.py index 477dfebd1..4052c6371 100644 --- a/libraries/entropy/db/skel.py +++ b/libraries/entropy/db/skel.py @@ -4228,11 +4228,13 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): ) def __atomMatchValidateCache(self, cached_obj, multiMatch, extendedResults): + """ + This method validates the cache in order to avoid cache keys collissions + or corruption that could lead to improper data returned. + """ # time wasted for a reason data, rc = cached_obj - if rc != 0: - return cached_obj if multiMatch: # data must be set ! @@ -4243,6 +4245,8 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): if not entropy.tools.isnumber(data): return None + if rc != 0: + return cached_obj if (not extendedResults) and (not multiMatch): if not self.isPackageIdAvailable(data):