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

From: Pádraig Brady <[email-masked]>
Date: Fri, 31 Mar 2023 22:32:12 +0100

On 31/03/2023 22:15, Paul Eggert wrote:
> On 2023-03-31 13:37, Sven Joachim wrote:
>> On 2023-03-31 13:01 -0700, Paul Eggert wrote:
>>
>>> part of the idea was to let shell programmers easily test whether
>>> cp successfully copied the data.
>>
>> By making them stop using the '-n' option, since they cannot rely on the
>> exit code anyway?
> 
> Portable code could not rely on the exit status anyway, as FreeBSD cp
> agrees with the new GNU behavior, not the old. See:
> 
> https://bugs.gnu.org/61105
> 
> It was a messy situation where there was no perfect solution. That being
> said, there is an advantage of consistency with FreeBSD, and the new GNU
> behavior does avoid the race mentioned in Bug#61105.

Perhaps we should support:
   --no-clobber[={skip, fail (default)}]

so then users can at least easily change -n to --no-clobber=skip
to get the old behavior?

An alternative would be to augment the --update option to support:
   --update[={none, older (default)}]
where --update=none would be the equivalent of the old -n behavior.

Perhaps we should also diagnose files skipped in the -n fail case,
to make it easier for users to see what the issue is.

cheers,
Pádraig