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

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Sun, 27 Oct 2013 19:25:02 UTC

Severity: normal

To reply to this bug, email your comments to 15738 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#15738; Package coreutils. (Sun, 27 Oct 2013 19:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Linda Walsh <coreutils <at> tlinx.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 27 Oct 2013 19:25:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Linda Walsh <coreutils <at> tlinx.org>
To: bug-coreutils <at> gnu.org
Subject: Inconsistency & bug cp -a A B doesn't reliably create 'B' as a copy
 of 'A' even w/--remove-destination
Date: Sun, 27 Oct 2013 12:23:48 -0700
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'.






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 <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 11 Jan 2019 09:07:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 157 days ago.

Previous Next


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