Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
archive/zip: handle extra bytes after the zip index #5228
What steps will reproduce the problem? http://play.golang.org/p/69b8Bz5Les What is the expected output? [no output] What do you see instead? zip: not a valid zip file Which operating system are you using? Debian GNU/Linux Which version are you using? (run 'go version') go version devel +1d49ee511d95 Fri Apr 05 15:23:03 2013 -0700 linux/amd64 Please provide any additional information below. Zip library should support some extra bytes after the index. See the attached file, it's the same as used on the example at "Go Playground". archive/go can not open it unless we strip it with 'zip -A'.
Why? We only need to open zip files that real programs make, not bad zip files that humans make just to get error messages. It's true that OS X's zip program attempts to open this anyway: unzip -l Downloads/foo.zip.crdownload Archive: Downloads/foo.zip.crdownload warning [Downloads/foo.zip.crdownload]: 55 extra bytes at beginning or within zipfile (attempting to process anyway) error [Downloads/foo.zip.crdownload]: reported length of central directory is -55 bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1 zipfile?). Compensating... Length Date Time Name -------- ---- ---- ---- 8 04-06-13 07:55 foo -------- ------- 8 1 file But I don't think we need to read it unless a popular zip program makes such bogus files.
Okay, if this is simply a case of us not following the spec (which part?) and there are real-world files like this, it can be fixed. I wasn't aware of the golang-nuts thread. In the future, be sure to include all relevant information in the bug report and don't assume those reading the bugs have been following discussions elsewhere.
Status changed to Accepted.