On Mon, Dec 04, 2000 at 03:05:26PM -0800, Mike Spitzer wrote:
> 
> In the exclude pattern section, the rsync man page states:
> 
>       if  the  pattern starts with a / then it is matched
>       against the start of the filename, otherwise it  is
>       matched  against the end of the filename.
> 
> Consistent with this, excluding "*.c" excludes .c files anywhere in
> the tree.
> 
> Also consistent with this, excluding "foo/bar.c" excludes foo/bar.c
> anywhere in the tree (this would exclude foo/bar.c, baz/foo/bar.c, etc.).
> 
> But, I'm getting unexpected results from excluding "foo/*.c".  I expected
> this to behave similarly to excluding foo/bar.c, which would be to
> exclude any .c files in any foo directory, anywhere in the tree.  What I
> get instead is that *.c is excluded only in a top-level foo directory.
> foo/bar.c would be excluded, but baz/foo/bar.c would not be excluded.
> This seems inconsistent with the documentation, and inconsistent with
> the "foo/bar.c" exclude behavior.
> 
> Is this a bug or am I not understanding the rules?
> 
> Thanks.


You understand correctly, this is a known bug.  See

    http://lists.samba.org/pipermail/rsync/1999-October/001440.html

There's not an easy solution, however, because the function rsync uses to
do wildcard matches, fnmatch(), cannot completely implement the semantics
as described in the rsync man page.  A workaround for you may be to exclude
"**/foo/*.c", but that's not complete because the semantics of "**" is such
that including it anywhere in a pattern means that all asterisks can cross
slash boundaries.  Thus, it will match baz/foo/oof/bar.c.  As I said back
then, the rsync include/exclude semantics & implementation needs to be
completely redone.

- Dave Dykstra

Reply via email to