We've always just avoided problems with quotes by using $(dblquote) instead of ".

Paul Krizak                         5900 E. Ben White Blvd. MS 625
Advanced Micro Devies              Austin, Tx  78741
CAD Systems Engineering             Phone: (512) 602-8775
[EMAIL PROTECTED]


Chip Seraphine wrote:
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



_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to