Skip to content

cp: Wrong handling of -i -u #6019

@BenWiederhake

Description

@BenWiederhake

When copying an old file over a new file, cp still needs to ask: -u is --update=older, which according to the man page only influences which files are considered for overwriting. In other words, -u does not work by automatically allowing anything, but rather by disregarding some copy actions.

Minimal example:

$ touch old; sleep 2; touch new; echo N | LC_ALL=C cp -i -u new old
cp: overwrite 'old'? [$? = 1]
$ touch old; sleep 2; touch new; echo N | cargo run cp -i -u new old
$

Found while trying to fix #4725.

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