summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-04-10 13:50:41 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-10 23:38:49 +0100
commit227c5acd4b40154bc61202e7bb67a13818a7d727 (patch)
treef821a7480753a37b7f73952e6ec3d050e5bca484
parent54d61e7c64c97799de85b3563119f0f5d051675e (diff)
downloadbitbake-contrib-227c5acd4b40154bc61202e7bb67a13818a7d727.tar.gz
cache: prevent division-by-zero in load_cahefile()
[YOCTO 11315] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/cache.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 28e8a8745..e7eeb4f50 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -462,6 +462,10 @@ class Cache(NoCache):
self.depends_cache[key] = [value]
# only fire events on even percentage boundaries
current_progress = cachefile.tell() + previous_progress
+ if current_progress > cachesize:
+ # we might have calculated incorrect total size because a file
+ # might've been written out just after we checked its size
+ cachesize = current_progress
current_percent = 100 * current_progress / cachesize
if current_percent > previous_percent:
previous_percent = current_percent