Skip to content
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

"Permission denied" on linux #161

Closed
mleduque opened this issue Dec 29, 2023 · 7 comments
Closed

"Permission denied" on linux #161

mleduque opened this issue Dec 29, 2023 · 7 comments

Comments

@mleduque
Copy link

mleduque commented Dec 29, 2023

Extraction of the folowinf archive fails with

Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })

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 zip-rs/zip-old#246
I just couldn't remember in what context this happened at the time

Tested with 0.6.6

@mleduque
Copy link
Author

mleduque commented Jan 4, 2024

I suspect that may involve extracting to a filesystem with no-execute mount option and a file with execute mode set in the archive.

@Pr0methean
Copy link
Member

Pr0methean commented May 10, 2024

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".

@Pr0methean
Copy link
Member

I also get PermissionDenied when not creating the normal files but only the directories.

@Pr0methean
Copy link
Member

Pr0methean commented May 10, 2024

The entry causing the failure is when creating ub_iwd/baf/, and ub_iwd/ can be created without a problem.

@Pr0methean
Copy link
Member

Pr0methean commented May 10, 2024

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.

@Pr0methean
Copy link
Member

Pr0methean commented May 10, 2024

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/

@Pr0methean
Copy link
Member

Pr0methean commented May 10, 2024

@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).

@Pr0methean Pr0methean transferred this issue from zip-rs/zip-old Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants