I've been following bug 0001412 ("cp -a allows copy of a directory into self"), 
and was wondering if anyone on the list could shed light on what problems were 
introduced by Chris Larson's r8517 that led Erik Andersen to revert it in 
r8547. In a list message
(http://www.busybox.net/lists/busybox/2004-February/010884.html)
andersen indicated that the change caused many problems, but didn't specify 
what they were.

The test case:

% busybox-cp [ -R | -a ] sub sub 

Results in a repeatedly created subdirectory hierarchy until getcwd(2) runs out 
of space, too many files are open, etc. This behavior is identical to cp in 
FreeBSD 6.2 (likely earlier and later as well).

% coreutils-cp [-R | -a ] sub sub

Results in the message:
"cannot copy a directory `sub' into itself `sub/sub' "

The directory 'sub/sub' was created, but no 'sub/sub/sub/sub' ...

I think this behavior is more desirible. I'll be the first to agree that the 
coreutils logic is non-trivial (I've been walking both sets of code for a 
couple of days now). coreutils cp seems to prevent:

% cp dir dir
% cp dir dir/sub/dir
% cp dir (link->dir)

r8517 patch also seems to prevent the same things. In my testing, I haven't
encountered any problems yet; so I'm hoping someone could point out at
least one problem with the r8517 patch.



Thanks for your time.



      
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the 
Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to