Bug 4378 - Make the transfer rules behave more like ordinary excludes
Summary: Make the transfer rules behave more like ordinary excludes
Status: ASSIGNED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.6
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-07 16:23 UTC by Michael Schliephake
Modified: 2009-12-13 00:38 UTC (History)
0 users

See Also:


Attachments
Limit deletions to exclude items we aren't transferring (704 bytes, patch)
2007-03-27 17:37 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schliephake 2007-02-07 16:23:18 UTC
RSync ignores symbolic links by default (warning written out).

Scenario: 'dirA' contains files and links and should be synchronized with 'dirB' and vice versa.

   rsync -v --delete dirA dirB

copies files from A to B and lets links in A. The opposite command

   rsync -v --delete dirB dirA

should now do nothing because directories are "in sync". Instead of this the command deletes the links in A.

I argue that links should not be deleted if they are ignored in the opposite direction. Otherwise it is not possible to write "symmetric commands". Of course the same is true for the other variants of link treatment (not tested by me).
Comment 1 Wayne Davison 2007-03-27 17:37:48 UTC
Created attachment 2350 [details]
Limit deletions to exclude items we aren't transferring

Here is a simple patch for the CVS version that limits the deletions to skip symlinks, device files, and other special files if they are not being synchronized.  I'm considering this patch for inclusion in 3.0.0.

Thanks!
Comment 2 Matt McCutchen 2007-03-27 18:12:44 UTC
I notice that the patch only affects extraneous "special" files immediately inside file-list directories, not those in extraneous directories.  This is enough for the commands to be symmetric, but deleting an apparently empty directory on one side could result in the unexpected loss of a lot of special files on the other side.  I'm not sure whether this is a strong enough reason that rsync should protect special files in extraneous directories and pin their parent directories.
Comment 3 Matt McCutchen 2009-11-27 20:12:43 UTC
I'd like to broaden this ticket to include an analogous issue with --min-size and --max-size:

http://lists.samba.org/archive/rsync/2006-February/014784.html
Comment 4 Matt McCutchen 2009-11-27 20:34:52 UTC
(In reply to comment #2)
> I notice that the patch only affects extraneous "special" files immediately
> inside file-list directories, not those in extraneous directories.  [...]

The goal of this ticket is really to make --min-size/--max-size behave more like an ordinary exclude.  And the decision to be made is whether this exclude is "perishable".

I realize that different users may have different expectations about how these options behave.  See, for example, the following request that --max-size behave as a real hide rather than a transfer rule:

http://lists.samba.org/archive/rsync/2009-November/024300.html

So probably the most general solution is to add filter rules based on size and a new filter action that means "show but don't process" to emulate a transfer rule.
Comment 5 Matt McCutchen 2009-11-27 20:36:26 UTC
(In reply to comment #4)
> The goal of this ticket is really to make --min-size/--max-size behave more
> like an ordinary exclude.

Whoops, the ticket was originally about the file-type options (-r/-d, -l, --devices, --specials), but the point is the same.