From b88c4dfb8794c0618067c127794445e8fd821c33 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 22 Jun 2018 16:37:47 -0700 Subject: [PATCH] soong_zip: set local header crc for symlinks Getting a crc into the local header requires setting it before writing the payload, or using a streaming data header after the payload with the crc. Stored (uncompressed) entries are not allowed to use a streaming data header. Symlinks are always stored uncompressed, so set the crc in the file header before writing the payload. Test: m checkbuild Test: zipdetails on zip with symlink created with soong_zip has same crc in local header and central header. Bug: 110716403 Change-Id: I66c5d41f0a5b23b828d6a03a3790afedc5a97625 --- zip/zip.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zip/zip.go b/zip/zip.go index b7e37646e..4d29f6693 100644 --- a/zip/zip.go +++ b/zip/zip.go @@ -795,6 +795,8 @@ func (z *ZipWriter) writeSymlink(rel, file string) error { return err } + fileHeader.CRC32 = crc32.ChecksumIEEE([]byte(dest)) + ze := make(chan *zipEntry, 1) futureReaders := make(chan chan io.Reader, 1) futureReader := make(chan io.Reader, 1)