Re: NOBUG - er, at least regarding double tabs.

Paul Krizak <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.bugs,gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Actually, it's not that the double-tabs get swallowed (though that might 
occur in some cases) -- it's the fact that the regex is stopping on the 
asterisk.  Take this string for example:

0${tab}${tab}*${tab}*${tab}

If you use a regex of "^0${tab}${tab}*${tab}*${tab}", then you're 
telling the regex engine to match "a zero, followed by a tab, followed 
by zero or more tabs, followed by zero or more tabs, and terminated with 
another tab."  Notice, no "and an asterisk" in there.

To correctly match this string:

"^0${tab}${tab}\*${tab}\*${tab}"

which says "A zero, followed by two tabs, followed by an asterisk, 
followed by a tab, followed by an asterisk, terminated with a tab."

Paul Krizak                         7171 Southwest Pkwy MS B400.2A
Advanced Micro Devices              Austin, TX  78735
Linux/Unix Systems Engineering      Desk:  (512) 602-8775
Silicon Design Division             Cell:  (512) 791-0686


Paul Krizak wrote:
> I notice you've got asterisks in some of your regexes:
> 
>  > */10^I*^I*^I*^I*^Iroot^I/usr/local/bin/bsdsar_gather$
> 
> Remember that in regex-ese, asterisk means "zero or more of the previous 
> entity".  So "^I*^I" means "zero or more tabs, followed by a tab. 
> Double-tabs will get swallowed up by the greedy regex.  You probably 
> need to escape the asterisks.
> 
> Also, you should use ${tab} to make it all more readable!!
> 
> Paul Krizak                         7171 Southwest Pkwy MS B400.2A
> Advanced Micro Devices              Austin, TX  78735
> Linux/Unix Systems Engineering      Desk:  (512) 602-8775
> Silicon Design Division             Cell:  (512) 791-0686
> 
> 
> Jo Rhett wrote:
>> On Mar 28, 2008, at 12:02 PM, Paul Krizak wrote:
>>> And it worked fine.
>> ...
>>> And that worked fine too.
>> Dangit, you're right.  I dropped some stuff in copy/paste.  FARG!
>>
>> Well, here are the lines which won't match no matter what. And I'm 
>> having a devil of a time producing a test case for this problem.  But 
>> it's real.  The same lines work without double tabs...
>>
>> jrhett@arran 46$ cat -vet testfile
>> */10^I*^I*^I*^I*^Iroot^I/usr/local/bin/bsdsar_gather$
>> 0^I2^I*^I*^I*^Iroot^I/usr/sbin/freebsd-update cron$
>> 0^I*^I*^I*^I*^Iroot^I/usr/local/sbin/cfexecd -F$
>> 0^I^I2^I*^I*^I*^Iroot^I/usr/sbin/freebsd-update cron$
>> 0^I^I*^I*^I*^I*^Iroot^I/usr/local/sbin/cfexecd -F$
>>
>> jrhett@arran 47$ cat -t cfagent.conf
>>
>> control:
>> ^Iactionsequence^I= ( editfiles )
>>
>> editfiles:
>> ^I{ /home/jrhett/test/testfile
>> ^I^IDeleteLinesMatching 
>> "^0^I^I2^I*^I*^I*^Iroot^I/usr/sbin/freebsd-update cron"
>> ^I^IDeleteLinesMatching "^0^I^I*^I*^I*^I*^Iroot^I/usr/local/sbin/cfexecd 
>> -F"
>> ^I}
>>
>> jrhett@arran 48$ cfagent -qIf ./cfagent.conf
>> cfengine:arran: Couldn't find a private key 
>> (/home/jrhett/.cfagent/ppkeys/localhost.priv) - use cfkey to get one
>> jrhett@arran 49$ cat -vet testfile
>> */10^I*^I*^I*^I*^Iroot^I/usr/local/bin/bsdsar_gather$
>> 0^I2^I*^I*^I*^Iroot^I/usr/sbin/freebsd-update cron$
>> 0^I*^I*^I*^I*^Iroot^I/usr/local/sbin/cfexecd -F$
>> 0^I^I2^I*^I*^I*^Iroot^I/usr/sbin/freebsd-update cron$
>> 0^I^I*^I*^I*^I*^Iroot^I/usr/local/sbin/cfexecd -F$
>>
> 
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.