Repository navigation
mv: do not follow a symlink destination when checking it - #15912
Merged
Merged
Conversation
Contributor
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
The overwrite guards ran only when the destination resolved, so -n, -i, -u, --update=none(-fail) and -b were all skipped for a dangling symlink, which was then replaced. Check the destination entry with lstat instead, and use the link's own mtime and mode for -u and the overwrite prompt, as GNU mv does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-u compared the times before the check that a directory can't replace a non-directory, so moving a directory into a target directory that holds a newer symlink of the same name was skipped and reported success. Only skip when the move itself is possible, and compare the source's own times too. On Windows, look at the symlink itself when checking that the destination is writable, as on Unix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sylvestre
force-pushed
the
mv-dangling-symlink-dest
branch
from
November 1, 2026 17:26
53096a7 to
69ae0db
Compare
Contributor
|
sorry for the slow reaction! Thanks for your PR |
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.
The overwrite guards ran only when the destination resolved, so -n, -i, -u,
--update=none(-fail) and -b were skipped for a dangling symlink, which was
then replaced. The destination is now checked with lstat, and -u and the
overwrite prompt use the link's own mtime and mode, as GNU mv does.
Closes #15778