Re: BUG - *Matching rules won't match multiple tabs.

"Jesse Becker" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.bugs,gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
So, I ran this snippet:

editfiles:
    { /tmp/tabtest
        DeleteLinesMatching "REGEXGOESHERE"
    }

With the obvious substitution for the following:

^\t\t$                   (tab tab, the "\t" entries indicate "real"
tabs, not a literal '\' then 't'
^${tab}${tab}$       (tab tab)
^8${tab}${tab}$     (digit tab tab)
^8${tab}${tab}8$   (digit tab tab digit)
^  $                     (space space)
^${spc}${spc}$      (space space)

My sample file had lines with (spelled out in english...):

  only two tabs in it
  a space, then a tab
  a tab, then a space
  a space, then a space
  two tabs, then a digit
  a digit, then two tabs
  a digit, then two tabs, then a digit

Each one removed the lines I expected to be removed:  that is the
"space space" lines would remove only lines with 2 spaces.

Although not mentioned, I also tried these

  ^[:space:]+$
  ^[:blank:]+$
  ^[:space:]*$
  ^[:blank:]*$

but none of them worked at all. (I realize this is a tangent of sorts).

All testing was done using cfengine 2.2.0

On Fri, Mar 28, 2008 at 2:43 PM, Paul Krizak <[email protected]> wrote:
> I just downloaded your test code and found that your code was simply
>  incorrect.  You have this:
>
>  editfiles:
>         { /home/skaven/tmp/jo/testfile
>                 DeleteLinesMatching "^0^I^I1"
>         }
>
>  I got this to work fine by replacing it with this:
>
>  any::
>      # Using "real" tabs (not ^I)
>      { /home/skaven/tmp/jo/testfile
>          DeleteLinesMatching "^0     1.*"
>      }
>
>  Or even this:
>
>  any::
>      # Using ${tab} macro
>      { /home/skaven/tmp/jo/testfile
>          DeleteLinesMatching "^0${tab}${tab}1.*"
>      }
>
>  Note that in both cases, all that is needed is the trailing ".*" to make
>  the regex work.
>
>  So I have to agree with the others on this thread -- this isn't a bug --
>  you are just not using a full-line regex, or perhaps you've gotten
>  yourself confused with :set list versus what's actually in your code.
>
>
>  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:
>
> > Mark Burgess wrote:
>  >> Jo, please use the tool provided. There is nothing wrong with these
>  >> posix standard routines. You might be writing perl regexs or regexs
>  >> from other non-posix libraries by mistake.
>  >
>  > Attach is both the testfile and the cfagent.conf which demonstrates the
>  > problem.  You can test it yourself.
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > Bug-cfengine mailing list
>  > [email protected]
>  > https://cfengine.org/mailman/listinfo/bug-cfengine
>
>
>
>  _______________________________________________
>  Help-cfengine mailing list
>  [email protected]
>  https://cfengine.org/mailman/listinfo/help-cfengine
>



-- 
Jesse Becker
GPG Fingerprint -- BD00 7AA4 4483 AFCC 82D0 2720 0083 0931 9A2B 06A2
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.