This is a bug, right? (--link-dest)

Randall Cotton recotton at earthlink.net
Mon Apr 5 20:19:41 MDT 2010


----- Original Message ----- 
From: "Matt McCutchen" <matt at mattmccutchen.net>
To: "Randall Cotton" <recotton at earthlink.net>
Cc: <rsync at lists.samba.org>
Sent: Monday, April 05, 2010 4:47 PM
Subject: Re: This is a bug, right? (--link-dest)


: On Mon, 2010-04-05 at 16:38 -0500, Randall Cotton wrote:
: > ----- Original Message ----- 
: > From: "Matt McCutchen" <matt at mattmccutchen.net>
: > To: "Randall Cotton" <recotton at earthlink.net>
: > Cc: <rsync at lists.samba.org>
: > Sent: Monday, April 05, 2010 4:16 PM
: > Subject: Re: This is a bug, right? (--link-dest)
: >
: >
: > : On Mon, 2010-04-05 at 13:57 -0500, Randall Cotton wrote:
: > : > This works as expected (a hard link is made)
: > :
: > : > rsync -a --link-dest=../a.1 a/ b/a
: > :
: > : > This does not (a copy is made instead of a hard link)
: > :
: > : > rsync -a --link-dest=a.1 a b
: > :

[...]

: The problem is that in the second command, the "a" path component is
: included in file-list paths.  Hence, rsync will look for the basis file
: for b/a/tmp at b/a.1/a/tmp instead of b/a.1/tmp .

Ah, I think I get it now, but let me try to explain it another way and you
can corroborate (or correct):

For reference, once again, here are the two sets of rsync commands:

(hard links of directory hierarchy "a" made successfully with this:)
rsync -a a/ b/a.1
rsync -a --link-dest=../a.1 a/ b/a

(Copies, not hard links, made with this:)
rsync -a a/ b/a.1
rsync -a --link-dest=a.1 a b

The first --link-dest command worked because the source was "a/", which
stands for "the stuff contained by directory a" (as opposed to just "a",
which stands for the entire directory hierarchy rooted at and including
"a"). I specified --link-dest=../a.1 (which maps to b/a/../a.1 = b/a.1,
since the --link-dest setting is understood to be relative to the
destination) and that does indeed hold a basis for the source (again, the
stuff contained by "a", which was deposited by the preceding rsync
command). So a hard link was made.

With the second --link-dest command, though, the source was "a" (again,
the entire directory hierarchy rooted at and including "a"). And
the --link-dest must always hold a basis for the source. However, I
specified a --link-dest that maps out to the same place as before (b/a.1)
which holds exactly the same thing it held before (the stuff *contained*
by a). That is, in the second --link-dest command, the --link-dest
directory needed to hold a basis for the actual source ("a" - the entire
directory hierarchy rooted and including "a"), but instead was still
holding a basis for "a/" (the stuff *contained* by a). So rsync couldn't
match up a basis and a copy was made instead of a hard link.

The --link-dest directory at least *existed*, though, so there was no
error message. It's just that I didn't point rsync to an
appropriate --link-dest basis for the source ("a") in that
second --link-dest command.

Right?
R



More information about the rsync mailing list