#14970·coreutils

pathchk: empty path operand is accepted under WASI (wasmtime)

Author: eduardomourarCreated Sep 29, 2026Updated Sep 30, 2026
LabelsU - pathchk

Summary

Under the WASI runner (wasmtime, wasip1), pathchk "" with a preopened succeeds instead of failing with "No such file or directory". This diverges from the behavior on other platforms and from GNU.

Details

pathchk decides whether to reject an empty operand by asking the platform via fs::symlink_metadata. On Unix hosts symlink_metadata("") returns ENOENT, so the empty path is rejected. Under WASI with a preopen, it returns Ok, so the operand is accepted and no error is produced.

Reproduction

wasmtime --dir=.::/ pathchk.wasm ""

Expected: pathchk: '': No such file or directory and a non-zero exit. Actual (WASI): succeeds with no output.

Impact

The empty-path assertions in test_default_mode cannot run under the WASI runner and are gated out there. The rest of the test still runs.

System details

Rust version: 1.98.1 Target: wasm32-wasip1 wasmtime: 47.0.3