Roland Koebler
2009-Oct-03 10:59 UTC
--keep-dirlinks --delete erroneously deletes symlinks to directories
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
Matt McCutchen
2009-Oct-05 06:27 UTC
--keep-dirlinks --delete erroneously deletes symlinks to directories
On Sat, 2009-10-03 at 12:59 +0200, Roland Koebler wrote:> 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?It looks like a bug. I can reproduce it with rsync 3.0.3 but not with 3.0.6. Please upgrade. -- Matt