Skip to content
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: symlink-overwrite error-priority is wrong #6266

Open
BenWiederhake opened this issue Apr 24, 2024 · 0 comments · May be fixed by #6586
Open

cp: symlink-overwrite error-priority is wrong #6266

BenWiederhake opened this issue Apr 24, 2024 · 0 comments · May be fixed by #6586
Labels

Comments

@BenWiederhake
Copy link
Collaborator

Steps to reproduce:

  • Create two regular files, README.md and good/README.md, and a directory target/ that does not contain anything named README.md.
  • chdir into target/.
  • Try to copy in symlink-mode the files ../README.md and ../good/README.md to the current directory

Expected result: The first copy is successful, the second copy is refused with an error message that acknowledges that README.md was just created and must not be recreated.

Actual result: The first copy is successful, the second copy is refused with an error message that treats the newly-created README.md symlink as a file that always existed.

This also feels like it might lead to some other unexpected behavior, but I can't get it to do something worse like overwrite pointed-to files.

Demonstrator:

coreutils$ cd target/
coreutils/target$ rm -f README.md && ../../gnu/src/cp -s ../README.md ../good/README.md .
../../gnu/src/cp: will not overwrite just-created './README.md' with '../good/README.md'
[$? = 1]
coreutils/target$ rm -f README.md && cargo run cp -s ../README.md ../good/README.md .                
cp: will not copy '../good/README.md' through just-created symlink './README.md'
[$? = 1]
$

Found while reviewing #6208

@Luv-Ray Luv-Ray linked a pull request Jul 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant