summaryrefslogtreecommitdiffstats
path: root/tools/releasetools
diff options
context:
space:
mode:
authorGeremy Condra <gcondra@google.com>2014-05-13 20:23:54 -0700
committerGeremy Condra <gcondra@google.com>2014-05-13 20:23:54 -0700
commit15d5348e6cc7a6fdae792ab308c23cb564e10f0b (patch)
treeb23edd887c2f7087f45f5ef43848f5d9f9645d61 /tools/releasetools
parent2ec7c7a21ca2fcce44588de7db8deb80ea72a1aa (diff)
downloadbuild-15d5348e6cc7a6fdae792ab308c23cb564e10f0b.zip
build-15d5348e6cc7a6fdae792ab308c23cb564e10f0b.tar.gz
build-15d5348e6cc7a6fdae792ab308c23cb564e10f0b.tar.bz2
Reopen temporary system image to avoid stale data.
NamedTemporaryFile's aggressive caching behavior can cause an issue where changes made by another process aren't visible even after the fseek() below or a flush(). To avoid this, simply open the file again and read from the fresh version. This fixes an issue where verity metadata written by append2simg doesn't become visible to img_from_target_files. Change-Id: I291fb3a95d5b532218ac6205ecc9e9b4f3a36bd4
Diffstat (limited to 'tools/releasetools')
-rwxr-xr-xtools/releasetools/img_from_target_files.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 596a47e..93092b3 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -90,8 +90,7 @@ def BuildSystem(input_dir, info_dict, sparse=True, map_file=None):
mapdata = None
if sparse:
- img.seek(os.SEEK_SET, 0)
- data = img.read()
+ data = open(img.name).read()
img.close()
else:
success, name = build_image.UnsparseImage(img.name, replace=False)