--delete option does not always work

Mario 'BitKoenig' Holbe Mario.Holbe at TU-Ilmenau.DE
Sat Sep 9 19:00:10 GMT 2006


Wayne Davison <wayned at samba.org> wrote:
> OK, I had a free moment to work up a fix, and here it is.  It was
> pretty simple.

I'm sorry to wake this up again, but it seems not to be so simple to
fix at all :)
I've stumbled over this while noticing that the rsnapshot backup of my
root-filesystem simply never gets anything removed at all. So I made
some tests:

root at darkside:~# rsync --version | head -1
rsync  version 2.6.8  protocol version 29
root at darkside:~# rsync -HSaxvn --delete --relative / /mnt/rsnapshot/daily.0/darkside/root | grep -c ^deleting
root at darkside:~# rsync -HSaxvn --delete / /mnt/rsnapshot/daily.0/darkside/root | grep -c ^deleting
root at darkside:~# cd /
root at darkside:/# rsync -HSaxvn --delete --relative . /mnt/rsnapshot/daily.0/darkside/root | grep -c ^deleting
root at darkside:~# rsync -HSaxvn --delete --relative /. /mnt/rsnapshot/daily.0/darkside/root | grep -c ^deleting

As you can see, the only workaround that seems to work is cd / and
using . then.
However, this is not always possible, i.e. when rsyncing some.host:/
Of course, it would be simple to just avoid the --relative in this
special case. But this is also not always possible, i.e. when using
rsnapshot (:)) or - more serious - when rsyncing multiple sources at
once like rsync -HSaxvn --delete --relative / /home /target

Perhaps, a possible solution could be to temporarily disable --relative
in the rsync code directly as long as it works on a /
Though, I'm not absolutely sure about the side-effects of this (i.e.
with include/exclude lists).

I'm using Debians rsync 2.6.8-2 which should have Waynes patch
included. At least Lennys test-case in the beginning of this thread
is not reproducible with this version.

As a rule, the more bizarre a thing is, the less mysterious it proves to be.
                                    -- Sherlock Holmes by Arthur Conan Doyle

More information about the rsync mailing list