From: Ed Bartosh Date: Tue, 13 Jun 2017 11:21:50 +0000 (+0300) Subject: filemap: fix skip logic X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~21078 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c19f78a0713c8ac9d28b78f86c6d7b96157788f0;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git filemap: fix skip logic Fixed bug in processing 'skip' parameter: don't read input file if end of bmap block is less than skip Simplified logic of positioning to the start of data inside a partially skipped bmap block. Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index 1f1aacc5223..585b7ea84ec 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py @@ -545,11 +545,14 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None): start = first * fmap.block_size end = (last + 1) * fmap.block_size + if skip >= end: + continue + if start < skip < end: - fmap._f_image.seek(skip, os.SEEK_SET) - else: - fmap._f_image.seek(start, os.SEEK_SET) - dst_file.seek(offset + start, os.SEEK_SET) + start = skip + + fmap._f_image.seek(start, os.SEEK_SET) + dst_file.seek(offset + start - skip, os.SEEK_SET) chunk_size = 1024 * 1024 to_read = end - start