3.0.1a3: select_line_matching problems

Jim Wight <[email protected]> Fri, 16 Jan 2009 14:22:59 +0000
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <EMEW-l0FEMxdde0aee49125681b72d81a5148e90fa7-49709843.1040708@ncl.ac.uk>
The documentation has this example

      body location example
      {
      select_line_matching => "^Expression match.* whole line$";
      }

and says that ^ and $ are not necessary.

The following script

     body common control
     {
     bundlesequence  => { "edit" };
     }

     bundle agent edit
     {
     files:
        "/tmp/thefile" edit_line => edit2;
     }

     bundle edit_line edit2
     {
     insert_lines:
        "Insert after two" location => "after2";
     }

     body location after2
     {
     select_line_matching => "^two$";
     before_after => "after";
     }

produces this error

cf3:./edit.cf:23,0: Broken variable syntax or bracket mismatch - inner ($/), 
near token ''

If I replace both ^ and $ with .* (or remove them altogether) cf3 reports

cf3  !! The promised line insertion (Insert after two) could not select a 
locator matching .*two.* in /tmp/thefile

(and similaraly for the second case), despite there being a line in 
/tmp/thefile consisting of just the word "two":

# grep '^two$' /tmp/thefile
two

In both cases, cf-agent ends with a segmentation fault.

Jim