Skip to content

libct: use chmod instead of umask#4039

Merged
cyphar merged 1 commit into
opencontainers:mainfrom
kolyshkin:ditch-umask
Oct 4, 2023
Merged

libct: use chmod instead of umask#4039
cyphar merged 1 commit into
opencontainers:mainfrom
kolyshkin:ditch-umask

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

(this is an alternative to #3563, implementing @cyphar suggestion)

Umask is problematic for Go programs as it affects other goroutines (see [1] for more details).

Instead of using it, let's just prop up with Chmod.

Note this patch misses the MkdirAll call in createDeviceNode. Since the runtime spec does not say anything about creating intermediary directories for device nodes, let's assume that doing it via mkdir with the current umask set is sufficient (if not, we have to reimplement MkdirAll from scratch, with added call to os.Chmod).

[1] #3563 (comment)

Umask is problematic for Go programs as it affects other goroutines
(see [1] for more details).

Instead of using it, let's just prop up with Chmod.

Note this patch misses the MkdirAll call in createDeviceNode. Since the
runtime spec does not say anything about creating intermediary
directories for device nodes, let's assume that doing it via mkdir with
the current umask set is sufficient (if not, we have to reimplement
MkdirAll from scratch, with added call to os.Chmod).

[1] opencontainers#3563 (comment)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Copy Markdown
Contributor Author

Maybe the alternative is #3992, wdyt @cyphar ?

Copy link
Copy Markdown
Member

@cyphar cyphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I prefer this to #3992.

(To be honest, I think umask is an unfortunate wart on Unix (probably created to try to standardise shell tool behaviour, but it makes little sense for proper administrative programs IMHO).)

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.

3 participants