Skip to content

Fix std path, descriptor wait, and WASI clock boundaries - #801

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:fix/std-boundary-followups
Sep 26, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:fix/std-boundary-followups

Conversation

@LunaStev

Copy link
Copy Markdown
Member

Summary

Fix four standard-library boundary cases: reject negative POSIX descriptors before single-descriptor readiness waits, exclude parent-directory components from path extensions, validate path copy destinations before writing, and preserve the full unsigned WASI timestamp range when constructing TimeSpec.

Motivation

Negative descriptors could turn an infinite readiness wait into an indefinite block. Parent components such as dir/.. were treated as having an extension, invalid path destinations could be written through, and valid WASI timestamps above i64::MAX were rejected before splitting seconds and nanoseconds.

Closes #710
Closes #752
Closes #753
Closes #755

Target and compatibility impact

  • Single-descriptor waits return -EBADF for negative descriptors on Linux, macOS, and FreeBSD. Generic net_poll keeps its disabled-entry behavior; Windows socket-handle behavior is unchanged.
  • Path copy helpers return -1 for null destinations, nonpositive capacities, or insufficient space, without writing. Join capacity checks avoid overflowing a sum of lengths.
  • Final . and .. components have no extension; existing hidden-file and trailing-dot behavior is retained.
  • WASI clocks accept all u64 nanosecond values while retaining host errors and preserving the output on failure. No API signatures or compiler/std compatibility revisions change.

Validation

After rebasing onto canonical master with #800 merged:

  • LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo test --locked --jobs 2 --test std_io_regressions passed, including path/readiness fixtures at O0/O2. Local socket tests require execution outside the network sandbox.
  • LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 WAVE_RUN_WASM_RUNTIME_TESTS=1 cargo test --locked --jobs 2 --test release_stabilization webassembly_runtime_is_freestanding_and_wasi_retries_preserve_errors passed, including WASI timestamps at 0, i64::MAX, i64::MAX + 1, and u64::MAX at O0/O2.
  • cargo fmt --all -- --check, bash tools/check_std_policy.sh, and the PR diff whitespace check passed.

Earlier validation of these same changes passed workspace Clippy with -D warnings, 289 corpus cases, all 26 std examples, and 20 O0/O2 cross-compilation checks for paths and TCP code on macOS amd64/arm64, Windows amd64/arm64, and FreeBSD amd64. Native non-Linux execution remains CI validation.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates. Existing API corrections are described above and in source comments; no new public API or diagnostic is introduced.
  • The change preserves the license boundary between the compiler and std/.

@LunaStev
LunaStev merged commit cd48353 into wavefnd:master Sep 26, 2026
26 checks passed
@LunaStev LunaStev mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant