Repository navigation
feat(wasi): normalize wasi error codes - #13625
eduardomourar wants to merge 3 commits into
Conversation
|
GNU testsuite comparison: |
|
Can we avoid introducing many code with |
Merging this PR will improve performance by 55.94%2 warnings, 1 note
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
ecc7c96 to
650e875
Compare
I had to create 3 separate functions to deal with normalizing the WASI errors, but I think it does what you asked. |
9752428 to
d311b90
Compare
364e289 to
0d592ff
Compare
7185731 to
aee46e1
Compare
aee46e1 to
ab1e500
Compare
WASI reports directory errors with different errno values than Unix. Add `wasi_normalize_open_error` and `wasi_normalize_read_error` to map them to `ErrorKind::IsADirectory`. The functions do nothing on other targets. On WASI preview 2, `stat` on a symlink reports the inode of the link. `FileInformation::from_path` now opens a dereferenced symlink and uses `fstat`, so two paths to the same file compare as equal.
Use the new `uucore::error` helpers in cat, factor, sort, split, tee, tr and wc. These utilities now report `IsADirectory` on WASI instead of a raw errno. cat also maps the wasi-libc `ELOOP` value. On WASI preview 2, a nonzero `ExitCode` returned from main becomes 1. The multicall binary now passes the utility exit code to `exit` on preview 2.
Add integration tests for the WASI behavior. Annotate tests that the WASI sandbox cannot run with `#[uutests::wasi_ignore(ReasonKey)]`. Add `#[uutests::wasip2_ignore(ReasonKey)]` for limitations specific to wasm32-wasip2. Exclude tests that apply a file descriptor limit to the wasmtime runner with `#[cfg(not(wasi_runner))]`. Run the wasip2 integration suite in `wasi.yml`. Document the new macro in `docs/src/wasi-test-gaps.md`.
ab1e500 to
2038686
Compare
Continuation of #12653. Aligns error handling on wasm32-wasip1/wasm32-wasip2 with native Unix behavior, and enables the wasip2 integration test suite.