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

2023-01-31 Thread Paul Eggert
On 2023-01-31 09:11, Pádraig Brady wrote: To me --update is less useful if it fails in this case. Fair enough, I installed the attached to revert the --update part of the change, so that --update will work as before.From 01503ce7319b099d9deaeab43628e1b2b07a874a Mon Sep 17 00:00:00 2001 From: P

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

2023-01-31 Thread Pádraig Brady
On 31/01/2023 16:55, Paul Eggert wrote: On 2023-01-30 13:35, Pádraig Brady wrote: This is a good observation. Also the current "skip" functionality of coreutils cp -n is already catered for with the --update option. For consistency, there too the exit status should reflect whether the cp actio

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

2023-01-31 Thread Paul Eggert
On 2023-01-30 13:35, Pádraig Brady wrote: This is a good observation. Also the current "skip" functionality of coreutils cp -n is already catered for with the --update option. For consistency, there too the exit status should reflect whether the cp action was done. I installed the attached p

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

2023-01-30 Thread Pádraig Brady
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

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

2023-01-30 Thread Paul Eggert
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

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

2023-01-27 Thread Mike Frysinger
On 27 Jan 2023 23:59, Pádraig Brady wrote: > On 27/01/2023 20:52, Mike Frysinger wrote: > > basically i've been writing things like: > > if ! cp -n foo bar; then > >... error out because bar already exists, or otherwise failed ... > > fi > > > > when really i need to write: > > if [ -e bar ] |

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

2023-01-27 Thread Pádraig Brady
On 27/01/2023 20:52, Mike Frysinger wrote: i've been under the mistaken assumption that the -n/--no-clobber option exits non-zero when the target exists, but someone pointed out to me recently that it silently ignores existing files. can we get a setting to control this ? Yes --no-clobber={ski

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

2023-01-27 Thread Mike Frysinger
i've been under the mistaken assumption that the -n/--no-clobber option exits non-zero when the target exists, but someone pointed out to me recently that it silently ignores existing files. can we get a setting to control this ? basically i've been writing things like: if ! cp -n foo bar; then