bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61105: cp/mv: want a fatal --no-clobber


From: Pádraig Brady
Subject: bug#61105: cp/mv: want a fatal --no-clobber
Date: Mon, 30 Jan 2023 21:35:19 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]