[oe-commits] [openembedded-core] 04/10: wic: fix bug in sparse_copy

git at git.openembedded.org git at git.openembedded.org
Wed Mar 22 15:08:08 UTC 2017


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

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

commit 567186f995302a095a771baede4ff5034d1d1862
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Wed Mar 22 15:42:28 2017 +0200

    wic: fix bug in sparse_copy
    
    sparse_copy creates output file that is smaller than input
    file when input file ends with unmapped blocks.
    
    Used truncate(<input file size>) when output file is created
    to ensure the size of output file will always be equal to
    the size of input file.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/wic/filemap.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 162603e..080668e 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -537,6 +537,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0):
         dst_file = open(dst_fname, 'r+b')
     except IOError:
         dst_file = open(dst_fname, 'wb')
+        dst_file.truncate(os.path.getsize(src_fname))
 
     for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
         start = first * fmap.block_size

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


More information about the Openembedded-commits mailing list