Bug 7953 - -x flag prevents symlink on source filesystem from overwriting dest dir
Summary: -x flag prevents symlink on source filesystem from overwriting dest dir
Status: RESOLVED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.8
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
: 8057 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-10 23:04 UTC by Ben Hall
Modified: 2011-04-04 16:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Hall 2011-02-10 23:04:34 UTC
rsync will not recursively delete a directory on the destination file system when the -x flag is used and the source is a symlink on a different file system.
This is inconsistent with the behaviour seen when rsync'ing between directories in the same context.

Commands to reproduce:

mkdir /testing
mount -t tmpfs -o size=1M,nr_inodes=1000,mode=0700 tmpfs /testing
mkdir /testing/bar
ln -s /testing/bar /testing/foo
mkdir --parents /tmp/foo/bar/baz
rsync -arvx --delete --force /testing/foo /tmp

Result:
sending incremental file list
cannot delete non-empty directory: foo
could not make way for new symlink: foo

sent 41 bytes  received 12 bytes  106.00 bytes/sec
total size is 12  speedup is 0.23
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7]
Comment 1 Wayne Davison 2011-02-22 10:28:41 UTC
I've just checked in a fix for this.  The device number of the destination wasn't being stored w/o --delete, so the removal would fail the same-device check.
Comment 2 Wayne Davison 2011-04-04 16:58:29 UTC
*** Bug 8057 has been marked as a duplicate of this bug. ***