Skip to content

Conversation

@wingo
Copy link
Contributor

@wingo wingo commented Dec 8, 2025

On Windows, attempting to hard-link a directory gave ErrorCode::Access instead of NotPermitted. Fix it in the wasi crate instead of cap-std or wasi-common because it's where the sync/tokio configurations flow. Should fix wasmtime for
WebAssembly/wasi-testsuite#177.

@wingo wingo requested a review from a team as a code owner December 8, 2025 11:14
On Windows, attempting to hard-link a directory gave ErrorCode::Access
instead of NotPermitted.  Fix it in the wasi crate instead of cap-std or
wasi-common because it's where the sync/tokio configurations flow.
Should fix wasmtime for
WebAssembly/wasi-testsuite#177.
@wingo wingo force-pushed the canonicalize-hard-link-errors branch from 8288935 to 26724f3 Compare December 8, 2025 11:17
@wingo
Copy link
Contributor Author

wingo commented Dec 8, 2025

As with #12136 (comment), I don't have a Windows system on which to test, just that the fix seems right (and will be tested via wasi-testsuite).

@github-actions github-actions bot added the wasi Issues pertaining to WASI label Dec 8, 2025
#[cfg(windows)]
Err(ErrorCode::Access) => Err(ErrorCode::NotPermitted),
Ok(()) => Ok(()),
Err(err) => Err(err.into()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this into() redundant?
Looking at L928 it appears that the err is already ErrorCode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard_link appears to return err as std::io::Error. In any case that is what the compiler thinks :)

@wingo
Copy link
Contributor Author

wingo commented Dec 9, 2025

It turns out this commit is a mistake; there are cases in which Windows can return EACCESS that aren't related to hard-links to directories. So, instead I filed WebAssembly/WASI#848 to relax the spec and loosened the wasi-testsuite test.

@wingo wingo closed this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants