Skip to content

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

@cakebaker

Description

@cakebaker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions