Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
archive/zip: Reader.Read returns ErrChecksum on certain files #21876
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
changed the title
zip/reader.Reader.Read => ErrChecksum error on a particular kind of zip file
Sep 14, 2017
I've investigated this issue and extracted both the go and ruby code together with a test to reproduce the issue and a possible fix for the issuers ruby code here:
IMO, this is a non-issue from Go's point of view, here is why:
I was able to reproduce the issue on "go version go1.11.5 darwin/amd64" with the *.jar file and ruby code provided to this issue.
Also, I was able to create a similar zip file using ZIP(1L) on macOS that behaved similarly with the ruby script provided and then processed with the go code of this issue.
What seems to be happening is the following:
To fix this issue on the issuers side, general purpose flags can be cleared.
Also (I'm not a ruby expert) Rubyzip's zip output stream might have to be fixed for entries that where copied over from an existing zip file. There is an issue  on Rubyzip that is Open and indicates to be similar to Issue21876.
Similar to Go's zip reader, macOS's Archive Utility.app cannot open the ZIP file produced by Rubyzip.
Here we produce a zip file with data descriptors included for zip file entries using "-fd" flag with ZIP(1L) on macOS. Then, as described in the issue, the ruby script is used to remove directories out of the zip file and the zip file is transformed to a tar file using Go.
Run the following script (found here: https://github.com/marcellanz/go-21876) to reproduce the issue: