GNU bug report logs - #20775
cp: improve hardlink dups handling with "cp -a -u"

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Steffen Zahn <steffzahn@HIDDEN>; dated Tue, 9 Jun 2015 04:35:03 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'cp: improve hardlink dups handling with "cp -a -u"' from 'cp -a -u destroys files after they are copied' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 20775 <at> debbugs.gnu.org:


Received: (at 20775) by debbugs.gnu.org; 11 Jan 2019 08:53:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 03:53:37 2019
Received: from localhost ([127.0.0.1]:54512 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ghsZN-0007VB-BH
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2019 03:53:37 -0500
Received: from mail-pg1-f176.google.com ([209.85.215.176]:44172)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1ghsZL-0007Ut-UQ; Fri, 11 Jan 2019 03:53:36 -0500
Received: by mail-pg1-f176.google.com with SMTP id t13so6043315pgr.11;
 Fri, 11 Jan 2019 00:53:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=e0EppvtQc7sFGytf/8eLAhuCZwvLuYFjDda3ONr4f1k=;
 b=FO1YFfgQrQS+YUxUNNmyhD64mR3aKdMVJ7JXq2Y5aepIRVGFSXUwgRWeSp88xV4J8G
 FAWLoyRq8nXnLZnE2VuZSzIZkR2xOk3pmSBjQ0t6sSOXt3UCHkXdxlEhTLVrWPsg+HME
 L54sd4L3jHrJxHrYSkhqTbM2wLobIJB1oVDl6/SDhorPUWXXs6ovNDqbjjHe0L6g6Fhw
 k53Yaz7IUSVRZwYnqfIP3M8LPQ9Y8MzDJ5kkUnHY028aE3KLZEBAP9Fbsq1Gv4+F9HHB
 C9f0WkOPgMpc8TvANDV03+iuaBLarB/LtiNImDaohLtM1KRf+jBe+80Mb/5vKnI7Q+Cj
 Obzg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=e0EppvtQc7sFGytf/8eLAhuCZwvLuYFjDda3ONr4f1k=;
 b=MixHBB7IU1Mu/jzcY0czxLBY0uf4JFMrYhyZMVDABNal6iIEjIZqM59RS8fYF1KR4F
 Yfn4rOlLoFapIKYMSxhs9rDU0Eszfv5za4bCGB1moJDMWjkV+2+w2nbsmrVL6O/MO/So
 gk0Me/vb0cqNIbX7gs7rHuHGJUTF2qpeI74v4IC2wl82lt/guulpO4i0KXjTnWJ1AP8d
 xYkdRH5aQrUwoZr16m+TI6QeFgeqyLqctkn7wbF/QutIM3W0EIh7u2+IlrG7+JBcEjre
 o9h9XZ5Tf+gm6L0FrGRgOsz/Ea0ycPy0NRSNrC4fABZV35gPJSxYl+o0yC7JMr3TPyjA
 di6g==
X-Gm-Message-State: AJcUukepc/w5UivfI+a7Olz4a8Xm0Ly1/Km3FlX1JcWCMbw5EKtmSqAt
 fziXW6TzRzwyBiHfYyWYHe1sudzY
X-Google-Smtp-Source: ALg8bN4tORcRO9ilfKJna9FZbH2z36IpzfFIGlb6Kh3itrCim6fOQ49EL2yuIOPtoW0p1rzXdWNQqQ==
X-Received: by 2002:a63:7044:: with SMTP id a4mr12333707pgn.359.1547196809733; 
 Fri, 11 Jan 2019 00:53:29 -0800 (PST)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 x3sm233282341pgt.45.2019.01.11.00.53.28
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 11 Jan 2019 00:53:28 -0800 (PST)
Subject: Re: bug#20775: cp -a -u destroys files after they are copied
To: Steffen Zahn <steffzahn@HIDDEN>, 20775 <at> debbugs.gnu.org
References: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>
 <55923F1B.8050307@HIDDEN>
 <CAHt12b9zxwS4HALxJwT=eAej_VkmDWTj7fgy6JYUaJtKf+Q9Dg@HIDDEN>
 <5592BF8C.7000905@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <cde602fa-b6df-3af2-670a-ecde8db7eb8f@HIDDEN>
Date: Fri, 11 Jan 2019 01:53:27 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.4.0
MIME-Version: 1.0
In-Reply-To: <5592BF8C.7000905@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 20775
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 20775 wishlist
retitle 20775 cp: improve hardlink dups handling with "cp -a -u"
stop

With no further comments in more than 3 years,
I'm marking this as a "wish list" item.

-assaf




Information forwarded to bug-coreutils@HIDDEN:
bug#20775; Package coreutils. Full text available.

Message received at 20775 <at> debbugs.gnu.org:


Received: (at 20775) by debbugs.gnu.org; 30 Jun 2015 16:11:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 30 12:11:04 2015
Received: from localhost ([127.0.0.1]:34662 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Z9y7j-0000QJ-Nz
	for submit <at> debbugs.gnu.org; Tue, 30 Jun 2015 12:11:04 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59813)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eggert@HIDDEN>)
 id 1Z9y7f-0000Pb-2P; Tue, 30 Jun 2015 12:10:59 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4A486160176;
 Tue, 30 Jun 2015 09:10:53 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id xu3-GC55Aa8r; Tue, 30 Jun 2015 09:10:52 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id A60EF1608AB;
 Tue, 30 Jun 2015 09:10:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 7xlEXqB6d0hT; Tue, 30 Jun 2015 09:10:52 -0700 (PDT)
Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net
 [100.32.155.148])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8479B160176;
 Tue, 30 Jun 2015 09:10:52 -0700 (PDT)
