Skip to content

MkdirAllNewAs,CopyDirectory: ensure dir perms#9

Merged
mrunalp merged 1 commit into
mrunalp:masterfrom
kolyshkin:fix-dir-perms
Oct 4, 2023
Merged

MkdirAllNewAs,CopyDirectory: ensure dir perms#9
mrunalp merged 1 commit into
mrunalp:masterfrom
kolyshkin:fix-dir-perms

Conversation

@kolyshkin
Copy link
Copy Markdown
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 <kolyshkin@gmail.com>
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