Bug 2024 - --delete erase files on receiving side that EXIST on sending side
--delete erase files on receiving side that EXIST on sending side
Product: rsync
Classification: Unclassified
Component: core
All Linux
: P3 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2004-11-11 14:03 UTC by Claudio Nevs
Modified: 2005-03-16 16:48 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Claudio Nevs 2004-11-11 14:03:12 UTC

According to rsync documentation:
              This  tells rsync to delete any files on the receiving side that
              arenât on the sending  side.    Files  that  are  excluded  from
              transfer   are  excluded  from  being  deleted  unless  you  use

If I run rsync in daemon mode, and use a configuration file, files excluded in
the configuration file are correctly excluded from transfer, but they ARE
DELETED on receiving side.


I have these files:

# ls -1 src/

# ls -1 dest/

#cat rsyncd.conf
pid file = /var/run/rsyncd.pid
use chroot=false

exclude=- *.no + *.yes - *

server command line:
#rsync --daemon --no-detach --config=./rsyncd.conf

client command line (1):
#rsync -n -avz --delete dest

client command line (2) - works as expected:
#rsync -n -avz --delete --exclude='*.no' dest

When I run (1), I have the following output:

# rsync -n -avz --delete dest
receiving file list ... done
deleting copy.no

wrote 78 bytes  read 120 bytes  396.00 bytes/sec
total size is 0  speedup is 0.00

When I run (2), I get this:

# rsync -n -avz --delete --exclude='*.no' dest
receiving file list ... done

wrote 86 bytes  read 120 bytes  412.00 bytes/sec
total size is 0  speedup is 0.00

Conclusion: Probably when files are excluded in a configuration, these are
really not counted as excluded files for the --delete option, so even if they
are excluded in configuration file, they will be deleted if --delete is used.

Versions affected: at least 2.5.7 and 2.6.2

For being able to better test this bug, you can download this tar.gz file:

This problem was discovered using ssh with a remote host, but I simplified the
example to make it easier to reproduce the problem.

If any additional info is needed, please contact me.

Claudio Neves

Claudio Neves - System Administrator
Next Internet Solutions - Sao Paulo/Brazil
Phone: +55-11-5579-6966
Comment 1 Wayne Davison 2004-11-11 15:25:25 UTC
Files excluded in the daemon config file do not exist as far as the client is
concerned.  Please refer to the rsyncd.conf manpage:

"Because this exclude list is not passed to the client it only applies on the 
server: that is, it excludes files received by a client when receiving from a
server and files deleted on a server when sending to a server, but it doesn't
exclude files from being deleted on a client when receiving from a server."

If there are files you wish to exclude from deletion on the client, you must
specify them via the command-line.