Running it through the debugger and digging way to deep. It is not
readstringarray causing the issues, but the value of $(sys.workdir)
and $(sys.fqhost) that it cannot find. If I use the variable
equivalent (ie /var/cfengine instead of $(sys.workdir)), then it
works.

It seems on a reread, the hashtables are not rebuilt the same. The
initial run builds the hashtable values with NewScalar in GetNameInfo3
for the $(sys.*) values. The value of sys.workdir is added to the hash
by

NewScalar("sys","workdir",CFWORKDIR,cf_str); (sysinfo.c line 244).

On a reread, GetNameInfo3 bails at the begining, so it never adds the
hash values later on in the function.

if (VSYSTEMHARDCLASS != unused1)
   {
   CfOut(cf_verbose,"","Already know our hard classes...\n");
   /* Already have our name - so avoid memory leaks by recomputing */
   return;
   }

Here is where I don't know enough about the code. Should (or are) the
hashtables  reused/copied/modified on a reread, or should/does a new
hashtable be recreated and reread all the values back in.

In the case hashtable is reused, it could be that the reference to the
hashtable is lost for the scope for the sys.workdir variable (as it is
a different memory location than the original hashtable).

In the case the hashtable is rebuilt, then the sys.workdir (and other
variables), needs to be readded in.
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to