zipfile stupidly broken
Larry Bates
larry.bates at websafe.com
Wed May 16 18:56:37 EDT 2007
Martin Maney wrote:
> To quote from zipfile.py (2.4 library):
>
> # Search the last END_BLOCK bytes of the file for the record signature.
> # The comment is appended to the ZIP file and has a 16 bit length.
> # So the comment may be up to 64K long. We limit the search for the
> # signature to a few Kbytes at the end of the file for efficiency.
> # also, the signature must not appear in the comment.
> END_BLOCK = min(filesize, 1024 * 4)
>
> So the author knows that there's a hard limit of 64K on the comment
> size, but feels it's more important to fail a little more quickly when
> fed something that's not a zipfile - or a perfectly legitimate zipfile
> that doesn't observe his ad-hoc 4K limitation. I don't have time to
> find a gentler way to say it because I have to find a work around for
> this arbitrary limit (1): this is stupid.
>
>
> (1) the leading candidate is to copy and paste the whole frigging
> zipfile module so I can patch it, but that's even uglier than it is
> stupid. "This battery is pining for the fjords!"
>
>
> Normally I despise being CC'd on a reply to list or group traffic, but
> in this case it's probably necessary, as I haven't had time to keep up
> with this place for several years. :-/
>
Are you serious? A zipfile with a comment > 4Kbytes. I've never encountered
such a beast.
As with any open source product it is much better to roll up your sleeves
and pitch in to fix a problem than to rail about "how it is stupidly
broken". You are welcome to submit a patch or at the very least a good
description of the problem and possible solutions. If you have gotten a
lot of value out of Python, you might consider this "giving back". You
haven't paid anything for the value it has provided.
-Larry
More information about the Python-list
mailing list