-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cp: fix symlink-overwrite error-priority #6586
Conversation
GNU testsuite comparison:
|
Yes, your change solves a bug, specifically for the scenario you test in target$ rm -f README.md && cp -vs ../README.md ../good/README.md .
'../README.md' -> './README.md'
cp: will not overwrite just-created './README.md' with '../good/README.md'
[$? = 1]
target$ rm -f README.md && cargo run -q cp -vs ../README.md ../good/README.md .
'../README.md' -> './README.md'
cp: will not copy '../good/README.md' through just-created symlink './README.md'
[$? = 1] |
Sorry for missing the test, I think it should be fixed now. |
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.
Looks correct, and I can't find a counter-example. There's no reason against merging this.
However, this feels a bit like enumerating the test cases and just hard-coding the response to each case. Are those really all cases? I'm a bit worried that this turns into a drawn-out game of whack-a-mole.
I find some other counter-examples after trying: let
I'm not sure whether I should open another issue to report it, I will try to find a more general way to resolve it any way. |
94c8235
to
0d9d919
Compare
GNU testsuite comparison:
|
Thank you for searching for more edge cases! Sounds like our logic is completely not aligned with what GNU coreutils does.
That sounds like the correct approach here. There should be a reasonably easy way to write this logic. The brute-force way to do this is to make a kind of "map" al "all" behaviors, kinda like a truth table (or a Karnaugh map if you're fancy), and then squint at it to see patterns, like "Oh this entire region behaves like X, so that's probably the first Of course, there are other ways. |
fix #6266