[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5578/8267] bitbake: cache: prevent division-by-zero in load_cahefile()



commit fc6370626e31951d112337c7a5f9ae15a4b73965
Author: Markus Lehtonen <markus lehtonen linux intel com>
Date:   Mon Apr 10 13:50:41 2017 +0300

    bitbake: cache: prevent division-by-zero in load_cahefile()
    
    [YOCTO 11315]
    
    (Bitbake rev: 227c5acd4b40154bc61202e7bb67a13818a7d727)
    
    Signed-off-by: Markus Lehtonen <markus lehtonen linux intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/cache.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 28e8a87..e7eeb4f 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]