Repository navigation
wasi: follow absolute link targets inside the directory - #313
Merged
andreaTP merged 3 commits intoNov 18, 2026
Merged
Conversation
Since bytecodealliance#304 a symbolic link whose target is absolute gives EPERM, also when the target is inside the directory the path starts from. With the host's root preopened every absolute target is inside, and links such as /usr/bin/java -> /etc/alternatives/java could no longer be opened. An absolute target is a host path. It is followed only when it lies below the directory the walk started from, compared both as configured (made absolute) and as its real path; the walk then starts again in that directory with no parents, so ".." still cannot leave it. Every other absolute target stays EPERM, and path_symlink still refuses to create one. Assisted-by: Claude:claude-fable-5-2
Path.relativize normalizes ".." lexically on the default file system, so "missing/.." resolved instead of giving ENOENT, and "link/.." ignored where the link points. Drop the directory's names instead, so the walk sees every name, as it does on ZeroFs.
andreaTP
approved these changes
Nov 17, 2026
andreaTP
left a comment
Contributor
There was a problem hiding this comment.
Thanks @JosepMariaBlasco great job!
Added a small improvement on top and LGTM
Windows removes ".." from an absolute target when it creates the link, so the POSIX expectations only apply where the target is kept as written.
Contributor
Author
|
Thanks, checked again with ooRexx on Linux and Windows at 5a64828, all good. |
Contributor
|
Thanks again for the help here @JosepMariaBlasco 🙏 |
Contributor
Author
|
Thank you for the review and the fixes! I tried main at 2fc6651 with ooRexx: the link probe behaves as with 1.2.0, our Windows tests pass with Endive’s own WASI, and the ooRexx test suite passes on Linux. Looking forward to the next release. |
Contributor
|
Going to release sometime soon over the next weeks, I'm trying to squeeze in a few more things. |
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.
Since #304 a symbolic link whose target is absolute gives EPERM, also when the target is inside the directory the path starts from. With the host's root preopened every absolute target is inside, and links such as /usr/bin/java -> /etc/alternatives/java could no longer be opened.
An absolute target is a host path. It is followed only when it lies below the directory the walk started from, compared both as configured (made absolute) and as its real path; the walk then starts again in that directory with no parents, so ".." still cannot leave it. Every other absolute target stays EPERM, and path_symlink still refuses to create one.