-
-
Notifications
You must be signed in to change notification settings - Fork 83
Preserve zip files permissions #371
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
Closed
Closed
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5a71cfc
Preserve zip files permissions
sake92 c1fae14
Bump java to 17
sake92 b09a11e
sudo
sake92 413ceaa
fmt
sake92 b48ffea
fmt
sake92 ac5cdce
Merge branch 'main' into preserve-permissions-zip
sake92 366fcfd
Use Files.getAttribute(entry, zip:permissions)
sake92 f5405a0
Merge branch 'preserve-permissions-zip' of github.com:sake92/os-lib i…
sake92 0d18a55
Use Files.getAttribute(entry, zip:permissions)
sake92 e9aa7b0
Use Files.getAttribute(entry, zip:permissions)
sake92 fd6877f
fmt
sake92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should use the more low-level
Files.getAttribute(entry, "zip:permissions")here.In case the zip entry does not have permission information,
Files.getAttribute(entry, "zip:permissions")would be empty and we could skipos.perms.set.If using
Files.getPosixFilePermissions, according to the doc,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the unzipped file would get some default permissions even if we dont set them, right?
With this approach we at least can set it with the "defaultPermissions" property.
Currently I set it to empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there's no permission information stored with the zip entry, we want it to have the default permissions set by the user's os/file system/umask when unzipped right, not the zipfs "defaultPermissions"? Also the zipfs "defaultPermissions" is never empty. When it's null/unset it's set to [OWNER_READ, OWNER_WRITE, GROUP_READ]. So we should check with
Files.getAttribute(entry, "zip:permissions")instead, and skip theos.perms.setpart if it's empty.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you are right, I'm not super familiar with *nix permissions.
Fixed now, looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I didn't have a correct understanding of umask either. There're no default permissions in Unix. Applications set permissions to files they create. Umask will then mask some of the permissions. What you did before was totally fine. https://askubuntu.com/questions/44542/what-is-umask-and-how-does-it-work