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?)
- 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
- 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"?