I have been debugging this one for quite some time, and simplified the test case
body common control {
bundlesequence => { test };
}
bundle agent test {
methods:
"any" usebundle=>func("/etc/motd");
}
bundle agent func(filename) {
vars:
"ccfile" string => canonify("$(filename)");
reports:
Yr2009::
"filename:$(filename)";
"ccfile:$(ccfile)";
Running the debug:
**
ExpandPrivateScalar(func,$(filename))
Add || to str, waiting at |$(filename)|
ExtractOuterVarString($(filename)) - syntax verify
Extracted outer variable |$(filename)|
ExtractInnerVarString( $(filename) ) - syntax verify
Returning substring value filename
GetVariable(func,filename) type=(to be determined)
IsExpandable(filename) - syntax verify
Found 0 variables in (filename)
Looking for func.filename
Searching for scope context func
Found scope reference func
GetVariable(func,filename): using scope 'func' for variable 'filename'
No such variable found func.filename
Currently non existent or list variable $(filename)
Returning partial / best effort scalar expansion ($(filename) => $(filename))
**
I have been tracing the expansion of filename, And I get lost around
IsExpandable:
IsExpandable(str = "filename"), line 755 in "expand.c"
GetVariable(scope = "func", lval = "filename", returnv = 0x2ff1ab48,
rtype = ""), line 160 in "vars.c"
unnamed block $b79, line 501 in "expand.c"
ExpandPrivateScalar(scopeid = "func", string = "$(filename)", buffer =
""), line 501 in "expand.c"
ExpandPrivateRval(scopeid = "func", rval = 0x20232208, type = 's'),
line 350 in "expand.c"
NewExpArgs(fp = 0x202321e8, pp = 0x20232128), line 173 in "args.c"
EvaluateFunctionCall(fp = 0x202321e8, pp = 0x20232128), line 253 in "fncall.c"
unnamed block $b77, line 934 in "expand.c"
ConvergeVarHashPromise(scope = "func", pp = 0x20232128, allow_redefine = 0)
I think it has something to do with scope, but I am having a tough
time find this bug.
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine