Not sure if this is a bug or a feature, but in the newly-patch version
of cfengine 2.1.16 (2.1.16p1?):
control:
pf_cc= "/usr/bin/gcc"
pf_cc_vers= (
ExecResult(/bin/sh -c "${pf_cc} --version | head -1 | cut -d\
-f3")
)
...used to produce the version number of /usr/bin/gcc, but now running
this command produces "/usr/bin/gcc: no input files".
Running under debug shows:
RecordMacroId(pf_cc_vers)
HandleFunctionObject(ExecResult(/bin/sh -c "${pf_cc} --version | head -1
| cut -d\ -f3"))
IsBuiltinFunction(ExecResult(/bin/sh -c "${pf_cc} --version | head -1 |
cut -d\ -f3"))
IsBuiltinFunction: ExecResult(/bin/sh -c "${pf_cc} --version | head -1 |
cut -d\ -f3")
HandleFunction: ExecResult(/bin/sh -c "${pf_cc} --version | head -1 |
cut -d\ -f3")
FunctionStringToCode(ExecResult)
Appending [/bin/sh -c ${pf_cc} --version | head -1 | cut -d\ -f3]
ExpandVarstring(/bin/sh -c ${pf_cc} --version | head -1 | cut -d\ -f3)
Returning substring value pf_cc
Scanning variable pf_cc
GetMacroValue(main,pf_cc)
Expansion gave (/bin/sh -c /usr/bin/gcc)
ARG[0] /bin/sh -c /usr/bin/gcc --version | head -1 | cut -d\ -f3
cfpopen(/bin/sh -c /usr/bin/gcc --version | head -1 | cut -d\ -f3)
GetExecOutput got: [gcc: no input files]
cfpclose(pp)
The "Expansion gave...." line shows what is actually being executed,
namely gcc with no arguments.
Changing the double quotes to singlequotes in the ExecResult seems to
make cfengine happy, as does rolling back to 2.1.15. In other words,
changing the above snippet to:
control:
pf_cc= "/usr/bin/gcc"
pf_cc_vers= (
ExecResult(/bin/sh -c '${pf_cc} --version | head -1 | cut -d\
-f3')
)
...produces the same results in 2.1.15 as 2.1.16.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine