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

Change default umask from 0777 to 0027 #17270

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/lib/libc/emscripten_syscall_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static int g_pid = 42;
static int g_pgid = 42;
static int g_ppid = 1;
static int g_sid = 42;
static mode_t g_umask = S_IRWXU | S_IRWXG | S_IRWXO;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doing a little googling it seems that most linux distros default to 022. I wonder if we should do that same?

Also, I'm surprised to see now tests failing.. do our filesystems not honor this, or are there just no tests for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Several tests in CPython test suite are failing on a new buildbot. The same tests are not failing in containerized test environment. The buildbot uses an user account with fewer privileges while the container runs the tests as root with DAC override capability.

The failing code applies the umask directly to permission bits, for example https://github.com/python/cpython/blob/476d30250811e185615dfb971c6a810cac2093bd/Lib/dbm/dumb.py#L306-L317

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't doubt the fix, I'm just surprised we don't have any tests that depend on this in emscripten itself (we should probably add one).

static mode_t g_umask = 0 | S_IWGRP | S_IRWXO;

#ifdef NDEBUG
#define REPORT(name)
Expand Down