mv: show "same file" error for mv d/f d#5788
Merged
sylvestre merged 1 commit intouutils:mainfrom Dec 2, 2024
Merged
Conversation
Contributor
|
I wonder if this is the right fix. GNU Reproducer: $ mkdir t u
$ touch t/a
$ ln t/a u/a
$ mv t/a u
mv: 't/a' and 'u/a' are the same fileWith your patch: $ […]/target/debug/coreutils mv t/a u
[success] |
Contributor
Author
|
Thanks for your feedback. I didn't consider hard links when creating this PR :| |
Contributor
|
I think you can reuse/move around most of the code just before your patch. IIRC, it checks for hardlink equivalence when the target is a file, so if you build the target file name in case you get a directory I guess you might use the same check. |
Contributor
|
@cakebaker ping ? :) |
c5a2393 to
ba2c6a7
Compare
|
GNU testsuite comparison: |
ba2c6a7 to
2e4b7c8
Compare
Contributor
|
sorry, i missunderstood, it, reverting it |
Contributor
|
please reopen when ready :) |
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.
When using
mv d/f d, GNUmvfails with a "same file" error whereas uutilsmvdoesn't fail. This PR makes uutilsmvfail, too.