Bug 5091 - Incremental-recursive, list-only "rsync --delete" tries to clean out working dir
Summary: Incremental-recursive, list-only "rsync --delete" tries to clean out working dir
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.0
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-19 16:00 UTC by Matt McCutchen
Modified: 2008-07-26 10:20 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 Matt McCutchen 2007-11-19 16:00:04 UTC
In an empty directory, run:

mkdir src
rsync -r --delete src/

The result:

drwx------          48 2007/11/19 16:54:29 .
rsync: delete_file: rmdir(src) failed: Read-only file system (30)
rsync error: some files could not be transferred (code 23) at main.c(1059) [sender=3.0.0pre5]

Rsync should not be trying to delete in list-only mode!  Thank goodness for the check in syscall.c or I might have had some serious data loss.

The error occurs only when incremental recursion is in use.  The trouble is that the call to delete_in_dir at generator.c:2051 is not conditioned on !list_only .  To prevent more mistakes like this, it might make sense to set dry_run to a large value in list-only mode.
Comment 1 Wayne Davison 2007-11-21 10:16:20 UTC
This is now fixed in git.  Thanks for the report!