Bug 4961 - rsync ignores --compare-dest flag?
Summary: rsync ignores --compare-dest flag?
Status: RESOLVED INVALID
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.9
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-08 17:57 UTC by jae
Modified: 2007-09-10 21:01 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 jae 2007-09-08 17:57:33 UTC
Perhaps I have the syntax wrong, however, the following attempts to copy all files in SOURCE every time:

1. mkdir LATEST_CHANGES SOURCE BACKUP_STAGING
2. touch SOURCE/filea SOURCE/fileb SOURCE/filec
3. rsync -avi SOURCE/* LATEST_CHANGES
(all files copied, as expected)
4. touch SOURCE/filed SOURCE/filee
5. rsync -avin SOURCE/* BACKUP_STAGING --compare-dest=LATEST_CHANGES

always reports the three files that are in LATEST_CHANGES:
building file list ... done
>f+++++++ filea
>f+++++++ fileb
>f+++++++ filec
>f+++++++ filed
>f+++++++ filee

( diff SOURCE LATEST_CHANGES yields: )
Only in SOURCE: filed
Only in SOURCE: filee
(implying that files a,b, and c match.)

SO - I'm expecting that filed and filee be copied to BACKUP_STAGING, but not files a,b, and c.

ultimately, I plan to use this as follows:
rsync -avi SOURCE/* BACKUP_STAGING --compare-dest=LATEST_CHANGES --compare-dest=BOM_REPO

Is this a bug?  Or am I just using it the wrong way?
Comment 1 jae 2007-09-08 18:02:06 UTC
just discovered that the behavior seems to work as it's supposed to as long as the paths are absolute paths.
Comment 2 Matt McCutchen 2007-09-08 19:19:32 UTC
You're using it the wrong way.  The man page description of --compare-dest=DIR says, "If DIR is a relative path, it is relative to the destination directory."  So your option should be --compare-dest=../LATEST_CHANGES .
Comment 3 Wayne Davison 2007-09-10 21:01:22 UTC
As noted, the path needed to be tweaked to work.