Skip to content

cp: --remove-destination shouldn't fail if destination is symlink to source #5420

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
cakebaker opened this issue Oct 18, 2023 · 0 comments · Fixed by #5430
Closed

cp: --remove-destination shouldn't fail if destination is symlink to source #5420

cakebaker opened this issue Oct 18, 2023 · 0 comments · Fixed by #5430
Labels

Comments

@cakebaker
Copy link
Contributor

uutils cp:

$ touch a
$ ln -s a symlink
$ cargo run cp --remove-destination a symlink
cp: 'a' and 'symlink' are the same file

GNU cp, on the other hand, creates a copy of a named symlink:

$ touch a
$ ln -s a symlink
$ ls -l
total 0
-rw-r--r-- 1 dho dho 0 Oct 18 15:16 a
lrwxrwxrwx 1 dho dho 1 Oct 18 15:16 symlink -> a
$ cp --remove-destination a symlink 
$ ls -l
total 0
-rw-r--r-- 1 dho dho 0 Oct 18 15:16 a
-rw-r--r-- 1 dho dho 0 Oct 18 15:16 symlink
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