--delete option does not always work

Lenny rsyncmailinglist at pizzaman.dyndns.org
Wed Apr 27 16:57:51 GMT 2005


I know that there are a million messages from newbies who cannot get
--delete to work.  This message is special.  :)

--delete works fine for me EXCEPT when the following two conditions are
present:
1) I am using the --relative option, and
2) the deleted file is in a subdirectory of the SRC directory.

Here is a demonstration of how to recreate this bug:
lenny at mythtv:/tmp$ rsync --version
rsync  version 2.6.4  protocol version 29
Copyright (C) 1996-2005 by Andrew Tridgell and others
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
lenny at mythtv:/tmp$ mkdir -p src/1
lenny at mythtv:/tmp$ cd src/1
lenny at mythtv:/tmp/src/1$ touch a b c
lenny at mythtv:/tmp/src/1$ cd /tmp
lenny at mythtv:/tmp$ /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded -v src/ dest/
building file list ... done
created directory dest
src/
src/1/
src/1/a
src/1/b
src/1/c

sent 235 bytes  received 98 bytes  666.00 bytes/sec
total size is 0  speedup is 0.00
lenny at mythtv:/tmp$ rm src/1/c
lenny at mythtv:/tmp$ /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded -v src/ dest/
building file list ... done
src/1/

sent 99 bytes  received 26 bytes  250.00 bytes/sec
total size is 0  speedup is 0.00



Now at this point we would expect there to be only files 'a' and 'b' to
be present in /tmp/dest/src/1.  However you can see that all three files
are in that directory:
lenny at mythtv:/tmp$ ls -lR dest
dest:
total 1
drwxr-xr-x  3 lenny lenny 1024 Apr 27 12:37 src

dest/src:
total 1
drwxr-xr-x  2 lenny lenny 1024 Apr 27 12:38 1

dest/src/1:
total 0
-rw-r--r--  1 lenny lenny 0 Apr 27 12:37 a
-rw-r--r--  1 lenny lenny 0 Apr 27 12:37 b
-rw-r--r--  1 lenny lenny 0 Apr 27 12:37 c





Just so you know, if you attempt to do this by placing files 'a','b',
and 'c' just under the 'src' directory (without the '1' subdirectory), 
the --delete option will work correctly.

Any thoughts?

Thanks,
Lenny


More information about the rsync mailing list