Stop me if you've heard this one already... For the life of my I can't get the following editfiles snippet:
> { /etc/syslog-ng/syslog-ng.conf > LocateLineMatching "### Begin Section loghost ###" > UnCommentToLineMatching "### End .*" > } To do what I expect on the following bit of syslog-ng.conf: > ### Begin Section loghost ### > # source s_remote { > # tcp(ip(0.0.0.0) port(514)); > # udp(ip(0.0.0.0) port(514)); > # }; > ### End Section loghost ### > > ### Begin Section loghost_sys ### > # destination d_messages_byhost { > # file("/data/log/$HOST/messages"); > # }; > # > # log { source(s_remote); destination(d_messages_byhost); }; > ### End Section loghost_web ### I want it to only uncomment the first section. What it does is uncomment the entire rest of the file. Here's some interesting debugging output: > Edit action: UnCommentToLineMatching > CommentToRegExp(list,# ### End .*) > Uncomment line # source s_remote { > Uncomment line # tcp(ip(0.0.0.0) port(514)); > Uncomment line # udp(ip(0.0.0.0) port(514)); > Uncomment line # }; > Terminating line: ### End Section loghost ### (Done) > Uncomment line # destination d_messages_byhost { > Uncomment line # file("/data/log/$HOST/messages"); > Uncomment line # }; > Uncomment line # > Uncomment line # log { source(s_remote); > destination(d_messages_byhost); }; It looks like it detects the correct line on which to Terminate, but then Uncomments the rest of the file anyway. From UnCommentToRegExp() in item-ext.c (line 1282 in cfengine-2.2.8): > for (ip = CURRENTLINEPTR; ip != NULL; ip = CURRENTLINEPTR) > { > if (ip == ip_end) > { > EditVerbose("Terminating line: %s (Done)\n",ip->name); > done = true; > } "done" is a local variable that is not used anywhere else in UnCommentToRegExp(). Based on the incorrect function name in the Debug2() statement, I take it UnCommentToRegExp() was copied from CommentToRegExp() and the if (done) { break; } was lost somewhere along the way. Could this be the case? I attempted to see if this is also the case in cfengine-3.0.0a3, but UnCommentToRegExp() has been removed entirely, it seems. This also raises a larger question -- will cfengine-2.2 be bugfixed after 3.0.0 is released, or will I have to upgrade to 3.0.0 to fix this issue? Thanks, -lee _______________________________________________ Bug-cfengine mailing list Bug-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/bug-cfengine