bug-coreutils
[Top][All Lists]
Advanced

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

Re: Bad cp -a behaviour


From: Tim Waugh
Subject: Re: Bad cp -a behaviour
Date: Tue, 10 Aug 2004 13:21:14 +0100
User-agent: Mutt/1.4.1i

On Sat, Aug 07, 2004 at 10:30:14AM +0100, Philip Rowlands wrote:

> On Tue, 3 Aug 2004, Tim Waugh wrote:
> 
> >When using 'cp -a' to copy a directory structure, it has some
> >unexpected behaviour.  See the attached Makefile, which compares the
> >behaviour between tar, cpio, and cp.
> 
> I might be missing something here; I can't reproduce this with a recent
> cp (from FC2):
> 
> $ cp --version
> cp (coreutils) 5.2.1
> $ make -s cp
> $
> 
> The source and dest appear identical, and strace shows cp unlinking
> "1/d/2" and "1/d/3" as it goes.

How odd.  Is that a patched 5.2.1?  Here's what I get with unpatched
5.2.1, straight from the tarball:

address@hidden ~/coreutils-5.2.1/src]$ ./cp --version
cp (coreutils) 5.2.1
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
address@hidden ~/coreutils-5.2.1/src]$ rm -fr 1 2
address@hidden ~/coreutils-5.2.1/src]$ mkdir -p 1/d 2/d
address@hidden ~/coreutils-5.2.1/src]$ echo foo > 1/d/1
address@hidden ~/coreutils-5.2.1/src]$ ln 1/d/1 1/d/2
address@hidden ~/coreutils-5.2.1/src]$ ln 1/d/1 1/d/3
address@hidden ~/coreutils-5.2.1/src]$ echo foo > 2/d/1
address@hidden ~/coreutils-5.2.1/src]$ echo bar > 2/d/2
address@hidden ~/coreutils-5.2.1/src]$ ln 2/d/2 2/d/3
address@hidden ~/coreutils-5.2.1/src]$ ln 2/d/2 2/d/4
address@hidden ~/coreutils-5.2.1/src]$ ./cp -af 2/d 1
address@hidden ~/coreutils-5.2.1/src]$ diff -upr 2 1
diff -upr 2/d/1 1/d/1
--- 2/d/1       2004-08-10 13:19:02.695163241 +0100
+++ 1/d/1       2004-08-10 13:19:02.703161000 +0100
@@ -1 +1 @@
-foo
+bar

Tim.
*/

Attachment: pgpYtM9eYv5Iu.pgp
Description: PGP signature


reply via email to

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