On Fri, Oct 19, 2007 at 09:19:21AM -0400, Nick Guenther wrote:
> On 10/19/07, Tom Van Looy <[EMAIL PROTECTED]> wrote:
> > Richard Toohey wrote:
> > > On 19/10/2007, at 8:12 PM, Raimo Niskanen wrote:
> > >
> > > Looks like OpenBSD, FreeBSD, and Mac OS X BSD bits have the same
> > > sort of outcome.
> > >
> > > Copy foo to foo only once and quit, I think that's the correct
> > > behaviour. I even think that posix more or less describes that.
> > >
> > > That's what it should be doing I guess. But it's tricky, if you start
> > > doing symlinks etc, you'll end up looping sooner or later. What if the
> > > directoy's are not named the same (eg: hard links)?
> > >
> > correction: hard links are not allowed on directory's, ...
> > that being said, comparing inodes seems the best solution
> >
> > only, don't give an error but copy once
> > maybe if I have time this weekend I'll try code that behaviour
> >
> > Anyway, it has worked like that since years, and I guess nobody has had
> > a problem with it before. I don't think it should be changed just
> > because some bored guy playing with it noticed strange output ;-p
> 
> Sure, but "bored guy" can translate to "new ideas" and testing
> somehow-still-untested code paths. It's worth a shot at fixing.

For what its worth, all I can offer is moral support since I don't code
C.  

Conceptually, though, why can't cp look at the source directory and take a
snapshot, a to-do-list, of everything it has to copy, then do it?  That
way, any recursion would be completed before the target directory
appeared in the source directory.  With only an -R (no -H -L or -P), it
should copy links as links which should avoid loops.

How do scp and rsync do it?

Doug.

Reply via email to