zipfile and Tru64 UNIX
Albert Chin-A-Young
china at thewrittenword.com
Mon Jul 1 23:12:05 EDT 2002
Anyone aware of problems with zipfile against Python 2.0.1, 2.1.2, or
2.2.1 and 64-bit systems like Tru64 UNIX? I'm testing against 4.0D and
5.1 and a zipfile that tests out using testzip() on IRIX, HP-UX, and
Solaris gives a CRC error on Tru64 UNIX. I've tried creating the zipfile
with the UNIX zip program or zip.write() and get the same error. The
only bug I could find on sf.net was:
http://sourceforge.net/tracker/index.php?func=detail&aid=453208&group_id=5470&atid=105470
> import zipfile
> zip=zipfile.ZipFile('/tmp/a.zip','r')
> zip.printdir()
File Name Modified Size
vmunix 2002-05-31 14:29:06 9225952
> foo=zip.read('vmunix')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/opt/TWWfsw/python221/lib/python2.2/zipfile.py", line 354, in
read
raise BadZipfile, "Bad CRC-32 for file %s" % name
zipfile.BadZipfile: Bad CRC-32 for file vmunix
> bar=zip.getinfo('vmunix')
> bar.CRC
-2068761705
The output of binascii.crc32 on the contents of 'vmunix' is:
2226205591
or from the unzip program:
$ unzip -v /tmp/a.zip
Archive: /tmp/a.zip
Length Method Size Ratio Date Time CRC-32 Name
-------- ------ ------- ----- ---- ---- ------ ----
9225952 Stored 9225952 0% 05-31-02 14:29 84b13397 vmunix
-------- ------- --- -------
9225952 9225952 0% 1 file
Adding some debugging statements to zipfile.py reveals that the CRC
returned by binascii.crc32() is 2226205591 which is 0x84b13397. So, this
matches the output above from unzip. So, bar.CRC is wrong.
BTW, the /tmp/a.zip file used in this example was written with the
zipfile module (it is a valid zip file as I unpack with unzip and ran
cmp against /vmunix, the original source).
--
albert chin (china at thewrittenword.com)
More information about the Python-list
mailing list