[Top][All Lists]

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

Re: Should cp -n return 0, when DEST exists?

From: Eric Blake
Subject: Re: Should cp -n return 0, when DEST exists?
Date: Thu, 06 Sep 2012 08:31:53 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

tag 12365 wontfix

On 09/06/2012 04:50 AM, Anoop Sharma wrote:
> When -n option of cp is used and the DEST file exists, then, as
> expected, cp is not able to copy the SOURCE to DEST.
> However, cp returns 0 in this case.

cp -n is not mandated by POSIX, so we are free to do as we wish here.
But looking at history, we added -n for coreutils 7.1 in Feb 2009, and
the mail from that thread includes:

which states we are modeling after FreeBSD.  A quick check on my FreeBSD
8.2 VM shows:

$ echo one > bar
$ echo two > blah
$ cp -n blah bar
$ echo $?
$ cat bar

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.

By the way, there's no need to post three separate emails with the same
contents, without first waiting at least 24 hours.  Like most other
moderated GNU lists, you do not have to be a subscriber to post, and
even if you are a subscriber, your first post to a given list will be
held in a moderation queue for as long as it takes for a human to
approve your email address as a non-spammer for all future posts
(generally less than a day).

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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