-
Notifications
You must be signed in to change notification settings - Fork 19
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
7z reports CRC error on files downloaded from NextCloud #37
Comments
I will first try to find the source of the problem in the nextcloud issue (unless someone provided reproduction of the problem with ZipStreamer directly). |
With ZipStreamer, I can reproduce this 7zip issue with the following code:
Running I'm using p7zip 16.02 on Linux. Some debugging showed me this error is caused when reading the end of central directory record.
ecd.NumEntries is 0xffff. If I modify buildEndOfCentralDirectoryRecord() to put the correct number of entries in the record:
p7zip can test the archive without errors. |
As far as I can see, the behaviour of ZipStreamer is compliant with the spec. See https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.4.TXT, section 4.4.21 and 4.4.22: The total number of files [...]. If an archive is in ZIP64 format and the value in this field is 0xFFFF, the size will be in the corresponding 8 byte zip64 end of central directory field. As already noted in #2352, the 7zip author acknowledged this to be a bug in 7zip: https://sourceforge.net/p/sevenzip/discussion/45797/thread/cc8912f1/ |
But 7zip does not seem to be the only software with problems. And just because you can max out the ZIP64 specification does not mean you have to. I don't see a good reason to insist on using the extended fields when the traditional fields are sufficient. |
There's really no need to get personal. This is not about my pride. The Zip64 support in ZipStreamer was not even written by me. |
You may be actually wrong about being compliant to the spec. As far as I understand section 4.4.1.4, it says that you should put 0xffff only if the value is too big for the regular record. |
Looks like it is not a bug in 7z. https://sourceforge.net/p/sevenzip/discussion/45797/thread/cc8912f1/ "That archive contains unused space in zip64 extra fields. Changing Line 528 to "$cdRecCount = min(sizeof($this->cdRec), 0xffff);" gets valid zips for 7z |
Just bumped into this too. I was quite surprised a zip archive created by Owncloud doesn't open on Ubuntu. Do you see any issues with the following patch?
From my limited understanding, it seems as if this patch provides compatibility with 7z while still maintaining spec compliance. Is this correct or am I missing something? |
Tested on Ubuntu with different tools. Works fine! |
What is the current state on this issue? |
As per the 7z programmer's comment: "That archive contains unused space in zip64 extra fields. It seems to me that perhaps the proposed patch is working around the problem, by not requiring the decompresser to go into the zip64 fields. That is, there may be an actual problem with the zip64 fields generated by PHPZipStreamer, at least according to the 7z programmer. However, I do not know the ZIP format myself, so I may be wrong. @McNetic Would it be fair to assume that, at least for files < 4GB, the traditional size field can be used? Even if this is not the problem, it might be good to do it as a workaround, if it helps users deal with the vast majority of cases... (I'm assuming the vast majority of use cases don't involve huge multi-GB ZIP files). |
PR is open .... |
Hello everyone, the project was abandonned? @DeepDiver1975 Your PR is in error .. |
see #39 (comment) |
There is already a NC bug open: nextcloud/server/issues/2352
Some files downloaded from NextCloud won't work in Windows ZIP or, in my case. 7z for Linux or any frontend (e.g. Engrampa).
Disabling Zip64 seems to fix the issue.
I get the following output using
7z t file.zip
:The text was updated successfully, but these errors were encountered: