Bug in ${const.dollar}( ... )
Jean-Noël Rivasseau <[email protected]> Thu, 10 Dec 2009 08:30:00 -0800
| Newsgroups | gmane.comp.sysutils.cfengine.bugs |
|---|---|
| Message-ID | <[email protected]> |
--===============1881595544==
Content-Type: multipart/alternative; boundary=0015175cd1628d41bb047a6251d0
--0015175cd1628d41bb047a6251d0
Content-Type: text/plain; charset=UTF-8
Hello, I discussed this issue in the help ML before but it really appears
like it is a bug.
Basically, cf-engine chokes on ${const.dollar}( ... ) in command strings
passed to returnszero function. However $() in a shell (Bash) can be very
useful as it triggers a subshell. There is a bug in the parser somewhere as
this example demonstrates:
body common control
{
bundlesequence => {"configurePhase"};
}
bundle agent configurePhase
{
classes:
"MyClass" expression => returnszero("/bin/echo
${const.dollar}(cat /etc/hosts)", "useshell");
"MyClass2" expression => returnszero("/bin/echo `cat
/etc/hosts`", "useshell");
reports:
MyClass::
"Hi World";
MyClass2::
"Hello World";
}
MyClass2 will correctly be defined, but not MyClass as cf-engine will refuse
to run the first command - the parser gets confused and attempts to solve
'cat /etc/hosts' as a variable it seems. I checked this on today's SVN and
the problem is still present. Please correct it :)
Cheers
Jean-Noel
--0015175cd1628d41bb047a6251d0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hello, I discussed this issue in the help ML before but it really appears l=
ike it is a bug.<br><br>Basically, cf-engine chokes on ${const.dollar}( ...=
) in command strings passed to returnszero function. However $() in a shel=
l (Bash) can be very useful as it triggers a subshell. There is a bug in th=
e parser somewhere as this example demonstrates:<br>
<br>body common control<br>{<br>=C2=A0=C2=A0=C2=A0 bundlesequence =3D> {=
"configurePhase"};<br>}<br><br>bundle agent configurePhase<br>{<b=
r>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 classes:<br>=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &q=
uot;MyClass" expression =3D> returnszero("/bin/echo ${const.do=
llar}(cat /etc/hosts)", "useshell");<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 "MyClass2" expression =3D> returnszero("/=
bin/echo `cat /etc/hosts`", "useshell");<br>=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 reports:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 MyClass::<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Hi World";<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MyClass2::<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 "Hello World";<br>}<br><br><br>MyClass2 will corr=
ectly be defined, but not MyClass as cf-engine will refuse to run the first=
command - the parser gets confused and attempts to solve 'cat /etc/hos=
ts' as a variable it seems. I checked this on today's SVN and the p=
roblem is still present. Please correct it :)<br>
<br>Cheers<br>Jean-Noel<br>
--0015175cd1628d41bb047a6251d0--
--===============1881595544==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine
--===============1881595544==--