aonez / Keka

The macOS & iOS file archiver
https://www.keka.io
4.84k stars 238 forks source link

[REQ] Unable to extract zip file with zstd compression #1304

Open Sytten opened 1 year ago

Sytten commented 1 year ago

Configuration

Describe the bug

Files with compression zstd (method 93) are not extractable with Keka. I was able to extract them with p7zip. The files are created in rust with the zip library. Looking at the logs it's most likely just that it requires an update to the 7zip to support the method.

To Reproduce

sample.zip

Logs

OS: Version 11.7.2 (Build 20G1020) (x86_64)
Keka: v1.3.2-r5208 (WEB) (Sandboxed) (en)
Format detected: ZIP
Binary used: kekaunar
Arguments: (
    "-q",
    "-r",
    "-D",
    "-K",
    "-nq",
    "-o",
    "/Users/Sytten/Projects/Personnal/zip/sample.kextraction/Operation",
    "/Users/Sytten/Projects/Personnal/zip/sample.zip"
)
Extraction to directory "/Users/Sytten/Projects/Personnal/zip/sample.kextraction/Operation" failed (1 file failed.)

OS: Version 11.7.2 (Build 20G1020) (x86_64)
Keka: v1.3.2-r5208 (WEB) (Sandboxed) (en)
Format detected: ZIP
Binary used: keka7zz
Arguments: (
    x,
    "/Users/Sytten/Projects/Personnal/zip/sample.zip",
    "-snld",
    "-aou",
    "-xr!__MACOSX",
    "-bsp1"
)

7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15 : Modified by aone for Keka
 64-bit locale=en_US.UTF-8 Threads:8

Scanning the drive for archives:
  0M Scan /Users/Sytten/Projects/Personnal/zip/

1 file, 1592 bytes (2 KiB)

Extracting archive: /Users/Sytten/Projects/Personnal/zip/sample.zip

--
Path = /Users/Sytten/Projects/Personnal/zip/sample.zip
Type = zip
Physical Size = 1592

  0%
ERROR: Unsupported Method : test/lorem_ipsum.txt

Sub items Errors: 1

Archives with Errors: 1

Sub items Errors: 1

Error code 2
aonez commented 1 year ago

So this library is creating a ZIP file using ZSTD compression. Is this expected to be added to the ZIP specification?

Tested with unar, 7zz (the official and updated 7-Zip version), BOOM, Info-Zip and neither of them support that method. That p7zip project is a highly modified version not used in Keka.

Keka supports ZSTD as intended, but not in a ZIP package. Why not creating a ZSTD instead of a ZIP with ZSTD compression?

aonez commented 1 year ago

Just to be clear I don't think this is a bad idea, I love ZSTD. I just don't know how this is implemented and supported in the wild.

Sytten commented 1 year ago

ZSTD is not an archive format made for multiple files to my knowledge. So you could create a zip and then compress it but it is wasteful of disk space for large files specially if you are streaming the creating of the zip file like is possible with the lib. Note that this library isnt some unknown, it is the most used in rust with millions of download.

I am not well versed in zip standardization but I believe that new compression methods can be added and it's just a convention? This one is definitely newer and not super well supported at the moment but its not going away for sure.

I was able to use the 7zz installed with brew so unsure which one it is? I think its p7zip.