update_engine: Don't search for deflates again in SquashFS compressed files
When we initialize a SquashFS file system, at the same time we find the
location of all deflate buffers. But for some files that have specific
postfix like gz or zip, we try to find the deflates there again. But, we
should only do this when the SquashFS did not actually compress that
file. Otherwise we're just gonna fail.
BUG=chromium:1050869
TEST=cros_generate_update_payload --image gs://chromeos-releases/dev-channel/eve-kvm/12871.1.0/dlc/pita/package/dlc.img --src_image gs://chromeos-releases/dev-channel/eve-kvm/12861.0.0/dlc/pita/package/dlc.img --output delta.bin --debug --work_dir workdir
TEST=sudo FEATURES=test emerge update_engine
Change-Id: I8b01fb182b88d7ec75dcbfa4c1271caf3bf074fe
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2076162
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/payload_generator/filesystem_interface.h b/payload_generator/filesystem_interface.h
index d04295c..05d387f 100644
--- a/payload_generator/filesystem_interface.h
+++ b/payload_generator/filesystem_interface.h
@@ -62,6 +62,13 @@
// indicating the starting block, and the number of consecutive blocks.
std::vector<Extent> extents;
+ // If true, the file is already compressed on the disk, so we don't need to
+ // parse it again for deflates. For example, image .gz files inside a
+ // compressed SquashFS image. They might have already been compressed by the
+ // mksquashfs, so we can't really parse the file and look for deflate
+ // compressed parts anymore.
+ bool is_compressed = false;
+
// All the deflate locations in the file. These locations are not relative
// to the extents. They are relative to the file system itself.
std::vector<puffin::BitExtent> deflates;