GNU bug report logs - #62572
cp --no-clobber behavior has changed

Previous Next

Package: coreutils;

Reported by: Alberto Salvia Novella <es20490446e <at> gmail.com>

Date: Fri, 31 Mar 2023 17:49:01 UTC

Severity: normal

Full log


Message #110 received at 62572 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>,
 Michael Stone <mstone <at> debian.org>
Cc: 1058752 <at> bugs.debian.org, Bernhard Voelker <mail <at> bernhard-voelker.de>,
 62572 <at> debbugs.gnu.org
Subject: Re: bug#62572: Bug#1058752: bug#62572: cp --no-clobber behavior has
 changed
Date: Mon, 29 Jan 2024 13:44:16 -0800
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"?




This bug report was last modified 1 year and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.