-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regarding LZMA1 (LZMA Alone, Method ID 14) in libzip (Follow-up of #195) #198
Comments
Thanks for the libarchive link, that is helpful. |
Test file, using LZMA, created by WinZip 24: Test file, using LZMA, created by vanilla p7zip 16.02: |
CC: @mholt |
@jloqfjgk so we have to rebuild the lzma header in ZIP. But it not a easy job
Anyone have any suggestion?Please help. One more thing : |
@jloqfjgk This(archive_read_support_format_zip.c) is helped. I will check it out. |
Please try 750a78e! |
Right now, libzip does not have any particular handling for an lzma EOS marker but just passes the compressed stream as provided by liblzma (after handling the header). What is the specification for the EOS marker? Does liblzma write it itself or does libzip have to add it manually? In which cases should libzip do that? How can libzip recognize if liblzma wrote it or not? What does it look like? The format seems woefully underspecified. Neither of your two examples has the bit set, so I assume neither comes with such an EOS marker. Do you know a tool that writes one? |
If we're talking about the |
I found this comment by the author of XZ Utils, Lasse Collin:
In 2008, he also said:
And in the same thread, Igor Pavlov (7-Zip author) said:
I figured out that we could enable the marker in 7-Zip by specifying the Test files:
ExplanationFrom the above table:
It will be a good idea to contact Lasse Collin regarding the use of EOS marker with the API. To my understanding, liblzma should be responsible for writing the EOS marker, and libzip should set the bit. |
Test file produced by @jinfeihan57's p7zip (used version: commit b07be46): His version seems better than the vanilla p7zip - the output file has Bit 1 set and can be extracted by 7-Zip. |
Also fix a bug in gpbf merging while here. Addresses #198.
Thanks for the pointers! libzip now sets Bit 1 correctly. |
Thank you very much. I have got mixed results. Good newsCompressionI tested git head and this is the file produced by Ark using libzip backend: The file size is smaller than the test files above (161 B vs 197 B). Nonetheless, it can be successfully extracted by the following programs:
Note: In 7-Zip and p7zip, the method is displayed as "LZMA:eos". Decompressionlibzip extracts all the above test files fine. Bad(?) newsWhen using Ark (with only libzip backend enabled) to open this file from KDE Bug 387996, Ark throws the following error: So it turns out that libzip finds a CRC error for that file:
But other programs such as |
According to APPNOTE section 5.8.8. the first two byte should be the version of lzma. |
I read this differently - it should be the version of the |
Correct.
Will |
No, as I said, liblzma does not provide this information. |
@0-wiz-0 |
As I said before, this is the version of the library, not the version of the LZMA SDK used.
but the file format specifies to use the LZMA SDK version number. |
Please try c025b25, this version has no CRC errors with |
I see what you mean now. Hardcoding the LZMA SDK version is not a problem because the version number is purely informational (cosmetic) and is rather useless. For example, Zip-Ada hardcodes 16.02 as version number. (Reference) |
The latest commit solves the CRC error, thank you. Out-of-topic content (See KDE Bug 424740)I found a minor, mostly cosmetic bug related to the Please refer to the following
The tests were done on tmpfs. |
I'd like this ticket to stay on topic of the lzma support, so if we consider that the time stamp issues are a problem, there should be a separate ticket for that, please. Are there any open issues in the lzma support? That being said: I don't know how the Access and Change timestamps in your example came to be; libzip does not set those at all since it does not write extracted files to the disk itself. If you write an unzipper, you should probably support either of the EF time stamps like the NTFS EF (0x000a) or the UNIX EF (0x000d). |
Thanks for the explanation. I guess this may be Ark's problem then. I am not aware of any other issue in the LZMA support - thank you very much for adding it! Tip: Don't forget to edit TODO.md. |
Thanks, I've updated TODO. Thank you for fetching together all the information and the test files, that was very helpful! |
To use the LZMA library (XZ Utils) for Method ID 14, I guess we need to refer to libarchive's implementation: archive_read_support_format_zip.c
That means the following code from zip_algorithm_xz.c is probably not enough (incomplete) and extra work/magic is needed to deal with LZMA1 ZIP files.
CC: @jinfeihan57
EDIT: See also libarchive/libarchive#1417
EDIT 2: See also https://sourceforge.net/p/lzmautils/discussion/708858/thread/663db6473d/#2919
The text was updated successfully, but these errors were encountered: