help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quotes make a difference in 2.1.16


From: Chip Seraphine
Subject: Quotes make a difference in 2.1.16
Date: Wed, 12 Oct 2005 13:09:56 -0500
User-agent: Mozilla Thunderbird 1.0.5 (X11/20050711)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]