unexpected --exclude pattern behaviours with glob wildcards

Ian! D. Allen idallen at idallen.ca
Tue Nov 11 04:28:39 EST 2003


Rsync version: rsync-2.5.6-3mdk (Mandrake 9.2)

I see from the CVS log that some of the following awkwardness may be
fixed (or at least different) in the next public release.  I'm looking
forward to that.  In the interim, here are some problems:

---------
Problem 1 - unexpected consequence of replacing / with **
---------

The following exclude works because the explicit slash causes a match
against the full pathname:

$ rsync -n -a -R -vv --exclude '2001_x10automation/announcement.txt' \
   public_html/oclug /tmp/ijunk
excluding file public_html/oclug/2001_x10automation/announcement.txt
   because of pattern 2001_x10automation/announcement.txt

Now replace the slash with the more general pattern '**'.  The following
exclude fails because the lack of any slash makes the match apply only
to last component:

$ rsync -n -a -R -vv --exclude '2001_x10automation**announcement.txt' \
   public_html/oclug /tmp/ijunk
public_html/oclug/2001_x10automation/announcement.txt

This is true to the documentation; but, it isn't what I expected.  If
I use a ** in a pattern it's because I *want* it to match the slashes!

---------
Problem 2 - unexpected consequence of replacing a character with '?'
---------

The following exclude works (note: no GLOB patterns):

$ rsync -n -a -R -vv --exclude '2001_x10automation/announcement.txt' \
   public_html/oclug /tmp/ijunk
excluding file public_html/oclug/2001_x10automation/announcement.txt
   because of pattern 2001_x10automation/announcement.txt

The following exclude fails (replace one char with a GLOB char):

$ rsync -n -a -R -vv --exclude '2001_x10automation/announcement.tx?' \
   public_html/oclug /tmp/ijunk
public_html/oclug/2001_x10automation/announcement.txt

I don't understand the above at all.  Adding a wildcard character to
a working exclude shouldn't cause it to fail.

Adding '**' to the front of the failing pattern causes it to start
working again.  Why?  This is really not how I expect it to work.

Keep up the good work - this is a fabulous tool.

-- 
-IAN!  Ian! D. Allen   Ottawa, Ontario, Canada
       EMail: idallen at idallen.ca   WWW: http://www.idallen.com/
       College professor via: http://teaching.idallen.com/
       Board Member, TeleCommunities CANADA  http://www.tc.ca/



More information about the rsync mailing list