rsync-ing from two locations with same filenames (at different versions)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Fri Feb 1 08:46:41 GMT 2008


On Feb 1, 2008 2:36 AM, Matt McCutchen wrote:
> On Fri, 2008-02-01 at 02:06 +0100, Mojca Miklavec wrote:
> > I don't know. Somtimes it works and sometimes not (but mostly not as a
> > rule of thumb). Even if I wait for a few minutes inbetween, the new
> > file won't be chosen.
> >
> > > rsync --version
> > rsync  version 2.6.3  protocol version 28
> >
> > That might be old, but that was the default that came with fink on Mac
> > OS X (if the error has been fixed in the meantime, I will upgrade).
>
> Duh.  I realize now that it's perfectly reasonable for you to be able to
> reproduce the problem while I can't.  Versions 2.6.9 and earlier of
> rsync sort the file-list using the C library's quicksort, an unstable
> sort, so the results in case of duplicate files are highly sensitive to
> both the C library implementation and the order of directory entries in
> the source (which in turn is sensitive to the filesystem
> implementation).  You probably have both a different C library and a
> different filesystem than I do.
>
> In any case, since rsync 3.0.0pre1, the default file-list sorting
> algorithm is a mergesort, which is stable, so files from earlier source
> arguments take priority.  If you upgrade to an rsync 3.0.0pre* version,
> your scenario should work consistently.  If it doesn't, that's a bug we
> should try to fix.

Oh, thanks a lot for the explanation :)
I will try to figure out how to build it and test then.

In this particular case it is not needed, but what about a switch:
    --always-take-the-latest-file-version-no-matter-of-order-of-supplied-arguments
?

Two problems still remain then: one is that I cannot rely on the fact
that users will have the latest version (at least for a while, but
that argument will disapear with time), and the other one - it would
simplify the work a lot if I didn't have to reproduce a bunch of empty
folders in "new" (for which you have said: "I agree that this feature
is useful, and I might implement it at some point as a patch.")

But thanks a lot for the explanation. You just gave me a really nice
idea for a real-life task for the forthcomming informatics competition
here :)

Mojca


More information about the rsync mailing list