Closed mleduque closed 5 months ago
I suspect that may involve extracting to a filesystem with no-execute mount option and a file with execute mode set in the archive.
When I modify extract()
to set directory permissions only after all normal files are extracted, I instead get
called `Result::unwrap()` on an `Err` value: Io(Os { code: 21, kind: IsADirectory, message: "Is a directory" })
But after removing the call to set_permissions
, the error code is still "Permission denied".
I also get PermissionDenied when not creating the normal files but only the directories.
The entry causing the failure is when creating ub_iwd/baf/
, and ub_iwd/
can be created without a problem.
Looks like this can be fixed by setting the permissions of each new directory to 755, and then setting the actual permissions in a second pass.
Found the root cause: the parent directory ub_iwd/
is not writable. It's interesting that unzip(1)
on MacOS still allows it to be extracted.
hennickc@f8ffc25e7f6e zip2 % zipinfo -l tests/data/lin-ub_iwd-v11.zip
Archive: tests/data/lin-ub_iwd-v11.zip
Zip file size: 735287 bytes, number of entries: 86
dr-x--- 6.3 fat 0 bx 0 stor 22-Sep-28 06:06 ub_iwd/
drwx--- 6.3 fat 0 bx 0 stor 19-Feb-22 16:40 ub_iwd/baf/
@mleduque Do I have permission of the copyright owners to include lin-ub_iwd-11.zip
in https://github.com/zip-rs/zip2 in https://github.com/zip-rs/zip2/tree/master/tests/data, which is MIT-licensed? We need to include an affected ZIP file for automated regression testing (i.e. to ensure this bug never comes back once fixed).
Extraction of the folowinf archive fails with
https://github.com/Gibberlings3/iwd_unfinished_business/releases/download/v11/lin-ub_iwd-v11.zip
I finally found the archives I stumbled upon when I filed this https://github.com/zip-rs/zip/issues/246 I just couldn't remember in what context this happened at the time
Tested with 0.6.6