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
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to