Skip to content

Conversation

@wingo
Copy link
Contributor

@wingo wingo commented Dec 16, 2025

When attempting to unlink a directory, POSIX specifies the result should be EPERM, but only MacOS implements that behavior. Paper over the differences. Also turn EACCESS into EPERM, to paper over Windows differences.

Related to WebAssembly/WASI#852 and WebAssembly/wasi-testsuite#137.

POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html

@wingo wingo requested a review from a team as a code owner December 16, 2025 09:31
@wingo wingo force-pushed the canonicalize-unlink-dir-errors branch from d3f4a32 to 1c1bdbb Compare December 16, 2025 09:34
@wingo
Copy link
Contributor Author

wingo commented Dec 16, 2025

Seems this fails wasip1 tests which do want to assert that the error is ISDIR. Probably best to move this workaround to just the p3 bindings, because I don't want to touch p1 or p2.

@github-actions github-actions bot added the wasi Issues pertaining to WASI label Dec 16, 2025
@wingo wingo force-pushed the canonicalize-unlink-dir-errors branch from 1c1bdbb to 3b8ab4a Compare December 16, 2025 14:39
When attempting to unlink a directory, POSIX specifies the result should
be EPERM, but only MacOS implements that behavior.  Paper over the
differences.  Also turn EACCESS into EPERM, to paper over Windows
differences.

Related to WebAssembly/WASI#852 and
WebAssembly/wasi-testsuite#137.

POSIX 2008 reference: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
@wingo wingo force-pushed the canonicalize-unlink-dir-errors branch from 3b8ab4a to 6f80454 Compare December 16, 2025 14:53
@fitzgen fitzgen added wasi:impl Issues pertaining to WASI implementation in Wasmtime wasi:tests Issues pertaining to WASI tests in Wasmtime labels Dec 18, 2025
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Thanks! Could this have a test here as well? Also, could this be done around here to apply to wasip{1,2,3} uniformly instead of just wasip3?

@wingo
Copy link
Contributor Author

wingo commented Dec 19, 2025

I originally did it on filesystem.rs, but then that caused the existing p1/p2 tests to fail as they were expecting EISDIR, so I moved it to p3 only. Sure, can do a test here, will be after the holidays tho :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi:impl Issues pertaining to WASI implementation in Wasmtime wasi:tests Issues pertaining to WASI tests in Wasmtime wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants