--keep-dirlinks --delete erroneously deletes symlinks to directories

Roland Koebler r.koebler at yahoo.de
Sat Oct 3 04:59:59 MDT 2009


Hi,

the combination of --keep-dirlinks and --delete (--delete-during,
--delete-delay) erroneously deletes symlinks to directories on
the receiver.
With --delete-before and --delete-after it works as expected.

(rsync  version 3.0.3  protocol version, on Debian Lenny)

I don't think that this behaviour is intended.


Details/example:

- Host 1 directory-structure:
    drwx------ ./1
    -rwx------ ./1/file
    drwx------ ./1/dir
    -rwx------ ./1/dir/subfile

- Host 2 directory-structure:
    drwx------ ./2
    -rwx------ ./2/file
    lrwxrwxrwx ./2/dir -> ../foo
    drwx------ ./foo
    -rwx------ ./foo/subfile

- the data on both hosts is the same, so rsync shouldn't do anything
- mirroring Host 1 -> Host 2 correctly does nothing:
    $ rsync -av --keep-dirlinks 1/ 2/
    sending incremental file list

    sent 94 bytes  received 13 bytes  214.00 bytes/sec
    total size is 0  speedup is 0.00

- mirroring Host 2 -> Host 1 correctly does nothing:
    $ rsync -av --copy-dirlinks 2/ 1/
    sending incremental file list

    sent 94 bytes  received 13 bytes  214.00 bytes/sec
    total size is 0  speedup is 0.00

- --delete-after works correctly, and does nothing:
    $ rsync -av --keep-dirlinks --delete-after 1/ 2/
    building file list ... done

    sent 89 bytes  received 12 bytes  202.00 bytes/sec
    total size is 0  speedup is 0.00

- --delete-before works correctly, and does nothing:
    $ rsync -av --keep-dirlinks --delete-before 1/ 2/
    building file list ... done

    sent 89 bytes  received 12 bytes  202.00 bytes/sec
    total size is 0  speedup is 0.00

- but --delete (or --delete-during / --delete-delay) erroneously deltes the
  "dir -> ../foo"-symlink (and copies the data afterwards):
    $ rsync -av --keep-dirlinks --delete 1/ 2/
    sending incremental file list
    deleting dir
    dir/
    dir/subfile

    sent 136 bytes  received 35 bytes  342.00 bytes/sec
    total size is 0  speedup is 0.00

Is this a bug, or did I miss something?


thanks,
Roland



More information about the rsync mailing list