You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WasmFS] Node backend can't open a write-only (0200) file for writing #27847
With WasmFS, the Node backend opens a file for O_WRONLY as if it were O_RDWR: NodeState::open passes fs.openSync an fopen-style mode string, and since the only write-only strings ("w", "a") truncate or append, O_WRONLY uses "r+" (node_backend.cpp#L47-L56, with a TODO). The host then refuses a file that may be written but not read, so a file with mode 0200 can't be opened for writing at all. That includes the open(O_CREAT | O_WRONLY, 0200) that creates it, since the backend creates the file and then opens it again.
Because of #27825, the host's EACCES is currently taken for a file descriptor, so the writes below land on the host's stderr and the file stays empty. With #27825 fixed, the open() fails with EACCES instead. Either way the file can't be written. (As root the host allows the open, so this only shows up for other users.)
Expected: write puts abc in file, and the second open() succeeds, as on Linux. Passing numeric flags (fs.constants.O_WRONLY and friends) to fs.openSync instead of a mode string would avoid the mapping problem; I have a PR ready for that.
Activity