Message-ID: <5592BF8C.7000905@HIDDEN>
Date: Tue, 30 Jun 2015 09:10:52 -0700
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: Steffen Zahn <steffzahn@HIDDEN>, "L. A. Walsh" <coreutils@HIDDEN>,
 20775 <at> debbugs.gnu.org, 10471 <at> debbugs.gnu.org
Subject: Re: bug#20775: cp -a -u destroys files after they are copied
References: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>	<55923F1B.8050307@HIDDEN>
 <CAHt12b9zxwS4HALxJwT=eAej_VkmDWTj7fgy6JYUaJtKf+Q9Dg@HIDDEN>
In-Reply-To: <CAHt12b9zxwS4HALxJwT=eAej_VkmDWTj7fgy6JYUaJtKf+Q9Dg@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.6 (/)
X-Debbugs-Envelope-To: 20775
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.6 (/)

Steffen Zahn wrote:
> it should be easy to repair

Really?  Without significantly affecting performance in the usual case?  Let's 
see a patch.




Information forwarded to bug-coreutils@HIDDEN:
bug#20775; Package coreutils. Full text available.

Message received at 20775 <at> debbugs.gnu.org:


Received: (at 20775) by debbugs.gnu.org; 30 Jun 2015 08:36:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 30 04:36:01 2015
Received: from localhost ([127.0.0.1]:33715 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Z9r1L-0003hv-6J
	for submit <at> debbugs.gnu.org; Tue, 30 Jun 2015 04:36:00 -0400
Received: from mail-la0-f44.google.com ([209.85.215.44]:35206)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <steffzahn@HIDDEN>)
 id 1Z9r1G-0003hW-Bl; Tue, 30 Jun 2015 04:35:55 -0400
Received: by lagh6 with SMTP id h6so4050739lag.2;
 Tue, 30 Jun 2015 01:35:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :content-type; bh=nltfZiVLCGRXAzZVxTqnsScTMor6iitnLmqPcAGU4IU=;
 b=GtzJViLJuoa8krr2Re+idpM8r/QM6quycoozhdjIN6Sg49orbtIOTWhyAXbIhEo7Qz
 Btmt79XXnm+IQLvTJtV/mwIHt7lDdwIm9RUJf0ZSdNVBoSNGttbkdY/6/YXEsweT0h3Z
 vBdgT7K9No0s18pzE+EI9bP5VchrYnFjlCvP7Qfpq5ToUnxiBL2lOEhfW3MQXTb4YYnN
 3kNCoArLZbf814rHN11fkPCJ0H/lqxzRs9lFLV4l5MqUZslZsi6dJWyck0WnvGRfB+vl
 4vwDB7HBzBl7AjsqHZqSQrn9Ha1M8rn2XucnPwEv0lBErxXxlmmVkg5CGReUA540/hHA
 IJMA==
