GNU bug report logs - #15738
cp: "cp -a A B" doesn't reliably create 'B' as copy of A

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; Reported by: Linda Walsh <coreutils@HIDDEN>; dated Sun, 27 Oct 2013 19:25:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'cp: "cp -a A B" doesn't reliably create 'B' as copy of A' from 'Inconsistency & bug cp -a A B doesn't reliably create 'B' as a copy of 'A' even w/--remove-destination' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 27 Oct 2013 19:24:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 27 15:24:24 2013
Received: from localhost ([127.0.0.1]:47720 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VaVwm-00025p-1W
	for submit <at> debbugs.gnu.org; Sun, 27 Oct 2013 15:24:24 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57173)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwg-00025U-V7
 for submit <at> debbugs.gnu.org; Sun, 27 Oct 2013 15:24:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwT-0001C3-8G
 for submit <at> debbugs.gnu.org; Sun, 27 Oct 2013 15:24:13 -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 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:43027)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwT-0001Bz-53
 for submit <at> debbugs.gnu.org; Sun, 27 Oct 2013 15:24:05 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58887)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwM-00073H-Q2
 for bug-coreutils@HIDDEN; Sun, 27 Oct 2013 15:24:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwG-00011N-QX
 for bug-coreutils@HIDDEN; Sun, 27 Oct 2013 15:23:58 -0400
Received: from ishtar.tlinx.org ([173.164.175.65]:38986)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <coreutils@HIDDEN>) id 1VaVwG-00011F-GQ
 for bug-coreutils@HIDDEN; Sun, 27 Oct 2013 15:23:52 -0400
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 r9RJNmaE055007
 for <bug-coreutils@HIDDEN>; Sun, 27 Oct 2013 12:23:50 -0700
Message-ID: <526D6844.8020201@HIDDEN>
Date: Sun, 27 Oct 2013 12:23:48 -0700
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: Inconsistency & bug cp -a A B doesn't reliably create 'B' as a copy
 of 'A' even w/--remove-destination
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no
 timestamps) [generic]
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: -5.0 (-----)
X-Debbugs-Envelope-To: submit
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: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://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: <http://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: -5.0 (-----)

with "--remove-destination", I think this a bug.  W/o it, it is
inconsistent with the requirement not to use "dirname/." to refer to
contents in 'rm'.

details:
	mkdir a
	touch a/file
	mkdir a/dir
	cp -a a b	#'ok'
	touch a/file2

now:
	cp -au a b	
(or)
	cp -a a b

Either form creates another complete copy of 'a' in directory 'b'.
(Note, this is historical behavior).

FWIW,
      cp -a a/ b/
behaves the same way.

However,
	cp -a a/. b/.
fails the 1st time, but not if 'b' is already created (by using a form
from above).

Technically, though, the above should fail, as it says
says to copy the dir-entry for '.' over the dot entry
in 'b'.

While using '.' as a shorthand for contents of a dir has been
normal, it no longer works in utils like 'rm'.

---!!!---

*More troublesome* is that:

	cp -a --remove-destination a b

doesn't work, but duplicates the behaviors of the above.

If 'b' is removed *before* the copy, as is documented,
then it should be no different than the case where 'a' is
copied to a non-existent 'b'.






Acknowledgement sent to Linda Walsh <coreutils@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#15738; 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: Mon, 25 Nov 2019 12:00:02 UTC

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