Cache permissions and umask issues after switch to mkstemp #255
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.
This PR resolves multiple permissions-related issues introduced in #240.
State before the change
mkpath
(respectsumask
, default permissions0775
), and then file opened withopen
(respectsumask
, default permissions are0664
).mkstemp
, which always creates files with permissions0600
. This causes various issues when permissions system relies on user groups, as the group can no longer read or write cache files.After this change
open
to create first file.mkstemp
call, which sets permissions to0600
.0644
to the file after rename, and properly use umask value (currentumask
is determined in theInit_bootsnap
)I have tested this change with and without umask, and it seems to be working properly:
0775
0664
022
is specified, directories are0755
and files are0644
Previous behavior that was reverted by
mkstemp
Related issues
Updates
I was wrong about the second
open
call, it makes sense now and PR is corrected. ;-) The pemissions issue is still there.