X-Received: by 10.112.201.199 with SMTP id kc7mr10616511lbc.25.1435653348492; 
 Tue, 30 Jun 2015 01:35:48 -0700 (PDT)
MIME-Version: 1.0
References: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>
 <55923F1B.8050307@HIDDEN>
In-Reply-To: <55923F1B.8050307@HIDDEN>
From: Steffen Zahn <steffzahn@HIDDEN>
Date: Tue, 30 Jun 2015 08:35:36 +0000
Message-ID: <CAHt12b9zxwS4HALxJwT=eAej_VkmDWTj7fgy6JYUaJtKf+Q9Dg@HIDDEN>
Subject: Re: bug#20775: cp -a -u destroys files after they are copied
To: "L. A. Walsh" <coreutils@HIDDEN>, 20775 <at> debbugs.gnu.org,
 10471 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary=001a11c25cc6db8d0d0519b8177a
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 20775
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--001a11c25cc6db8d0d0519b8177a
Content-Type: text/plain; charset=UTF-8

Hello,

the bug was observed on Linux this time. Unfortunately I was hit with the
bug when backing up several large photo directories with hard-links to one
target directory on an external drive. So it was not obvious for me at
first, that something was going wrong.

From my point of view (without looking at the source) it should be easy to
repair by

- not attempting to create a hard-link from a file to itself
- not deleting a file that is about to be used as the source paramter of a
hard-link to be created.


best regards
  Steffen Zahn



On Tue, Jun 30, 2015 at 9:02 AM L. A. Walsh <coreutils@HIDDEN> wrote:

