fstat fails on mounted memory filesystem
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript, wasm
- Domain
- operating-systems
Research direction
Start in wasm-wasi-core/src/common/memoryFileSystemDriver.ts around lines 241-242 and inspect the memory filesystem rights used for files and directories. Reproduce with the linked memfs branch, then verify that opening /pipe/input followed by fstat no longer returns EPERM and that the reported FileOnlyBaseRights definition is addressed.
Written by the indexing model from the issue text.
Description
If I create /pipe/input on the memory file system, calling int fd = open("/pipe/input", O_RDONLY); will succeed, but calling fstat(fd, &stat) will fail with EPERM
const memFS = await wasm.createMemoryFileSystem();
const rootFileSystem = await wasm.createRootFileSystem([
{ kind: 'workspaceFolder' },
{
kind: 'memoryFileSystem',
mountPoint: '/pipe',
fileSystem: memFS
},
]);
const pipeIn = memFS.createWritable('./input', 'utf-8');
const seedBuf = new Uint8Array(1);
seedBuf[0] = 42;
pipeIn.write(seedBuf);
Repro: clone the "memfs" branch of https://github.com/lambdageek/big-buffer-write/tree/memfs build and run the extension and run it with "wasi: write big buffer". pick a small value from the Quick Pick, like 20.
Note the output in the output window:
2023-08-02 14:17:10.506 [error] stderr: the mode for /pipe is 040000
2023-08-02 14:17:10.506 [error] stderr: fstat input
2023-08-02 14:17:10.506 [error] stderr: :
2023-08-02 14:17:10.507 [error] stderr:
2023-08-02 14:17:10.507 [error] stderr: Operation not permitted
2023-08-02 14:17:10.507 [error] stderr:
2023-08-02 14:17:10.507 [error] stderr: that's EPERM
2023-08-02 14:17:10.509 [info] process terminated with exit code 1
Also, FileOnlyBaseRights looks like a typo:
This should probably be const FileOnlyBaseRights: rights = FileBaseRights & ~DirectoryBaseRights;
Why I care: .NET does an FStatCheckIO after opening a file that ends up failing
https://github.com/dotnet/runtime/blob/e2a2bfff005ea0620cf1d2b04a01dc90bbfe8ead/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs#L334
So FileStream f = File.OpenRead("/pipe/input") always fails
- Dominant language
- TypeScript
- Stars
- 456
- Forks
- 40
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 3
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-wasm
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/vscode-wasm#249 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/vscode-wasm#244 · 2 reactions ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
microsoft/vscode-wasm#240 ·
-
feature-request
Difficulty 5/5 Over a week Newbie friendliness 28/100
microsoft/vscode-wasm#235 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 25/100
microsoft/vscode-wasm#217 · 3 comments · 2 reactions ·
All issues in microsoft/vscode-wasm
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/vscode-livepreview#876 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
JustJarethB/invoicer#54 ·
-
ICP 1.2.0 shows a scheduled task's interval in milliseconds under the label "Interval (In seconds)"OpenNeeds Triage Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/product-integrator#2585 ·
Maintainers usually reply within 1 day
-
check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
design
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
MTES-MCT/monitor-field#119 ·
Maintainers usually reply within 1 day