Bug 4786 - dry-run reports extraneous deleted files when destination directory doesn't exist
dry-run reports extraneous deleted files when destination directory doesn't e...
Status: CLOSED FIXED
Product: rsync
Classification: Unclassified
Component: core
3.0.0
Other Linux
: P3 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-13 19:05 UTC by Jack Bates
Modified: 2008-07-26 10:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Bates 2007-07-13 19:05:41 UTC
I'm using the PHP Symfony framework's rsync application publication feature to publish an application from my development box to a ~archives/symfony directory on our production box. This invokes the following rsync command:

rsync --progress --dry-run -azC --force --delete --exclude-from=config/rsync_exclude.txt -e ssh ./ archives@archivesofdevelopment.org:symfony/

I notice that when the ~archives/symfony directory doesn't already exist on the production box, rsync will delete all files and directories in the parent directory (in our case ~archives). Once I create the ~archives/symfony directory, rsync correctly copies ./* from the development box to ~archives/symfony, without touching anything else in ~archives on the production box.

I've been over the man page, especially the parts about a trailing slash on the source, and I believe this behavior is a bug. For instance, rsync's syntax is supposed to be somewhat analogous to rcp/scp where "scp -r . archives@archivesofdevelopment.org:symfony" would copy the working directory to ~archives/symfony, without touching anything else in ~archives.

Also, the local analogy:

rsync --progress --dry-run -azC --force --delete --exclude-from=config/rsync_exclude.txt -e ssh ./ /tmp/symfony/

copies the working directory to /tmp/symfony, without touching anything else in /tmp.

The local version of rsync is: rsync  version 2.6.9  protocol version 29

The remote version is: rsync  version 2.6.3  protocol version 28

Thanks, Jack
Comment 1 Wayne Davison 2007-07-13 23:29:30 UTC
There was a bug in 2.6.3 where --dry-run could output extra files that weren't going to be removed during the real run.  This was fixed in 2.6.4.  The CVS version had a reprise of this bug, which I have just fixed.

Please be clear that when you said "rsync will delete all files and directories in the parent directory" you really meant to say that it will incorrectly report that all those items would be removed if --dry-run was not present.  Rsync would not have actually removed any extraneous files with the same command without --dry-run.