bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62572: Bug#1058752: bug#62572: cp --no-clobber behavior has changed


From: Pádraig Brady
Subject: bug#62572: Bug#1058752: bug#62572: cp --no-clobber behavior has changed
Date: Tue, 30 Jan 2024 11:18:12 +0000
User-agent: Mozilla Thunderbird

On 29/01/2024 21:44, Paul Eggert wrote:
On 1/29/24 08:11, Pádraig Brady wrote:

Right, that's why I'm still leaning towards my proposal in the last mail.

Well, I won't insist on doing nothing; however, the proposal needs
ironing out and now's a good time to do it before installing changes.


    - revert to previous exit success -n behavior
    - document -n as deprecated
    - provide --update=noclobber to give exit failure functionality

So --update=noclobber would differ in meaning from the deprecated-in-9.5
--no-clobber, but would agree in meaning with 9.4 --no-clobber? That
sounds pretty confusing for future users. (And a nit: why should one
spelling have a hyphen but the other doesn't?)

That's a fair point; just avoid "no-clobber" entirely.
We could choose a new name so. How about --update=none-fail

      - BTW, it probably makes sense to print a diagnostic for each
skipped file here
        as it's exceptional behavior, for which we're exiting with
failure for.

Coreutils 9.4 cp -n already does that, no? So I'm not sure what's being
proposed here.

    $ touch a b
    $ cp -n a b; echo $?
    cp: not replacing 'b'
    1

Sorry I got confused between your suggestion of added diagnostics,
and FreeBSD's silent behavior here. Looks like we just keep the
existing behavior of diagnosing 'not replacing' iff exiting with failure.

    - the existing --update=none provides the exit success functionality

It seems to me that this proposal conflates two questions:

* What rules should cp use to decide whether to update a destination?

* When cp decides not to update a destination, what should it do? Exit
with nonzero status? Output a diagnostic? Both? Neither?

Aren't these independent axes? If so, shouldn't they have independent
options? For example, since we have --update=older, shouldn't there be a
way to say "I want to copy A to B only if B is older than A, and I want
the exit status to be zero only if A was copied to B"?

Well they're not entirely independent.
It's more appropriate to output a diagnostic if exiting failure,
and POSIX also advises along the same lines.
We also have --verbose to control diagnostics somewhat
for the non failure case.

So we now have the proposed change as:

  - revert -n to old silent success behavior
  - document -n as deprecated
  - Leave --update=none as is (will be synonymous with -n)
  - Provide --update=none-fail to diagnose and exit failure

thanks,
Pádraig.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]