Bug 5758 - '**' does not match empty strings
Summary: '**' does not match empty strings
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.3
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2008-09-14 08:32 UTC by Dieter P
Modified: 2008-10-11 11:36 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dieter P 2008-09-14 08:32:55 UTC
man rsync, section "FILTER RULES" says:
"use ’**’ to match anything, including slashes."

This is incorrect.  '**' does not match empty strings.
The description should be:
"use ’**’ to match any non-empty string, including slashes."
This would be more in line with what '*' does ( "a ‘*’ matches any non-empty path component (it stops at slashes)." )
Comment 1 Wayne Davison 2008-09-14 21:46:29 UTC
"**" certainly does match empty strings, even at the start of a path (e.g. **/foo will exclude a "foo" at the root of the transfer).  If you're seeing an issue, please be specific in what is not working for you.
Comment 2 Dieter P 2008-09-20 11:41:21 UTC
Hi, seems like you're right.  Sorry for bothering you :-)

On the other hand, the manpage says:
"a ’*’ matches any non-empty path component (it stops at slashes)."
Although '*' seems to match non-empty and empty(!) filename components.
Eg: 'foo*' matches the file foo and foobar.

~$ mkdir test-src test-dest; touch test-src/foo test-src/foobar
~$ rsync -av --exclude 'foo*' test-src/ test-dest
building file list ... done

sent 74 bytes  received 20 bytes  188.00 bytes/sec
total size is 0  speedup is 0.00

I've tested this on rsync 2.6.9 and 3.0.3.
Isn't this a mistake in the manpage then?
Comment 3 Wayne Davison 2008-10-11 11:36:39 UTC
The "non-empty" qualifier in the manpage was certainly deceiving, and has been removed.