Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

mv a/ b: raw ENOTDIR surfaces under WASI instead of the translated "cannot stat" message

Closed
#15,370 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@limadog9 is already working on this.

Since Oct 15, 2026.

  • #15379 by @limadog9 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust, wasm
Domain
cli

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

U - mv

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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.