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 serhiy.storchaka
Recipients alanmcintyre, eric.araujo, loewis, nadeem.vawda, serhiy.storchaka
Date 2012-03-19.14:13:13
SpamBayes Score 4.440892e-16
Marked as misclassified No
Message-id <1332166394.61.0.0426106973714.issue14366@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you, Martin, for review and advices.

Lzma in zip format: 2-bytes version (LZMA SDK version, it has not relations with version of XZ Utils used by lzma module), 2-bytes properties size (I have not seen a value other than 5), N-bytes (N=5) property data, and raw compressed data (LZMA_RAW).

Lzma file format (LZMA_ALONE): 5-bytes property data, 8-bytes uncompressed size (~0 if unknown), and raw compressed data (LZMA_RAW).

7-Zip ignores version and supports only 5-bytes property data. Because the LZMA1 codec is declared obsolete, it is highly unlikely for new versions with properties size != 5. Nevertheless, it would be wise to create a lzma module functions for parsing the bytes to the codec properties and for dumping the codec properties to the bytes (this is functions lzma_lzma_props_encode() and lzma_lzma_props_decode() in liblzma). It is not necessary but desirable. I see no other reasonable choice but to hardcode some arbitrary version in the compressing and to ignore it in the decompressing.

This EOS marker is only helpful for stream zip-files when the size of the compressed data is not known beforehand and it is not possible to specify the following (see lzma-file-format.txt in liblzma docs). But that's must be another issue, the current implementation of the zipfile module does not work with non-seekable files (I hope to work on it later).

> I also recommend to split this issue into two: bzip support and lzma support.

Assuredly. I will create a new issue for bzip2, but what do I do with lzma? Do I need to rename this issue or create a new one? Does the lzma patch include the bzip2 patch, because the latter will contain the code necessary to support all codecs? Or should defer any work with lzma until the bzip2 support will commited?

I think we should add the ability to register new codecs. Support for PPMd, jpeg and WavPack is unlikely to emerge in the Python in the foreseeable future, but users of third-party libraries (such as PIL), will use the new codecs as needed.

> I also think that create_version and extract_version need to be adjusted.

Agree. Should we raise an exception when using new compressor if allowZip64 == False? Or set allowZip64 = True, if we explicitly use the new compressor?
History
Date User Action Args
2012-03-19 14:13:14serhiy.storchakasetrecipients: + serhiy.storchaka, loewis, alanmcintyre, nadeem.vawda, eric.araujo
2012-03-19 14:13:14serhiy.storchakasetmessageid: <1332166394.61.0.0426106973714.issue14366@psf.upfronthosting.co.za>
2012-03-19 14:13:14serhiy.storchakalinkissue14366 messages
2012-03-19 14:13:13serhiy.storchakacreate