8000 cp: symlink overwrite-detection is broken · Issue #6265 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cp: symlink overwrite-detection is broken #6265

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

Closed
BenWiederhake opened this issue Apr 24, 2024 · 0 comments · Fixed by #6380
Closed

cp: symlink overwrite-detection is broken #6265

BenWiederhake opened this issue Apr 24, 2024 · 0 comments · Fixed by #6380
Labels

Comments

@BenWiederhake
Copy link
Collaborator

Steps to reproduce:

  • Create two regular files, README.md and good/README.md, and an initially-empty directory tmp/.
  • Inside tmp, create an empty regular file foo, and a symlink README.md that points to foo.
  • Try to copy README.md and good/README.md to tmp/

Expected result: README.md is copied to tmp/ into the file foo, and the second attempt is aborted, leading to an error message and a non-zero (failure) exit code.

Actual result: README.md is copied to tmp/ into the file foo, and the second attempt is successful, leading to foo containing the contents of the second file, no error message, and a zero (success) exit code.

Demonstrator:

$ mkdir -p good && cp README.md good/README.md
$ rm -rf tmp/ && mkdir tmp/ && ln -s foo tmp/README.md && touch tmp/foo
$ ../gnu/src/cp README.md good/README.md tmp # Yes error!
../gnu/src/cp: will not copy 'good/README.md' through just-created symlink 'tmp/README.md'
[$? = 1]
$
$ mkdir -p good && cp README.md good/README.md
$ rm -rf tmp/ && mkdir tmp/ && ln -s foo tmp/README.md && touch tmp/foo
$ cargo run cp README.md good/README.md tmp # No error?!
$

Found while reviewing #6208

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
0