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 #125 received at 62572 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 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: Sat, 24 Feb 2024 22:13:42 +0000
[Message part 1 (text/plain, inline)]
On 01/02/2024 00:36, Paul Eggert wrote:
> On 1/31/24 06:06, Pádraig Brady wrote:
>> To my mind the most protective option takes precedence.
> 
> That's not how POSIX works with mv -i and mv -f. The last flag wins. I
> assume this is so that people can have aliases or shell scripts that
> make -i the default, but you can override by specifying -f on the
> command line. E.g., in mymv:
> 
>      #!/bin/sh
>      mv -i "$@"
> 
> then "mymv -f a b" works as expected.
> 
> Wouldn't a similar argument apply to cp's --update options?
> 
> Or perhaps we should play it safe, and reject any combination of
> --update etc. options that are incompatible. We can always change our
> mind later and say that later options override earlier ones, or do
> something else that's less conservative.

OK I err'd on the side of changing as little as possible wrt precedence.
-n still has precedence over any -u,--update option.
That's simplest to understand (while not changing existing precedence),
and shouldn't cause any practical issues.

I plan to push the 2 attached patches for this tomorrow.

thanks,
Pádraig
[0001-cp-mv-reinstate-that-n-exits-with-success-if-files-s.patch (text/x-patch, attachment)]
[0002-cp-mv-add-update-none-fail-to-fail-if-existing-files.patch (text/x-patch, attachment)]

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

Previous Next


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