Hi,

following the instructions on 
https://bugzilla.samba.org/createaccount-save.html, I've applied for a bugzilla 
account at  bugzilla-maintena...@samba.org but didn't receive a reply, so I 
report through this list.

With --link-dest the search for a candidate to link from, follows symlinks in 
directory path components, when the path element is a directory in the source 
tree but a symlink in the --link-dest tree. This may trigger unwanted side 
effects (e.g. automounter mounts). Moreover, the target candidate found might 
not be suitable for a hard link, because it may be on another file system. For 
regular files, rsync tried so fals back to copy, which might be unwanted (e.g. 
going over nfs). For non-regular files, rsync will create the destination file, 
but report an error and exit with a non-zero exit status.

This is a program to demonstrate the bug (requires root for the mount):

    #! /bin/sh
    set -x
    if [ -d /tmp/rsync_bug ]; then
        umount /tmp/rsync_bug/mnt
        rm -rf /tmp/rsync_bug
    fi
    mkdir /tmp/rsync_bug
    cd /tmp/rsync_bug
    mkdir mnt
    mount -t tmpfs tmpfs mnt
    ln -s BLABLA mnt/test
    mkdir src
    ln -s /tmp/rsync_bug/mnt src/dir
    rsync -aHx --delete --numeric-ids  src/  dst1
    rm src/dir
    mkdir src/dir
    cp -a mnt/test src/dir/
    rsync -aHx --delete --numeric-ids --link-dest /tmp/rsync_bug/dst1  src/  
dst2 || echo RSYNC FAIL

Output for me:

    buczek@theinternet:~$ sudo ./rsync-bug.sh
    + '[' -d /tmp/rsync_bug ']'
    + umount /tmp/rsync_bug/mnt
    + rm -rf /tmp/rsync_bug
    + mkdir /tmp/rsync_bug
    + cd /tmp/rsync_bug
    + mkdir mnt
    + mount -t tmpfs tmpfs mnt
    + ln -s BLABLA mnt/test
    + mkdir src
    + ln -s /tmp/rsync_bug/mnt src/dir
    + rsync -aHx --delete --numeric-ids src/ dst1
    + rm src/dir
    + mkdir src/dir
    + cp -a mnt/test src/dir/
    + rsync -aHx --delete --numeric-ids --link-dest /tmp/rsync_bug/dst1 src/ 
dst2
    rsync: failed to hard-link /tmp/rsync_bug/dst1/dir/test with dir/test: 
Invalid cross-device link (18)
    rsync error: some files/attrs were not transferred (see previous errors) 
(code 23) at main.c(1210) [sender=3.1.4dev]
    + echo RSYNC FAIL
    RSYNC FAIL
    buczek@theinternet:~$

The second rsync fails, because src/dir is a link to another filesystem in the 
--link-dest tree but a directory in the new src and src/dir/test is a 
non-regular file.

Happens with 3.0.9 and with the current git master version.

We've seen our rsync based backup triggering automounts on the backup server or 
fail from time to time, because of the above problem. Users sometimes move 
directories somewhere else and create a symlink to the new destination in the 
old place or visa versa. So with incremental backups you do have real files one 
day and a symlink to the same tree another day.


Donald
--
Donald Buczek
buc...@molgen.mpg.de
Tel: +49 30 8413 1433

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to