GNU bug report logs -
#61105
cp/mv: want a fatal --no-clobber
Previous Next
Reported by: Mike Frysinger <vapier <at> gentoo.org>
Date: Fri, 27 Jan 2023 20:53:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 61105 <at> debbugs.gnu.org (full text, mbox):
On 30/01/2023 20:12, Paul Eggert wrote:
> Better, I think, would be to change cp -n to be compatible with FreeBSD,
> where 'cp -n A B' exits with status 1 if B exists. This matches what
> FreeBSD 'cp -i A B' does when you say "no". This would be more useful
> than what GNU cp does, and the FreeBSD cp -i behavior conforms to POSIX
> whereas GNU cp -i (I think accidentally) does not. This would be simpler
> than adding a fatal --no-clobber, and would encourage portability a bit.
>
> The reason it's a POSIX conformance issue is that POSIX says exit status
> zero means "All files were copied successfully." which "cp -n A B" does
> not do when B exists.
>
> Similarly for 'mv' (though FreeBSD mv -i does not conform to POSIX here,
> unfortunately).
This is a good observation.
Also the current "skip" functionality of coreutils cp -n
is already catered for with the --update option.
cheers,
Pádraig
This bug report was last modified 2 years and 112 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.