Skip to content

cp: error when trying to preserve metadata on dangling symbolic link #3531

@jfinkels

Description

@jfinkels

Combining the -P (--no-dereference) option and the -p (--preserve=mode,ownership,timestamps) option in uutils cp does not match the behavior of GNU cp when attempting to copy a symbolic link that points to a file that does not exist. (Contrast this with issue #3364, which was just about the -P option. That issue was resolved.)

GNU cp:

$ ln -s no-such-file dangle && cp -Pp dangle d2
# no output, d2 is created

uutils cp:

$ ln -s no-such-file dangle && ./target/release/cp -Pp dangle d2
./target/release/cp: 'dangle' -> '/home/jeffrey/src/coreutils/d2': No such file or directory (os error 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions