8000 Set correct file permissions given a umask of 0027 · Issue #294 · rubyzip/rubyzip · GitHub
[go: up one dir, main page]

Skip to content

Set correct file permissions given a umask of 0027 #294

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
metavida opened this issue Jun 30, 2016 · 2 comments · Fixed by #300
Closed

Set correct file permissions given a umask of 0027 #294

metavida opened this issue Jun 30, 2016 · 2 comments · Fixed by #300

Comments

@metavida
Copy link
Contributor

We lock down our umask to 0027 so that files are not globally readable. When creating files via File.open this results in files with permissions of 0640 (i.e. rw-r----) but zip files created with this library end up with the very odd permission of 0637 (e.g. rw--wxrwx).

I've added a failing test case to test/file_permissions_test.rb on my branch but haven't had time to actually write a solution nor to do any testing on windows.

@metavida
Copy link
Contributor Author

Note, I believe bug exists because the permission calculation introduced in Pull #237 relies on direct subtraction (0666 - 0027 = 0637) and in reality linux must not actually use direct subtraction internally.

hainesr added a commit to hainesr/rubyzip that referenced this issue Sep 1, 2016
This fixes rubyzip#294 in what I hope is a more sensible way than trying to mess with
umasks, etc, directly.

Temporary files were being created with 0600 permissions and then being set to
different permissions, based on umask, etc, afterwards. I don't know what the
rationale for this was, but there were errors in the umask calculations when
moving from the temporary file to the intended end result.
@hainesr
Copy link
Member
hainesr commented Sep 1, 2016

I've had a go at fixing this in #300. Can people comment on whether how I've fixed it is sensible?

simonoff added a commit that referenced this issue Nov 9, 2016
Fix permissions on new zip files (#294)
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

Successfully merging a pull request may close this issue.

2 participants
0