What happens if you change

if (liststart = NULL)
  {
  return false;
  }

I am not quite sure why I did this, but it looks as though that case
can be handled differently, or in the call

 if (CompareToFile(ec->file_start,ec->filename))

could become

 if (ec->file_start && CompareToFile(ec->file_start,ec->filename))

Matt Richards wrote:
> 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
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine

-- 
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to