[oe-commits] [bitbake] 03/05: cache: prevent division-by-zero in load_cahefile()

git at git.openembedded.org git at git.openembedded.org
Mon Apr 10 22:54:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 227c5acd4b40154bc61202e7bb67a13818a7d727
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Mon Apr 10 13:50:41 2017 +0300

    cache: prevent division-by-zero in load_cahefile()
    
    [YOCTO 11315]
    
    Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cache.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 28e8a87..e7eeb4f 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list