include/exclude bug in rsync 2.6.0/2.6.1pre1

Wayne Davison wayned at
Sat Apr 10 10:14:13 GMT 2004

On Fri, Apr 09, 2004 at 06:33:58PM +0200, John Bowman wrote:
> and also fixes a bug that was introduced in 2.6.0 exclude/include
> option that prevents included patterns in one list from overriding
> previously excluded patterns from another.

This isn't a bug -- it was done as part of the exclude cleanup to fix
some potential mishaps.  For instance, if a server has specified these
include/exclude rules:

+ /foo.c
- /*.c

it was done that way to say "I'll let you copy foo.c, but no other .c
files."  Not to say, "You must take foo.c whether you want it or not."
Thus, an inclusion match in a list just means that the name avoids being
excluded by that particular list.

Yes, this means that if any of the 3 exclude lists tells rsync to
exclude a file that it gets excluded.  One can argue both for and
against this when thinking about how the normal excludes interact
with the CVS excludes.  Consider:

    rsync -C --include=*/ --include=*.c --exclude=* ...

If a .cvsignore file specifies "foo.c", I want it to be excluded
(because it's a generated .c file).  However, I could argue that
I should also be able to override the .cvsignore-excluded file
somehow, perhaps with this:


The problem is distinguishing if the user is specifying an exception to
a rule in the current list or trying to override an exclusion from the
CVS-ignore list.  I can't think of a good heuristic to accomplish this
at the moment.  If someone has a bright idea, let me know.  Failing
that, I think the behavior in 2.6.0 (and 2.6.1pre-1) is what we want.

> an entry at the end of the list should override a previous entry

Most definitely NOT.  The documented behavior has always been "first
match wins."  To change this to "last match wins" would be incompatible
with prior rsync versions.

> As a result of the above issues, an include pattern in local_exclude_list
> (cvs-exclude) will not override a global exclude pattern in exclude_list,

There are no include patterns in local_exclude_list at the moment, so
this isn't a problem.  If there were, we would be in an identical
conundrum to the one stated above (though with the lists reversed).

> I would very much appreciate it if this patch were incorporated into the
> next release of rsync

I'll massage it a bit and put it in the patches dir for now.  We'll
consider it for the release after 2.6.1 (which is going to be more of
a feature-adding release than this one).


More information about the rsync mailing list