bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppendIfNoLineMatching incorrect behavior


From: Jonathan Chen
Subject: AppendIfNoLineMatching incorrect behavior
Date: Tue, 13 May 2003 15:59:23 -0400
User-agent: Mutt/1.4i

CFEngine version 2.0.6 has an implementation of AppendIfNoLineMatching that
varies from the documentation.  Instead of appending the string set from
SetLine, it appends the regular expression.  The following patch fixes this
problem:

--- cfengine-2.0.6/src/edittools.c~     Tue May 13 15:42:57 2003
+++ cfengine-2.0.6/src/edittools.c      Tue May 13 15:42:58 2003
@@ -537,22 +537,12 @@
                   continue;
                   }
 
-              if (strcmp(expdata,"ThisLine") == 0)
+              if (LocateNextItemMatching(filestart,expdata) == NULL)
                  {
-                 if (LocateNextItemMatching(filestart,EDITBUFF) == NULL)
-                    {
-                    AppendItem(&filestart,EDITBUFF,NULL);
-                    }           
+                 AppendItem(&filestart,EDITBUFF,NULL);
+                 }              
+              break;
 
-                 break;
-                 }
-              
-               if (LocateNextItemMatching(filestart,expdata) == NULL)
-                 {
-                  AppendItem(&filestart,expdata,NULL);
-                  }
-               break;
-
       case Prepend:
                PrependItem(&filestart,expdata,NULL);
                break;

-- 
Jonathan Chen           +       (518)276-2842   (518)409-0634
address@hidden          +       Research Programmer / System Administrator
301 Lally               +       Department of Computer Science, RPI





reply via email to

[Prev in Thread] Current Thread [Next in Thread]