This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Peter Ebden
Recipients Peter Ebden
Date 2016-12-28.13:26:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482931591.96.0.8795611166.issue29094@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2.7.13, using zipfile.ZipFile to write into a file with some initial preamble produces a zip file that cannot be read again by some zip implementations.
Our use case is using pex (https://github.com/pantsbuild/pex) which writes a zip that begins with a shebang, and later attempting to manipulate that using Go's standard archive/zip package. In 2.7.12 that works OK, but in 2.7.13 the .pex file is rejected on reading. Linux's command-line unzip tool will read the archive, but issues a warning ("4 extra bytes at beginning or within zipfile") which wasn't present previously. 
zipfile.ZipFile does read the files OK.

I assume this is related to https://bugs.python.org/issue26293 since that's the most obvious zipfile change in 2.7.13. It's pretty easy to reproduce using the example in that issue:

from zipfile import ZipFile
with open('a.zip', 'wb') as base:
    base.write(b'old\n')
    with ZipFile(base, 'a') as myzip:
        myzip.write('eggs.txt')

unzip -t a.zip
Archive:  a.zip
warning [a.zip]:  4 extra bytes at beginning or within zipfile
  (attempting to process anyway)
...
History
Date User Action Args
2016-12-28 13:26:32Peter Ebdensetrecipients: + Peter Ebden
2016-12-28 13:26:31Peter Ebdensetmessageid: <1482931591.96.0.8795611166.issue29094@psf.upfronthosting.co.za>
2016-12-28 13:26:31Peter Ebdenlinkissue29094 messages
2016-12-28 13:26:31Peter Ebdencreate