> I think you'll find this was reported 3 years ago..
>
>      "bug#10471: Severe or critical - deletes existing files and leaves
> nothing. (cp)"
> https://lists.gnu.org/archive/html/bug-coreutils/2015-04/msg00001.html
>
> Unfortunately it was closed it out w/the reason that  it was a
> "cygwin/windows-only"
> -- which I disagreed with.  I was told the cygwin dev would check it out
> and
> if it was in coreutils would move it back to active status (that was 3+
> years ago).
>
> On 6/8/2015 9:18 PM, Steffen Zahn wrote:
> > Hello,
> >
> > I found that the cp command acts "sub-optimal" when copying
> > hard-linked files of the same name from several directories to one
> > target directory, it first copies the files then removes them. I
> > cannot see how that can be the intended behaviour. Please fix this.
> >
> > best regards
> >      Steffen Zahn
> >
> > sz@gandalf:~ $ cd /tmp
> > sz@gandalf:/tmp $ mkdir 1 2 3
> > sz@gandalf:/tmp $ touch 1/a
> > sz@gandalf:/tmp $ ln 1/a 2/
> > sz@gandalf:/tmp $ ls -li 1 2
> > 1:
> > total 0
> > 262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
> >
> > 2:
> > total 0
> > 262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
> > sz@gandalf:/tmp $ cp -a -u --verbose 1/* 2/* 3/
> > '1/a' -> '3/a'
> > removed '3/a'
> > cp: cannot create hard link '3/a' to '3/a': No such file or directory
> > sz@gandalf:/tmp $ cp --version
> >
>
>

--001a11c25cc6db8d0d0519b8177a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>the bug was observed on Linux th=
is time. Unfortunately I was hit with the bug when backing up several large=
 photo directories with hard-links to one target directory on an external d=
rive. So it was not obvious for me at first, that something was going wrong=
.</div><div><br></div><div>From my point of view (without looking at the so=
urce) it should be easy to repair by=C2=A0</div><div><br></div><div>- not a=
ttempting to create a hard-link from a file to itself</div><div>- not delet=
ing a file that is about to be used as the source paramter of a hard-link t=
o be created.</div><div><br></div><div><br></div><div>best regards</div><di=
v>=C2=A0 Steffen Zahn</div><div><br></div><div><br></div></div><br><div cla=
ss=3D"gmail_quote"><div dir=3D"ltr">On Tue, Jun 30, 2015 at 9:02 AM L. A. W=
alsh &lt;<a href=3D"mailto:coreutils@HIDDEN">coreutils@HIDDEN</a>&gt;=
 wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex">I think you&#39;ll find thi=
s was reported 3 years ago..<br>
<br>
=C2=A0 =C2=A0 =C2=A0&quot;bug#10471: Severe or critical - deletes existing =
files and leaves<br>
nothing. (cp)&quot;<br>
<a href=3D"https://lists.gnu.org/archive/html/bug-coreutils/2015-04/msg0000=
1.html" rel=3D"noreferrer" target=3D"_blank">https://lists.gnu.org/archive/=
html/bug-coreutils/2015-04/msg00001.html</a><br>
<br>
Unfortunately it was closed it out w/the reason that=C2=A0 it was a<br>
&quot;cygwin/windows-only&quot;<br>
-- which I disagreed with.=C2=A0 I was told the cygwin dev would check it o=
ut and<br>
if it was in coreutils would move it back to active status (that was 3+<br>
years ago).<br>
<br>
On 6/8/2015 9:18 PM, Steffen Zahn wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I found that the cp command acts &quot;sub-optimal&quot; when copying<=
br>
&gt; hard-linked files of the same name from several directories to one<br>
&gt; target directory, it first copies the files then removes them. I<br>
&gt; cannot see how that can be the intended behaviour. Please fix this.<br=
>
&gt;<br>
&gt; best regards<br>
&gt;=C2=A0 =C2=A0 =C2=A0 Steffen Zahn<br>
&gt;<br>
&gt; sz@gandalf:~ $ cd /tmp<br>
&gt; sz@gandalf:/tmp $ mkdir 1 2 3<br>
&gt; sz@gandalf:/tmp $ touch 1/a<br>
&gt; sz@gandalf:/tmp $ ln 1/a 2/<br>
&gt; sz@gandalf:/tmp $ ls -li 1 2<br>
&gt; 1:<br>
&gt; total 0<br>
&gt; 262424 -rw-r--r-- 2 sz sz 0 Jun=C2=A0 9 06:10 a<br>
&gt;<br>
&gt; 2:<br>
&gt; total 0<br>
&gt; 262424 -rw-r--r-- 2 sz sz 0 Jun=C2=A0 9 06:10 a<br>
&gt; sz@gandalf:/tmp $ cp -a -u --verbose 1/* 2/* 3/<br>
&gt; &#39;1/a&#39; -&gt; &#39;3/a&#39;<br>
&gt; removed &#39;3/a&#39;<br>
&gt; cp: cannot create hard link &#39;3/a&#39; to &#39;3/a&#39;: No such fi=
le or directory<br>
&gt; sz@gandalf:/tmp $ cp --version<br>
&gt;<br>
<br>
</blockquote></div>

--001a11c25cc6db8d0d0519b8177a--




Information forwarded to bug-coreutils@HIDDEN:
bug#20775; Package coreutils. Full text available.

Message received at 20775 <at> debbugs.gnu.org:


Received: (at 20775) by debbugs.gnu.org; 30 Jun 2015 07:03:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 30 03:03:06 2015
Received: from localhost ([127.0.0.1]:33621 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Z9pZR-0001S0-K6
	for submit <at> debbugs.gnu.org; Tue, 30 Jun 2015 03:03:05 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:41114
 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>)
 id 1Z9pZH-0001R9-N6; Tue, 30 Jun 2015 03:02:56 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.hs.tlinx.org (8.14.9/8.14.4/SuSE Linux 0.8) with ESMTP id
 t5U72p2G013353; Tue, 30 Jun 2015 00:02:53 -0700
Message-ID: <55923F1B.8050307@HIDDEN>
Date: Tue, 30 Jun 2015 00:02:51 -0700
From: "L. A. Walsh" <coreutils@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64;
 rv:25.4) Gecko/20150524 FossaMail/25.1.5
MIME-Version: 1.0
To: Steffen Zahn <steffzahn@HIDDEN>, 20775 <at> debbugs.gnu.org,
 10471 <at> debbugs.gnu.org
Subject: Re: bug#20775: cp -a -u destroys files after they are copied
References: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>
In-Reply-To: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.6 (/)
X-Debbugs-Envelope-To: 20775
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.6 (/)

I think you'll find this was reported 3 years ago..

     "bug#10471: Severe or critical - deletes existing files and leaves 
nothing. (cp)"
https://lists.gnu.org/archive/html/bug-coreutils/2015-04/msg00001.html

Unfortunately it was closed it out w/the reason that  it was a 
"cygwin/windows-only"
-- which I disagreed with.  I was told the cygwin dev would check it out and
if it was in coreutils would move it back to active status (that was 3+ 
years ago).

On 6/8/2015 9:18 PM, Steffen Zahn wrote:
> Hello,
>
> I found that the cp command acts "sub-optimal" when copying 
> hard-linked files of the same name from several directories to one 
> target directory, it first copies the files then removes them. I 
> cannot see how that can be the intended behaviour. Please fix this.
>
> best regards
>      Steffen Zahn
>
> sz@gandalf:~ $ cd /tmp
> sz@gandalf:/tmp $ mkdir 1 2 3
> sz@gandalf:/tmp $ touch 1/a
> sz@gandalf:/tmp $ ln 1/a 2/
> sz@gandalf:/tmp $ ls -li 1 2
> 1:
> total 0
> 262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
>
> 2:
> total 0
> 262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
> sz@gandalf:/tmp $ cp -a -u --verbose 1/* 2/* 3/
> '1/a' -> '3/a'
> removed '3/a'
> cp: cannot create hard link '3/a' to '3/a': No such file or directory
> sz@gandalf:/tmp $ cp --version
>





Information forwarded to bug-coreutils@HIDDEN:
bug#20775; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jun 2015 04:34:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 09 00:34:44 2015
Received: from localhost ([127.0.0.1]:45607 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Z2BFL-0006uA-2W
	for submit <at> debbugs.gnu.org; Tue, 09 Jun 2015 00:34:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:58457)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2B05-0006Wg-Cz
 for submit <at> debbugs.gnu.org; Tue, 09 Jun 2015 00:18:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2Azz-00038I-3C
 for submit <at> debbugs.gnu.org; Tue, 09 Jun 2015 00:18:52 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37606)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2Azz-00038C-0U
 for submit <at> debbugs.gnu.org; Tue, 09 Jun 2015 00:18:51 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43728)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2Azx-0000LN-Mq
 for bug-coreutils@HIDDEN; Tue, 09 Jun 2015 00:18:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2Azw-00036x-Ee
 for bug-coreutils@HIDDEN; Tue, 09 Jun 2015 00:18:49 -0400
Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33904)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <steffzahn@HIDDEN>) id 1Z2Azw-00036N-0x
 for bug-coreutils@HIDDEN; Tue, 09 Jun 2015 00:18:48 -0400
Received: by lbcmx3 with SMTP id mx3so3535794lbc.1
 for <bug-coreutils@HIDDEN>; Mon, 08 Jun 2015 21:18:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:from:date:message-id:subject:to:content-type;
 bh=2yIOMa5Cg0pJtU2AFilVH9Wz68q+0ydBCfQbhJmFWgg=;
 b=fpcuDrmM6Zr0V+a1GA89gATizYMAV76pc7FY6kuE4lapefueE7blL6tu0uKFASfcat
 Ypkl7alPae6p8IOEWrx8BqH7ujdRxy811HHk+88xG9o3Oao3EohJTVgX72RXGeFmWONe
 bqT1p7IrHtX4dSR8YHfvj+bXRxskCe7/703AD49l5NArly+haFJN1UJ1nAJVFv2i4Fpd
 TZs6A5K0cakVMtUk/wBqe/lNInBA/tX2Z8miRhwJK/28xAg1PTOyoi+SBgZRkXYyV7+8
 EFqO1j+VtJ3GJdDX6NZubxoBFPJ7Q45X1Zr4gMvK2fF8g0yMowJjhYyrzNvlx5S/RvEU
 FpEA==
X-Received: by 10.112.163.101 with SMTP id yh5mr12385203lbb.25.1433823526356; 
 Mon, 08 Jun 2015 21:18:46 -0700 (PDT)
MIME-Version: 1.0
From: Steffen Zahn <steffzahn@HIDDEN>
Date: Tue, 09 Jun 2015 04:18:34 +0000
Message-ID: <CAHt12b_UNniMq47p58pwm0PXUrAtLT3AL5juSgLMK24OxpEBaA@HIDDEN>
Subject: cp -a -u destroys files after they are copied
To: bug-coreutils@HIDDEN
Content-Type: multipart/alternative; boundary=089e0118366ef58ee005180e0d6f
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 09 Jun 2015 00:34:41 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

--089e0118366ef58ee005180e0d6f
Content-Type: text/plain; charset=UTF-8

Hello,

I found that the cp command acts "sub-optimal" when copying hard-linked
files of the same name from several directories to one target directory, it
first copies the files then removes them. I cannot see how that can be the
intended behaviour. Please fix this.

best regards
     Steffen Zahn

sz@gandalf:~ $ cd /tmp
sz@gandalf:/tmp $ mkdir 1 2 3
sz@gandalf:/tmp $ touch 1/a
sz@gandalf:/tmp $ ln 1/a 2/
sz@gandalf:/tmp $ ls -li 1 2
1:
total 0
262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a

2:
total 0
262424 -rw-r--r-- 2 sz sz 0 Jun  9 06:10 a
sz@gandalf:/tmp $ cp -a -u --verbose 1/* 2/* 3/
'1/a' -> '3/a'
removed '3/a'
cp: cannot create hard link '3/a' to '3/a': No such file or directory
sz@gandalf:/tmp $ cp --version
cp (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
sz@gandalf:/tmp $ ls -la 3/
total 8
drwxr-xr-x  2 sz   sz   4096 Jun  9 06:11 .
drwxrwxrwt 13 root root 4096 Jun  9 06:11 ..
sz@gandalf:/tmp $ uname -a
Linux gandalf 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux

--089e0118366ef58ee005180e0d6f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><font color=3D"#000000" face=3D"Times New Roman" size=
=3D"3"><span style=3D"line-height:normal">Hello,</span></font></div><div><f=
ont color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"li=
ne-height:normal"><br></span></font></div><div>I found that the cp command =
acts &quot;sub-optimal&quot; when copying hard-linked files of the same nam=
e from several directories to one target directory, it first copies the fil=
es then removes them. I cannot see how that can be the intended behaviour. =
Please fix this.</div><div><br></div><div>best regards</div><div>=C2=A0 =C2=
=A0 =C2=A0Steffen Zahn</div><div><font color=3D"#000000" face=3D"Times New =
Roman" size=3D"3"><span style=3D"line-height:normal"><br></span></font></di=
v><div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span st=
yle=3D"line-height:normal">sz@gandalf:~ $ cd /tmp</span></font></div><div><=
font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"l=
ine-height:normal">sz@gandalf:/tmp $ mkdir 1 2 3</span></font></div><div><f=
ont color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"li=
ne-height:normal">sz@gandalf:/tmp $ touch 1/a</span></font></div><div><font=
 color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-=
height:normal">sz@gandalf:/tmp $ ln 1/a 2/</span></font></div><div><font co=
lor=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-hei=
ght:normal">sz@gandalf:/tmp $ ls -li 1 2</span></font></div><div><font colo=
r=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-heigh=
t:normal">1:</span></font></div><div><font color=3D"#000000" face=3D"Times =
New Roman" size=3D"3"><span style=3D"line-height:normal">total 0</span></fo=
nt></div><div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><=
span style=3D"line-height:normal">262424 -rw-r--r-- 2 sz sz 0 Jun =C2=A09 0=
6:10 a</span></font></div><div><font color=3D"#000000" face=3D"Times New Ro=
man" size=3D"3"><span style=3D"line-height:normal"><br></span></font></div>=
<div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span styl=
e=3D"line-height:normal">2:</span></font></div><div><font color=3D"#000000"=
 face=3D"Times New Roman" size=3D"3"><span style=3D"line-height:normal">tot=
al 0</span></font></div><div><font color=3D"#000000" face=3D"Times New Roma=
n" size=3D"3"><span style=3D"line-height:normal">262424 -rw-r--r-- 2 sz sz =
0 Jun =C2=A09 06:10 a</span></font></div><div><font color=3D"#000000" face=
=3D"Times New Roman" size=3D"3"><span style=3D"line-height:normal">sz@ganda=
lf:/tmp $ cp -a -u --verbose 1/* 2/* 3/</span></font></div><div><font color=
=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-height=
:normal">&#39;1/a&#39; -&gt; &#39;3/a&#39;</span></font></div><div><font co=
lor=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-hei=
ght:normal">removed &#39;3/a&#39;</span></font></div><div><font color=3D"#0=
00000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-height:norma=
l">cp: cannot create hard link &#39;3/a&#39; to &#39;3/a&#39;: No such file=
 or directory</span></font></div><div><font color=3D"#000000" face=3D"Times=
 New Roman" size=3D"3"><span style=3D"line-height:normal">sz@gandalf:/tmp $=
 cp --version</span></font></div><div><font color=3D"#000000" face=3D"Times=
 New Roman" size=3D"3"><span style=3D"line-height:normal">cp (GNU coreutils=
) 8.21</span></font></div><div><font color=3D"#000000" face=3D"Times New Ro=
man" size=3D"3"><span style=3D"line-height:normal">Copyright (C) 2013 Free =
Software Foundation, Inc.</span></font></div><div><font color=3D"#000000" f=
ace=3D"Times New Roman" size=3D"3"><span style=3D"line-height:normal">Licen=
se GPLv3+: GNU GPL version 3 or later &lt;<a href=3D"http://gnu.org/license=
s/gpl.html">http://gnu.org/licenses/gpl.html</a>&gt;.</span></font></div><d=
iv><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=
=3D"line-height:normal">This is free software: you are free to change and r=
edistribute it.</span></font></div><div><font color=3D"#000000" face=3D"Tim=
es New Roman" size=3D"3"><span style=3D"line-height:normal">There is NO WAR=
RANTY, to the extent permitted by law.</span></font></div><div><font color=
=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-height=
:normal"><br></span></font></div><div><font color=3D"#000000" face=3D"Times=
 New Roman" size=3D"3"><span style=3D"line-height:normal">Written by Torbjo=
rn Granlund, David MacKenzie, and Jim Meyering.</span></font></div><div><fo=
nt color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"lin=
e-height:normal">sz@gandalf:/tmp $ ls -la 3/</span></font></div><div><font =
color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span style=3D"line-h=
eight:normal">total 8</span></font></div><div><font color=3D"#000000" face=
=3D"Times New Roman" size=3D"3"><span style=3D"line-height:normal">drwxr-xr=
-x =C2=A02 sz =C2=A0 sz =C2=A0 4096 Jun =C2=A09 06:11 .</span></font></div>=
<div><font color=3D"#000000" face=3D"Times New Roman" size=3D"3"><span styl=
e=3D"line-height:normal">drwxrwxrwt 13 root root 4096 Jun =C2=A09 06:11 ..<=
/span></font></div><div>sz@gandalf:/tmp $ uname -a<br></div><div><div>Linux=
 gandalf 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_6=
4 x86_64 x86_64 GNU/Linux</div></div><div><br></div></div>

--089e0118366ef58ee005180e0d6f--




Acknowledgement sent to Steffen Zahn <steffzahn@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#20775; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 11 Jan 2019 09:00:02 UTC

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