[Csync2] Partial path excludes?

Lars Ellenberg lars.ellenberg at linbit.com
Thu May 5 21:59:54 CEST 2011


On Thu, May 05, 2011 at 09:41:10PM +0200, Lars Ellenberg wrote:
> On Thu, May 05, 2011 at 11:59:58AM -0400, Tony Muka wrote:
> > Sorry to drag up this old message, but I didn't see much documentation
> > on this issue, and wanted to share my findings in trying to exclude
> > .svn folders with csync2.
> > 
> > After trying many failing variations of
> > 
> > exclude .svn
> > exclude .snv*
> > exclude .svn/*
> > exclude ".svn/*"
> > exclude *svn*
> > 
> > the only thing that worked was
> > 
> > exclude /var/www/*/htdocs/.svn/*;
> > exclude /var/www/*/htdocs/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/*/*/*/*/.svn/*;
> > exclude /var/www/*/htdocs/*/*/*/*/*/*/*/*/*/.svn/*;
> > 
> > It would really be nice if there was a way to use one simple rule to
> > exclude the descendants of any .svn folder, but for now, this works.
> > 
> > I probably don't have a good enough reason to exclude the .svn paths
> > to use this case as a justification for the feature, etc... Excluding
> > the .svn folders does cut my disk usage by 50% on the slave nodes.*
> 
> I think that I made a feature request to have that fixed in the 2.0 code
> base, with 2 "**" matching slashes as well.
> I'm currently not sure if that has been done,
>  /me checks ...
> Hm. Has not been done :(
> 
> Ok, so please do
> 
>   git clone git://git.linbit.com/csync2.git
> 
> apply the quick'n'dirty only compile tested patch below,
> and try
> 	exclude /var/www/*/htdocs**/.svn;
> 
> Note that the "**" is only the trigger, the matching function used is
> still fnmatch, so once the trigger is present, _any_ star in that
> pattern will match slashes (see man fnmatch(3)).
> 
> Doing it "right" could be to steal the rsync pattern matching functions,

What I meant here is:
grab wildmatch.c and wildmatch.h from
http://gitweb.samba.org/?p=rsync.git;a=tree;f=lib

and use wildmatch(pattern, file)
where we now use fnmatch().

If someone wants to prepare a patch for that,
please go ahead ;-)

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com


More information about the Csync2 mailing list