From unknown Sun Aug 10 16:51:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#12365 <12365@debbugs.gnu.org> To: bug#12365 <12365@debbugs.gnu.org> Subject: Status: Incorrect return value of cp with no-clobber option Reply-To: bug#12365 <12365@debbugs.gnu.org> Date: Sun, 10 Aug 2025 23:51:30 +0000 retitle 12365 Incorrect return value of cp with no-clobber option reassign 12365 coreutils submitter 12365 Anoop Sharma severity 12365 normal tag 12365 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 07:58:40 2012 Received: (at submit) by debbugs.gnu.org; 6 Sep 2012 11:58:40 +0000 Received: from localhost ([127.0.0.1]:42436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ajH-0001WM-JH for submit@debbugs.gnu.org; Thu, 06 Sep 2012 07:58:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33547) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9ajF-0001WF-HM for submit@debbugs.gnu.org; Thu, 06 Sep 2012 07:58:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9aj2-0002zX-Nv for submit@debbugs.gnu.org; Thu, 06 Sep 2012 07:58:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:36430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9aj2-0002zT-Kq for submit@debbugs.gnu.org; Thu, 06 Sep 2012 07:58:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9aiy-0000wR-KG for bug-coreutils@gnu.org; Thu, 06 Sep 2012 07:58:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9air-0002yA-1p for bug-coreutils@gnu.org; Thu, 06 Sep 2012 07:58:20 -0400 Received: from mail-qa0-f48.google.com ([209.85.216.48]:53779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9aiq-0002y6-Tz for bug-coreutils@gnu.org; Thu, 06 Sep 2012 07:58:12 -0400 Received: by qady1 with SMTP id y1so1623104qad.0 for ; Thu, 06 Sep 2012 04:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=IpMp3U6Koq71ISJhlRFrtq6X34CEtbETgJoRuQvai/Y=; b=yno4iMpig0awFJxHGCfFvRiGqyL3aM2BiLk7fIMl5C0Ckz8J+pF1B/+k2vwrcL5Vj4 aSsH8bvgz434WPhXz8+e84yY5Ij8l8YsSo9sDwGlH2gXiL09wPygTtg5FyvGLnjZjzA7 psfJrTW5c3uokg92pn8L9QmDE47pjGMwquUt5rAYOu2IoGzj7xY5bjNV9wUCfKYOX/71 T0XE6mDQSZezgy6NmVgI6hmwgrKqjqMYfytpQZEHQuZFTChqIqgBm8P4xLsTPEthCjyx FhuZvpFN/Ep1+x+cTWIzsS95ie28dTIrdZKtlHmgiDgevNWo+NCSX236MugX/mK+phfW Hn7A== Received: by 10.224.115.208 with SMTP id j16mr3929058qaq.54.1346932692268; Thu, 06 Sep 2012 04:58:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.131.163 with HTTP; Thu, 6 Sep 2012 04:57:52 -0700 (PDT) In-Reply-To: References: From: Anoop Sharma Date: Thu, 6 Sep 2012 17:27:52 +0530 Message-ID: Subject: Incorrect return value of cp with no-clobber option To: bug-coreutils@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) When -n (--no-clobber) 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. Shouldn't it return 1 to indicate that copy operation could not be completed? In absence of this indication how is one to know that some recovery action like re-trying cp with some other DEST name is required? Regards, Anoop From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 10:32:11 2012 Received: (at control) by debbugs.gnu.org; 6 Sep 2012 14:32:11 +0000 Received: from localhost ([127.0.0.1]:44238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9d7q-0005SY-OX for submit@debbugs.gnu.org; Thu, 06 Sep 2012 10:32:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64986) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9d7n-0005SK-Nd; Thu, 06 Sep 2012 10:32:09 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q86EVsNE024116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Sep 2012 10:31:54 -0400 Received: from [10.3.113.60] (ovpn-113-60.phx2.redhat.com [10.3.113.60]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q86EVrVO022848; Thu, 6 Sep 2012 10:31:53 -0400 Message-ID: <5048B3D9.8060903@redhat.com> Date: Thu, 06 Sep 2012 08:31:53 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 MIME-Version: 1.0 To: Anoop Sharma Subject: Re: Should cp -n return 0, when DEST exists? References: In-Reply-To: X-Enigmail-Version: 1.4.4 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBE9395B5621F5E6FF172C3D1" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control Cc: 12365-done@debbugs.gnu.org, coreutils X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBE9395B5621F5E6FF172C3D1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable tag 12365 wontfix thanks 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. >=20 > 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: https://lists.gnu.org/archive/html/bug-coreutils/2008-12/msg00159.html 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 $? 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. 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). --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigBE9395B5621F5E6FF172C3D1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQSLPZAAoJEKeha0olJ0NqokAH/i3PmftQN7LhYh8fahDDLurI cq2Mocq6izBp1BXoAir7t/XR3btbmrcuoe8XelVY1EdGS/5ZHO4eevUi5U94zgg8 cEPbqQMIcIJ5jlAcEvRMgvgw/4pG/m+P8L1W96dVkxMvp37dIeiOXaQKpxRbmArw JxiXVOqvA05mP5ka7zn/z+ncnjukAPjvcwpITs9L4OvR5Bl8dEbL0luDyXSAkN2o 3syEDc2YL6BnZ8HBIRAYEVSkwPe44SqC1DmG+JhOawBfK2DetZ9PUgN7+EoKzxIn EV3YBc0TgNKs8eA8fjAk7urkezVPvD5Kn6PaFRrVDIUkTCI6veG8n3PED/eU4XY= =l/I1 -----END PGP SIGNATURE----- --------------enigBE9395B5621F5E6FF172C3D1-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 11:21:46 2012 Received: (at 12365-done) by debbugs.gnu.org; 6 Sep 2012 15:21:46 +0000 Received: from localhost ([127.0.0.1]:44285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9dtq-0007TP-6f for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:21:46 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:58047) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9dtn-0007TH-As for 12365-done@debbugs.gnu.org; Thu, 06 Sep 2012 11:21:44 -0400 Received: from oxbaltgw11.schlund.de (oxbaltgw11.schlund.de [172.19.246.17]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MVb0p-1T4y6M3abH-00Z3RS; Thu, 06 Sep 2012 17:21:25 +0200 Date: Thu, 6 Sep 2012 17:21:25 +0200 (CEST) From: Bernhard Voelker To: Anoop Sharma , Eric Blake Message-ID: <652968300.1150119.1346944885703.JavaMail.open-xchange@email.1und1.de> Subject: Re: bug#12365: Should cp -n return 0, when DEST exists? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v- X-Provags-ID: V02:K0:2j08BFbg8WS0JFU+mF8nsQ/IYVDPkZb6fGcWd/4x3vL UXkKxNzWtRWGa/TP1r5893WiWrG37+r6w8tTMABDsj6Q5lWvD1 cbOQuZ5p7H3ez1cJNV88E1zsnUPAo446nkxCMZlC+03TYRH02A EFA9KUnwUJ5JRYvf61ONyzblLkbAxr2DRng+XSesEyDTXOboLR TDNdMplKas1sqUWcO0d5WfrMqGuZFqLMg8WSv7NdKk0JcPdl+j sNq6KVX7pAdXPzeKDp8TGL9aqOwkEl5PEASBH8zFfkMoDhcQx0 Ewlc/EAwlxfODrJ7kFD/XY52SXvvM4zhGbVWqCpwFjc+FWOugv 3TnAsr87BRTWLsRnOqaSrKoXcISuRXd+y8ZgqEG8d+aVwqKvDV SESV8I7f+cHv1TCBx5ZMu8iGLIDklChBXYH6EwYcOLA5NxvP9c ZhOoE X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12365-done Cc: 12365-done@debbugs.gnu.org, coreutils X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Bernhard Voelker List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On September 6, 2012 at 4:31 PM Eric Blake 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 From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 11:24:21 2012 Received: (at 12365-done) by debbugs.gnu.org; 6 Sep 2012 15:24:21 +0000 Received: from localhost ([127.0.0.1]:44289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9dwK-0007XF-LY for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:24:21 -0400 Received: from mx.meyering.net ([88.168.87.75]:46557) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9dwH-0007X4-MN for 12365-done@debbugs.gnu.org; Thu, 06 Sep 2012 11:24:19 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 5E7866047D; Thu, 6 Sep 2012 17:24:02 +0200 (CEST) From: Jim Meyering To: Bernhard Voelker Subject: Re: bug#12365: Should cp -n return 0, when DEST exists? In-Reply-To: <652968300.1150119.1346944885703.JavaMail.open-xchange@email.1und1.de> (Bernhard Voelker's message of "Thu, 6 Sep 2012 17:21:25 +0200 (CEST)") References: <652968300.1150119.1346944885703.JavaMail.open-xchange@email.1und1.de> Date: Thu, 06 Sep 2012 17:24:02 +0200 Message-ID: <87vcfrw4x9.fsf@rho.meyering.net> Lines: 35 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12365-done Cc: Anoop Sharma , 12365-done@debbugs.gnu.org, Eric Blake , coreutils X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Bernhard Voelker wrote: > On September 6, 2012 at 4:31 PM Eric Blake 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 06 12:52:40 2012 Received: (at 12365-done) by debbugs.gnu.org; 6 Sep 2012 16:52:40 +0000 Received: from localhost ([127.0.0.1]:44468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9fJo-00019X-7c for submit@debbugs.gnu.org; Thu, 06 Sep 2012 12:52:40 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:49183) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9fJl-00019Q-TD for 12365-done@debbugs.gnu.org; Thu, 06 Sep 2012 12:52:39 -0400 Received: from oxbaltgw11.schlund.de (oxbaltgw11.schlund.de [172.19.246.17]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0LznVv-1Tf6NZ2QuB-014pug; Thu, 06 Sep 2012 18:52:23 +0200 Date: Thu, 6 Sep 2012 18:52:22 +0200 (CEST) From: Bernhard Voelker To: Jim Meyering Message-ID: <770971827.1154086.1346950342150.JavaMail.open-xchange@email.1und1.de> In-Reply-To: <87vcfrw4x9.fsf@rho.meyering.net> References: <652968300.1150119.1346944885703.JavaMail.open-xchange@email.1und1.de> <87vcfrw4x9.fsf@rho.meyering.net> Subject: Re: bug#12365: Should cp -n return 0, when DEST exists? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v- X-Provags-ID: V02:K0:nuty/jw/K8Hwl787vN33MitQLF1kWPAzpfUx0OeONqi v++iqqFMAJOtKPJIbscpX+6i/FQ/yVN41nswcxS+pSaoJO0UWk 9posABJvdGH+pC/jP56bOmY4IIDGT/KHhh9sbxZhSq408bDaox Pk+GnGvdqWcSPHNNVehy9XbCpdZ5sYKkFR/+5ytpLwHQNlpcWN EwSPcMqgD4sdORJYlIoQFgAHFDzwmGrmtdWS0DOgLNVHV2/ciP TmZjFcZug+vDyLgA2Obwp2Fd4Zt4mcnGCSzKJWD6gfU4uGEHNF SmmERABOlgVKFbbsxz9RtDwOjhgMZBfdJvqFOQQt6S7ZmZYvwc WoqSry4RnCkhE2+AqweLicbzp9X9Ev7tbf0fOjrtaCThUYLVYL AknSROpOnBvNWJT0PgeVHX00XVwh5UafdzzE+Sk8Y0BIu6zp+k DXrEZ X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12365-done Cc: Anoop Sharma , 12365-done@debbugs.gnu.org, Eric Blake , coreutils X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Bernhard Voelker List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On September 6, 2012 at 5:24 PM Jim Meyering wrote: > Bernhard Voelker wrote: > > 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. (my first patch created on cygwin) >From 65d2d16340cee38f0a7e059af86be49f21eef84d Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 6 Sep 2012 18:39:47 +0200 Subject: [PATCH] doc: improve documentation of -n and -i for cp and mv * doc/coreutils.texi (cp invocation): Add a note about to the description of the option -n how it compares to -i. Add a note about a possible exit status zero when -n or -i is used. (mv invocation): Likewise. --- doc/coreutils.texi | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index f2620bc..0324d1b 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7772,8 +7772,14 @@ a regular file in the destination tree. @opindex -n @opindex --no-clobber Do not overwrite an existing file. The @option{-n} option overrides a previous -@option{-i} option. This option is mutually exclusive with @option{-b} or -@option{--backup} option. +@option{-i} option. +@macro optClobberAndI +In effect, this option works as if the option @option{-i} +was given and the user declined all questions to overwrite the targets (sure +enough without prompting). +@end macro +@optClobberAndI +This option is mutually exclusive with @option{-b} or @option{--backup} option. @item -P @itemx --no-dereference @@ -8026,8 +8032,15 @@ However, mount point directories @emph{are} copied. @end table +@cindex exit status of @command{cp} +Exit status: + @exitstatus +However, if the existing target is not overwritten because the option +@option{-n} is used or the option @option{-i} is used and the user has declined +overwriting that file, then @command{cp}'s exit status is yet zero. + @node dd invocation @section @command{dd}: Convert and copy a file @@ -8747,6 +8760,7 @@ If the response is not affirmative, the file is skipped. @cindex prompts, omitting Do not overwrite an existing file. @mvOptsIfn +@optClobberAndI This option is mutually exclusive with @option{-b} or @option{--backup} option. @item -u @@ -8778,8 +8792,15 @@ Print the name of each file before moving it. @end table +@cindex exit status of @command{mv} +Exit status: + @exitstatus +However, if the existing target is not overwritten because the option +@option{-n} is used or the option @option{-i} is used and the user has declined +overwriting that file, then @command{mv}'s exit status is yet zero. + @node rm invocation @section @command{rm}: Remove files or directories -- 1.7.9 From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 07 02:21:54 2012 Received: (at 12365) by debbugs.gnu.org; 7 Sep 2012 06:21:54 +0000 Received: from localhost ([127.0.0.1]:45317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9rww-0005iV-By for submit@debbugs.gnu.org; Fri, 07 Sep 2012 02:21:54 -0400 Received: from mail-qa0-f51.google.com ([209.85.216.51]:36982) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9rwt-0005iN-BE for 12365@debbugs.gnu.org; Fri, 07 Sep 2012 02:21:52 -0400 Received: by qadz3 with SMTP id z3so2029458qad.3 for <12365@debbugs.gnu.org>; Thu, 06 Sep 2012 23:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=pV8svkJx54ttXSZ7g8rwjUhOo4/B8jy+31AcNn3IehA=; b=SEjjGMMu1ZLKxzYmrCOYxIu6sWBWC9TkvFQCmMOiQm/EwdmdUFZFCovWCy1ESAlWjv jhP6Sg4vH1sE8MK4HTR3Rn2j54LOGydHMcYYhZwqqOxRfyP5KnKZj98EPSaSIuf5felI i+1++dg/vetr5bGq8+mkjAo7Ivn9IK/rP5iuwzJC/jvuhlbU6TVEZeIEoomWLI5vDmbv R+L0SZxV1wedhpjSR1iHMzBsqx7npKJhs7Lz9fG3PzTv48FwNPhxHFYozuDBS3ImKj4r CThHIw3Uwm1tUJEtm8B+nLtImaILRkfxMKcifBT7ty8b9ZfJR9F2PhSnnNyXpfW55ixb igdQ== Received: by 10.229.135.67 with SMTP id m3mr1442526qct.97.1346998894402; Thu, 06 Sep 2012 23:21:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.131.163 with HTTP; Thu, 6 Sep 2012 23:21:14 -0700 (PDT) In-Reply-To: References: <5048B3D9.8060903@redhat.com> From: Anoop Sharma Date: Fri, 7 Sep 2012 11:51:14 +0530 Message-ID: Subject: Re: bug#12365: closed (Re: Should cp -n return 0, when DEST exists?) To: 12365@debbugs.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12365 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Sep 6, 2012 at 8:03 PM, GNU bug Tracking System wrote: > Your bug report > > #12365: Incorrect return value of cp with no-clobber option > > which was filed against the coreutils package, has been closed. > > The explanation is attached below, along with your original report. > If you require more details, please reply to 12365@debbugs.gnu.org. > > -- > 12365: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12365 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems > > > ---------- Forwarded message ---------- > From: Eric Blake > To: Anoop Sharma > Cc: 12365-done@debbugs.gnu.org, coreutils > Date: Thu, 06 Sep 2012 08:31:53 -0600 > Subject: Re: Should cp -n return 0, when DEST exists? > tag 12365 wontfix > thanks > > 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: > https://lists.gnu.org/archive/html/bug-coreutils/2008-12/msg00159.html > > 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 $? > 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. > > 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 eblake@redhat.com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > > > > ---------- Forwarded message ---------- > From: Anoop Sharma > To: bug-coreutils@gnu.org > Cc: > Date: Thu, 6 Sep 2012 17:27:52 +0530 > Subject: Incorrect return value of cp with no-clobber option > When -n (--no-clobber) 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. > > Shouldn't it return 1 to indicate that copy operation could not be completed? > > In absence of this indication how is one to know that some recovery > action like re-trying cp with some other DEST name is required? > > Regards, > Anoop > > > Thank you, Eric. I am a newbie to open source development tools and processes. I had posted earlier to bug-coreutils@gnu.org and had got an acknowledgement mail immediately. Subsequently, I subscribed to coreutils@gnu.org and have now been subscribed for more than a month. I originally posted this mail to that list for discussion. However, there was no acknowledgement from there and I mistakenly assumed that some spam filter is stopping my mails from reaching the list. Therefore, I tweaked the text a bit in an attempt to get past the spam filter and tried multiple times. Finally, as a work-around, I posted to bug-coreutils@gnu.org and stopped thereafter, because I got an ack again! I will be more patient next time! Thanks for educating, Anoop From unknown Sun Aug 10 16:51:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 05 Oct 2012 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator