From 4be4a15491530bd6dc018033ad3d4b2562ab6e23 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 22 Jul 2016 11:28:23 +0100 Subject: [PATCH] cache: Add better cache loading sanity checks We've seen cache corruption where the pairs come out in a different order to the way we saved them for unknown reasons. Add better sanity checking to give a more user friendly error rather than a crash/traceback. Also allows the system to reparse and recover. Signed-off-by: Richard Purdie --- lib/bb/cache.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/bb/cache.py b/lib/bb/cache.py index cce12d12e9e..439565f5a6e 100644 --- a/lib/bb/cache.py +++ b/lib/bb/cache.py @@ -328,6 +328,13 @@ class Cache(object): value = pickled.load() except Exception: break + if not isinstance(key, str): + bb.warn("%s from extras cache is not a string?" % key) + break + if not isinstance(value, RecipeInfoCommon): + bb.warn("%s from extras cache is not a RecipeInfoCommon class?" % value) + break + if key in self.depends_cache: self.depends_cache[key].append(value) else: -- 2.47.3