Fix umask being ignored on file creation#26763
Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom Apr 23, 2026
Merged
Conversation
kripken
reviewed
Apr 23, 2026
sbc100
commented
Apr 23, 2026
kripken
approved these changes
Apr 23, 2026
2c1c569 to
0eaf83f
Compare
A process-wide umask was being ignored by both the default JavaScript filesystem and the new C++ WasmFS when creating files and directories. For the default filesystem: - Moved __syscall_umask implementation from C to JavaScript in libsyscall.js. - Stored the umask state in $SYSCALLS.currentUmask. - Applied the umask in __syscall_openat, __syscall_mkdirat, and __syscall_mknodat. - This makes umask thread-local (per JS instance), consistent with how cwd is handled. For WasmFS: - Added umask state and accessors to the WasmFS class in wasmfs.h. - Implemented __syscall_umask in syscalls.cpp as an extern "C" function to satisfy Musl's umask.c. - Applied the umask in doOpen and doMkdir in syscalls.cpp. Test updates: - Updated test_umask.c to use raw mode 0666 and added a test for mkdir. Fixes: emscripten-core#26707
Collaborator
|
I wonder if this fixes some Python tests that are currently xfailed. |
Collaborator
|
There are currently three Python tests that are xfailed because "Emscripten's umask is a stub". There's also several others that probably should be xfailed but pass due to the test environment coincidentally having a specific umask. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A process-wide umask was being ignored by both the default JavaScript filesystem and the new C++ WasmFS when creating files and directories.
For the default filesystem:
For WasmFS:
Fixes: #26707