zipfile and Tru64 UNIX
Anthony Baxter
anthony at interlink.com.au
Tue Jul 2 02:04:34 EDT 2002
>>> Albert Chin-A-Young wrote
> Ok, I did some digging. The attached patch solves the problem. I think
> this is a problem for any machine where sizeof(long) == 8. Is there an
> easier way to force crc to be a 32-bit int. From the typesnumeric.html
> document:
> Plain integers (also just called integers) are implemented using
> long in C, which gives them at least 32 bits of precision.
Please submit this as a patch to Sourceforge, if you haven't already.
Thanks,
Anthony
> --
> albert chin (china at thewrittenword.com)
>
> -- snip snip
> --- Lib/zipfile.py.orig Mon Jul 1 23:10:00 2002
> +++ Lib/zipfile.py Mon Jul 1 23:10:26 2002
> @@ -346,7 +346,7 @@
> raise BadZipfile, \
> "Unsupported compression method %d for file %s" % \
> (zinfo.compress_type, name)
> - crc = binascii.crc32(bytes)
> + crc = struct.unpack('<l', struct.pack('<l', binascii.crc32(bytes)))[
0]
> if crc != zinfo.CRC:
> raise BadZipfile, "Bad CRC-32 for file %s" % name
> return bytes
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Anthony Baxter <anthony at interlink.com.au>
It's never too late to have a happy childhood.
More information about the Python-list
mailing list