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

Matt McCutchen matt at mattmccutchen.net
Fri Feb 1 01:36:26 GMT 2008


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.

Matt



More information about the rsync mailing list