mv a/ b: raw ENOTDIR surfaces under WASI instead of the translated "cannot stat" message
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start in handle_two_paths in src/uu/mv/src/mv.rs, where the trailing-slash source check relies on symlink_metadata() failing with ENOTDIR. Then run test_mv_dir_into_file_where_both_are_files in tests/by-util/test_mv.rs under the wasi_runner, which is currently skipped. Done means the translated 'cannot stat' message appears under WASI and the skip is removed. Pull request #15379 is already open against this, so check it before starting.
Written by the indexing model from the issue text.
Description
mv with a trailing slash on a non-directory source should fail with the translated cannot stat '<path>': Not a directory message, matching native behavior. Under the WASI sandbox, a raw ENOTDIR surfaces instead.
Found while enabling WASI integration tests for mv in #15320; the affected test (test_mv_dir_into_file_where_both_are_files in tests/by-util/test_mv.rs) is currently skipped under wasi_runner with this note.
Likely cause: handle_two_paths in src/uu/mv/src/mv.rs relies on source.symlink_metadata() failing with ENOTDIR when source has a
trailing slash but names a non-directory — that's how native stat(2) enforces the POSIX "trailing slash requires the final component to resolve to a directory" rule. Under wasmtime, symlink_metadata() on a trailing-slash path over a regular file does not fail, so the code treats the source as a normal (non-directory) path and falls through to the plain rename() call, where the raw ENOTDIR from the underlying syscall is returned unwrapped.
This is the same root cause category as #15358 (WASI's stat not enforcing the trailing-slash rule), but on the source side with a plain file rather than a symlink destination.
To reproduce under wasmtime:
touch a
touch b
mv a/ b
Expected: mv: cannot stat 'a/': Not a directory
Actual (WASI): mv: Not a directory (os error 54)
- Dominant language
- Rust
- Stars
- 24.3k
- Forks
- 2.1k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 313
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/coreutils
-
minorbug(mv): invalid mode errors not quotedPossibly taken @henrimarconni claimed this 4 days ago. OpenU - mv
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
ptx: break file missing path in error messagePossibly taken @Franklin-Qi claimed this 4 days ago. OpenU - ptx
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
uutils/coreutils#15307 · 1 comment ·
Maintainers usually reply within 1 day
-
minorbug(stat): os errno not stripped when failing to flush stdoutPossibly taken @cestercian claimed this 11 days ago. OpenU - stat
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
uutils/coreutils#15200 · 3 comments ·
Maintainers usually reply within 1 day
-
stty: support B460800 and B921600 baud ratesPossibly taken @oech3 claimed this 7 days ago. Openawaiting upstream U - stty
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
B - high priority U - du
Difficulty 1/5 Under an hour Newbie friendliness 82/100
uutils/coreutils#14984 · 1 comment ·
Maintainers usually reply within 1 day
All issues in uutils/coreutils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc#12576 ·
Maintainers usually reply within 1 day
-
good first issue gpu serve
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
biomejs/biome#12475 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day