GNU bug report logs - #12365
Incorrect return value of cp with no-clobber option

Previous Next

Package: coreutils;

Reported by: Anoop Sharma <sendtoanoop <at> gmail.com>

Date: Thu, 6 Sep 2012 11:59:01 UTC

Severity: normal

Tags: wontfix

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: Anoop Sharma <sendtoanoop <at> gmail.com>, 12365-done <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>, coreutils <coreutils <at> gnu.org>
Subject: bug#12365: Should cp -n return 0, when DEST exists?
Date: Thu, 06 Sep 2012 17:24:02 +0200
Bernhard Voelker wrote:
> On September 6, 2012 at 4:31 PM Eric Blake <eblake <at> redhat.com> wrote:
>
>> $ echo one > bar
>> $ echo two > blah
>> $ cp -n blah bar
>> $ echo $?
>> 0
>> $ cat bar
>> one
>>
>> that FreeBSD also returns 0 in this case, and I don't want to break
>> interoperability.  Therefore, I'm going to close this as a WONTFIX,
>> unless you also get buy-in from the BSD folks.
>
> Actually -n is implemented as if the user had answered 'n'
> when he used the -i option - sure enough without prompting
> the user.
>
>   $ echo n | cp -vi blah bar
>   cp: overwrite `bar'?
>   $ echo $?
>   0
>
> BTW: it's similar with the mv command.
>
>
> The texi page is a bit sparse about the exit value:
>
>   @exitstatus
>
> Maybe it's worth adding a line about the exist status
> when using -n or -i (together with answering 'n')?

Yes, please.  That would be an improvement.




This bug report was last modified 12 years and 262 days ago.

Previous Next


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