Skip to content

mv: skip the same-file error with -n and --update=none - #15825

Open
emirmrkaljevic wants to merge 1 commit into
uutils:mainfrom
emirmrkaljevic:mv-noclobber-same-file
Open

emirmrkaljevic wants to merge 1 commit into
uutils:mainfrom
emirmrkaljevic:mv-noclobber-same-file

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

Fixes #15824

GNU mv skips the same-file check when it would not replace the target (-n, --update=none), so mv -n z z is a silent no-op with exit 0. uutils reported "'z' and 'z' are the same file" and exited 1.

assert_not_same_file now returns Ok(()) in that case, and the later existing-target check skips the move as usual. Not changed: --update=none-fail, "subdirectory of itself" errors, and a bare . source.

Added test_mv_same_file_no_clobber (covers -n, --update=none, and --update=none-fail still failing). test_mv passes locally, fmt and clippy are clean.

Found with behave.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mv: -n and --update=none report 'are the same file' and exit 1; GNU exits 0

1 participant