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: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Anoop Sharma <sendtoanoop <at> gmail.com>, Eric Blake <eblake <at> redhat.com>
Cc: 12365-done <at> debbugs.gnu.org, coreutils <coreutils <at> gnu.org>
Subject: bug#12365: Should cp -n return 0, when DEST exists?
Date: Thu, 6 Sep 2012 17:21:25 +0200 (CEST)


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')?

Have a nice day,
Berny




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

Previous Next


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