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 loewis
Recipients alanmcintyre, eric.araujo, loewis, mark.dickinson, meador.inge, pleed, serhiy.storchaka, terry.reedy, ubershmekel
Date 2012-05-13.17:58:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336931933.83.0.17014569472.issue14315@psf.upfronthosting.co.za>
In-reply-to
Content
Serhiy: can you please provide a unit test? The OP's test case is unsuitable because of both size and copyright.

As for the actual issue: the extra data (type 0xcafe) is apparently added by jar tools to make the jar file executable:

http://www.androidadb.com/source/commons-compress-1.1-src/src/main/java/org/apache/commons/compress/archivers/zip/JarMarker.java.html

ISTM that the extra 0 byte is in clear violation of the ZIP specification, which says that there always be type+length headers, followed by length data. So if the length is 0, there ought not to be any data. I don't buy the "padding" argument, since a) the spec is silent on any padding, and b) for alignment reasons, it's not plausible to add any padding, since it is aligned fine without this padding, and unaligned with the padding.

I can sympathize with the desire to accept the zipfile, anyway (i.e. despite it being broken). At the same time, I also think that Python should not let errors pass silently.

So as a way out, I propose that the ZipFile class gains a "strict" attribute, indicating whether "acceptable" violations of the spec are ignored or reported as exceptions.

So -1 on the patch as it stands (but thanks for the analysis).
History
Date User Action Args
2012-05-13 17:58:53loewissetrecipients: + loewis, terry.reedy, mark.dickinson, alanmcintyre, eric.araujo, ubershmekel, meador.inge, serhiy.storchaka, pleed
2012-05-13 17:58:53loewissetmessageid: <1336931933.83.0.17014569472.issue14315@psf.upfronthosting.co.za>
2012-05-13 17:58:53loewislinkissue14315 messages
2012-05-13 17:58:52loewiscreate