[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6303/8267] filemap: check if dest is written for every block



commit b67fd459d2d11c1f09c1c66f6ea0898266439f67
Author: Ed Bartosh <ed bartosh linux intel com>
Date:   Tue Jun 13 14:22:04 2017 +0300

    filemap: check if dest is written for every block
    
    If lenght parameter is provided to sparse_copy call
    it's mandatory to check if the output file is fully
    written after reading unmapped block from input file.
    
    If it's not done then sparse_copy can write more data
    than specified length.
    
    (From OE-Core rev: 289b1767182982dfb6912e64481150697ba93e4d)
    
    Signed-off-by: Ed Bartosh <ed bartosh linux intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 scripts/lib/wic/filemap.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 8719f44..764dbbe 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -563,6 +563,13 @@ def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
             start = skip
 
         fmap._f_image.seek(start, os.SEEK_SET)
+
+        written += start - skip - written
+        if length and written >= length:
+            dst_file.seek(seek + length, os.SEEK_SET)
+            dst_file.close()
+            return
+
         dst_file.seek(seek + start - skip, os.SEEK_SET)
 
         chunk_size = 1024 * 1024


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