Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#15,370 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@limadog9 ci sta già lavorando.

Dal 15/10/2026.

  • #15379 di @limadog9 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, wasm
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)

Lingua principale
Rust
Stelle
24.3k
Fork
2.1k
Merge medio
2g 28m
PR unite (30g)
313

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di uutils/coreutils

Tutte le issue di uutils/coreutils

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.