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

MkdirAllNewAs,CopyDirectory: ensure dir perms #9

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

kolyshkin
Copy link
Contributor

Because of umask, sometimes newly created files and directories can have permission bits different than expected. An easy solution would be to call os.Chmod after creation -- this is how CopyFile already works.

Now, let's do the same for directories.

PS The alternative to that would be to temporary set umask to 0, but it is extremely problematic in Go as it affects other threads (for all the gory details, see comments in opencontainers/runc#3563).

For opencontainers/runc#3991

Because of umask, sometimes newly created files and directories can have
permission bits different than expected. An easy solution would be to call
os.Chmod after creation -- this is how CopyFile already works.

Now, let's do the same for directories.

PS The alternative to that would be to temporary set umask to 0, but it
is very problematic in Go as it affects other threads.

Signed-off-by: Kir Kolyshkin <[email protected]>
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 this pull request may close these issues.

2 participants