You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mv: raw ENOTDIR instead of translated error under WASI #15358
mv -T replacing a symlink-to-a-file with a directory should fail with the translated "cannot overwrite non-directory ... with directory ..." message, matching native behavior. Under the WASI sandbox, a raw ENOTDIR ("Not a directory") surfaces instead.
Found while enabling WASI integration tests for mv in #15320; the affected test (test_mv_replace_symlink_with_directory 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 decides whether to emit the translated message by checking target.exists() after resolving the symlink. On native targets this is true (the symlink's file target exists) and the code takes the source_is_dir && target.exists() branch, producing MvError::NonDirectoryToDirectory. Under wasmtime, exists() on that same symlink-to-file appears to return false, so the code falls through to the plain rename() path instead, where the raw ENOTDIR from the underlying rename(2) call is returned unwrapped.
To reproduce under wasmtime:
touch a
mkdir b
touch b/empty_file_b
ln -s a symlink
mv -T b symlink
Expected: mv: cannot overwrite non-directory 'symlink' with directory 'b'
Actual (WASI): mv: Not a directory (os error 54)
Activity
mv: diagnose directory overwrites of symlink destinations