Subject: bug#62572: cp --no-clobber behavior has changed

From: Bernhard Voelker <[email-masked]>
Date: Sat, 16 Dec 2023 22:46:57 +0100

On 12/15/23 21:13, Michael Stone wrote:
> On Fri, Dec 15, 2023 at 11:21:06AM -0800, Paul Eggert wrote:
>> Stlll, Pádraig gave a reasonable summary of why the change was made,
>> despite its incompatibility with previous behavior. (One thing I'd add
>> is that the FreeBSD behavior is inherently less race-prone.)

Whether the implementation is race-prone or not is an internal thing.
I think we're currently discussing more on a user-perspective level.

IIUC then the question is whether `cp -n` should continue to behave like
the (new) `cp --update=none` which returns EXIT_SUCCESS.

Regardless what other implementations do, when reading the -n description
from a user's point of view:

   -n, --no-clobber             do not overwrite an existing file (overrides a
                                  -u or previous -i option). See also --update

then I'd expect the tool to just skip existing files like `rsync --ignore-existing`
does.  In that regard I would be surprised if skipping files would result in an error.
Well, I would understand if there'd be a '--no-clobber=fail' option.

As Kamil added the option in 2009, I'd assume that the same patch was already
active in RHEL versions for quite some longer time.
Now changing the exit code feels kind of rough.

Therefore, from a pure user's perspective and regarding many years of precedence,
I am 80:20 for reverting the exit code change.

Have a nice day,
Berny