Skip to content

cp/mv/ln/install: --backup= with an empty value is rejected #15988

Closed

Description

@sylvestre

GNU treats an empty --backup= like a bare --backup: it uses VERSION_CONTROL, or existing by default. uutils rejects it.

$ echo a > a; echo b > b
$ cp --backup= a b; ls

GNU: creates b~, exit 0. With VERSION_CONTROL=numbered it creates b.~1~.
uutils:

cp: cp: ambiguous argument '' for 'backup type'
Valid arguments are:
...

Same for mv, ln and install. The cp message also says cp: cp: twice.

The backup-mode parsing is shared in uucore (backup_control), so one fix should cover all four.

Reported in #15254 (found by a differential fuzzer; reproduced against GNU coreutils 9.12).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions