DO NOT REPLY [Bug 3693] New: rsync can use same --link-dest file several times, leading to incorrect hard links

samba-bugs at samba.org samba-bugs at samba.org
Mon Apr 17 16:26:47 GMT 2006


https://bugzilla.samba.org/show_bug.cgi?id=3693

           Summary: rsync can use same --link-dest file several times,
                    leading to incorrect hard links
           Product: rsync
           Version: 2.6.8
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: hashproduct at verizon.net
         QAContact: rsync-qa at samba.org


Run the following in an empty directory:
    mkdir src dest linkdest
    touch src/f1
    rsync -a src/f1 src/f2
    touch linkdest/f1
    ln linkdest/f1 linkdest/f2
    rsync -Ha src/ dest/ --link-dest=../linkdest/

The source files src/f1 and src/f2 are both identical to the single link-dest
file that has the names linkdest/f1 and linkdest/f2.  Rsync links linkdest/f1
instead of copying src/f1 and links linkdest/f2 instead of copying src/f2.  Now
dest/f1 and dest/f2 refer to the same file while src/f1 and src/f2 refer to
different files.

I believe that, when -H is specified, two destination dentries should refer to
the same file if and only if the corresponding source dentries do, even though
there may be hard links outside the transfer to both source files and (because
of --link-dest destination files.  Thus, rsync should guard against linking to
the same --link-dest file several times.  When rsync links to a --link-dest
file, it should check whether a file with the same device and inode numbers has
already been used; if so, rsync should copy the file into the destination
instead of linking it.  When -H is not specified, I reason that the user
doesn't care about hard links and this check is unnecessary.

The remark at the end of comment 1 of bug 3692 led me to discover this bug. 
(Let's see if Bugzilla correctly hyperlinks that reference.)


-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list