Greetings. There is a small bug in edit_line when you delete all the
lines in a file (purposely with a regex).

bundle edit_line testing {

  delete_lines:
      "^nonsense:.*" not_matching => "true";

}


When it compares the file to the one in memory (CompareToFile in
item-lib.c ~line 1265):

(filename = "/var/opt/cfengine/cf_hosts", file_start = (nil),
file_classes = (nil), num_edits = 4)  (ec struct when calling
CompareToFile)

item-lib.c:

Debug("CompareToFile(%s)\n",file);

if (stat(file,&statbuf) == -1)
   {
   return false;
   }

if (liststart == NULL)
   {
   return true;
   }


liststart is NULL since the file has been wiped clean. I am not sure
of an elegant way to fix this.
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to