wildcards (was Re: a problem I'm having with rsync-4.5.4)

Wayne Davison wayned at users.sourceforge.net
Thu May 9 17:45:02 EST 2002


On Thu, 9 May 2002, Dave Dykstra wrote:
> How many times would you have to call fnmatch for every file?

We'd call fnmatch() an extra time for every slash in the path.  However,
the performance hit of this new loop on the pattern "foo/*" would be the
same as using the two patterns "/**/foo/*" & "/foo/*" (_except_ that the
trailing '*' would work right in the first pattern) -- this is because
"**" already has to do a recursive match iteration, and that's kind of
what our new loop would be doing outside of fnmatch() (we'd actually be
doing less recursive calls, since fnmatch() would call itself an extra
time for every character in the path, but our loop would only call for
every character after a slash).

So yes, this is slightly less efficient for unanchored patterns.  It
would make the code work as advertised, though, and any pattern that was
anchored with a leading slash would be entirely unaffected.  On the
downside, it could cause some people who use unanchored patterns as if
they were actually anchored to be surprised by the change in behavior.

..wayne..





More information about the rsync mailing list