-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
mv: improve move-to-self error handling #6995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
GNU testsuite comparison:
|
GNU testsuite comparison:
|
1 similar comment
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
is there a bug somewhere or it is just something you identified ? |
) -> UResult<()> { | ||
let target_is_dir = target_is_dir && !opts.no_target_dir; | ||
|
||
let canonicalized_source = match canonicalize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add some comments explaining the different cases ?
nushell users reported the data loss that got me working on this: nushell/nushell#13082 |
- improve move-to-self detection, so this errors without data loss: ```diff mkdir mydir mv mydir mydir/subdir -mv: No such file or directory (os error 2) +mv: cannot move 'mydir' to a subdirectory of itself, 'mydir/subdir' ``` - align "cannot move source to a subdirectory of itself" and "same file" errors more closely with coreutils: ```diff mkdir mydir mv mydir/ mydir/.. -mv: cannot move 'mydir/' to a subdirectory of itself, 'mydir/../mydir/' +mv: 'mydir/' and 'mydir/../mydir' are the same file ```
GNU testsuite comparison:
|
excellent, thanks! |
That would be greatly appreciated! |
errors more closely with coreutils: