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.

classification
Title: zipfile.py reads archives with comments
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: ahlstromjc, loewis
Priority: normal Keywords: patch

Created on 2002-09-19 19:29 by ahlstromjc, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile.diff ahlstromjc, 2002-09-19 19:29 diff -c against today's CVS zipfile.py Rev. 1.25
comment.zip ahlstromjc, 2002-09-20 14:07 ZIP file with an archive comment
Messages (4)
msg41170 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-09-19 19:29
Module zipfile can not read ZIP archives which have
appended archive comments.  I have only gotten two
complaints about this, but I feel that this limitation
should be removed.  Archive comments are appended to
ZIP archives, and can be up to 64K bytes long.  Reading
them would require searching the end of the archive for
the end record magic number.

The attached patch will (1) seek and verify a zero
length comment; and if this fails (2) search the last
4K bytes of the file for a comment.  The 4K limitation
(down from 64K) is for efficiency.

This was tested on Python 2.2.1, but zipfile.py has
changed since then.  So the patch was hand edited into
today's CVS zipfile.py version.
msg41171 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-20 12:57
Logged In: YES 
user_id=21627

Can you please attach an example zipfile to test this patch?
msg41172 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-09-20 14:07
Logged In: YES 
user_id=64929

OK, here is a ZIP file which has an archive (appended)
multiline comment.  The comment is available as the
attribute ZipFile::comment.  I didn't add code to write ZIP
files with comments.  We don't need that, right?
msg41173 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-13 13:55
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as zipfile.py 1.26;
History
Date User Action Args
2022-04-10 16:05:41adminsetgithub: 37196
2002-09-19 19:29:21ahlstromjccreate