mv: improve move-to-self error handling#6995
Merged
sylvestre merged 1 commit intouutils:mainfrom Dec 26, 2024
sgvictorino:improve-mv-to-self-errors
Merged
mv: improve move-to-self error handling#6995sylvestre merged 1 commit intouutils:mainfrom sgvictorino:improve-mv-to-self-errors
sylvestre merged 1 commit intouutils:mainfrom
sgvictorino:improve-mv-to-self-errors
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Contributor
|
is there a bug somewhere or it is just something you identified ? |
sylvestre
reviewed
Dec 26, 2024
| ) -> UResult<()> { | ||
| let target_is_dir = target_is_dir && !opts.no_target_dir; | ||
|
|
||
| let canonicalized_source = match canonicalize( |
Contributor
There was a problem hiding this comment.
could you please add some comments explaining the different cases ?
Contributor
Author
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: |
Contributor
|
excellent, thanks! |
Contributor
Author
|
That would be greatly appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
errors more closely with coreutils: