Subject: Re: bug#12365: Should cp -n return 0, when DEST exists?

From: Bernhard Voelker <[email-masked]>
Date: Thu, 6 Sep 2012 17:21:25 +0200 (CEST)

On September 6, 2012 at 4:31 PM Eric Blake <[email-masked]> 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