diff options
author | Colin Cross <ccross@android.com> | 2021-05-11 16:03:57 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2021-05-11 16:14:39 -0700 |
commit | e070c3a26b7cea5dcf002cdd02044a7e57da13ce (patch) | |
tree | f7389a7ab1e3f2ab13f2ab23f80f33a7088e02e0 /zip | |
parent | 9f361c301d7cebb6eaac75bdcd0d09b1fde5180b (diff) | |
download | soong-e070c3a26b7cea5dcf002cdd02044a7e57da13ce.tar.gz |
Always call SetMode in soong_zip
In addition to setting the mode, SetMode also marks the file
as created by Unix, which seems to cause Debian's unzip tool
to handle UTF-8 filenames correctly.
Fixes: 184575223
Test: TestZip
Change-Id: I0e839dc3d27aaa9abced0eb1d3c4c0f8eed3e3c4
Diffstat (limited to 'zip')
-rw-r--r-- | zip/zip.go | 4 | ||||
-rw-r--r-- | zip/zip_test.go | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/zip/zip.go b/zip/zip.go index 84e974bce..6e412c956 100644 --- a/zip/zip.go +++ b/zip/zip.go @@ -656,9 +656,11 @@ func (z *ZipWriter) addFile(dest, src string, method uint16, emulateJar, srcJar UncompressedSize64: uint64(fileSize), } + mode := os.FileMode(0600) if executable { - header.SetMode(0700) + mode = 0700 } + header.SetMode(mode) err = createParentDirs(dest, src) if err != nil { diff --git a/zip/zip_test.go b/zip/zip_test.go index a37ae41e4..441dea3bd 100644 --- a/zip/zip_test.go +++ b/zip/zip_test.go @@ -62,7 +62,7 @@ func fh(name string, contents []byte, method uint16) zip.FileHeader { Method: method, CRC32: crc32.ChecksumIEEE(contents), UncompressedSize64: uint64(len(contents)), - ExternalAttrs: 0, + ExternalAttrs: (syscall.S_IFREG | 0600) << 16, } } |