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
Some of filesystem APIs (including path_open) cannot handle symbolic links correctly. Consider below file structure:
.
├── Cargo.toml
└── dir
└── link -> ../Cargo.toml
Create a WASM binary that tries to open ./dir/link with path_open. Pre-opening the current directory (.) should be enough for the program to work, but with Node.js' WASI implementation it fails with a "Capabilities insufficient" error.
How often does it reproduce? Is there a required condition?
always (sorry, not tested on other platforms than my Mac)
What is the expected behavior? Why is that the expected behavior?
The program should be able to read the contents of dir/link (symlinked to Cargo.toml).
What do you see instead?
Call to path_open fails with error code 76 (notcapable).
Additional information
Reproduction steps and more details are available in the reproduction repostitory.
Looking at the implementation, the logic for following symlinks doesn't take the location of the link into consideration. Content of ./dir/link (../Cargo.toml) should be treated as relative to ./dir, but is actually treated as relative to the current directory.
The text was updated successfully, but these errors were encountered:
@uhyo I made a PR that fixes the issue in uvwasi (not so sure that it's the correct way to fix this though). You may want to track it. nodejs/uvwasi#224
Uh oh!
There was an error while loading. Please reload this page.
Version
v19.8.1, v20.5.1
Platform
Darwin uhyo 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
Reproduction repo: https://github.com/uhyo/node-wasi-symlink-bug
Some of filesystem APIs (including
path_open
) cannot handle symbolic links correctly. Consider below file structure:Create a WASM binary that tries to open
./dir/link
withpath_open
. Pre-opening the current directory (.
) should be enough for the program to work, but with Node.js' WASI implementation it fails with a "Capabilities insufficient" error.How often does it reproduce? Is there a required condition?
always (sorry, not tested on other platforms than my Mac)
What is the expected behavior? Why is that the expected behavior?
The program should be able to read the contents of
dir/link
(symlinked toCargo.toml
).What do you see instead?
Call to
path_open
fails with error code 76 (notcapable
).Additional information
./dir/link
(../Cargo.toml
) should be treated as relative to./dir
, but is actually treated as relative to the current directory.The text was updated successfully, but these errors were encountered: