Forum: Cfengine Help
Subject: Possible bug in cfengine 2
Author: kevinmusker
Link to topic: https://cfengine.com/forum/read.php?3,16863,16863#msg-16863
We are currently using cfengine 2.2.8 to manage a bunch of FreeBSD boxes. Last
week we made some configuration changes which led to cfagent hanging while
trying to parse the cf files. We managed to track it down to the addition of a
variable named 'voip_group'. In order to deploy the changes, we renamed the
variable.
This seems to have been caused by a bug in the GetMacroValue function defined
in macro.c. The string 'voip_group' hashes to the value 0 (zero), meaning that
the while loop never exits if the variable isn't defined in the hashtable
associated with the current scope (in our case, it was hangnig while searching
for the variable in the 'main' scope). The reason I say that it _seems_ to have
been caused by a bug is that, if my assumptions are correct, it has a 1 in 4969
chance of being triggered for any given variable name.
Below is a patch which fixed the problem for us. Although we are not using the
latest version of cfengine 2, the bug is present in the latest version of
macro.c in VC.
--- src/macro.c.orig 2007-08-19 16:27:48.000000000 +0100
+++ src/macro.c 2010-04-09 14:45:37.000000000 +0100
@@ -380,6 +380,10 @@
if (i >= CF_HASHTABLESIZE-1)
{
+ if (slot == 0)
+ {
+ return(getenv(vname));
+ }
i = 0;
}
Has anybody else experienced a similar problem?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine