[Top][All Lists]

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

Re: quoting and parentheses in ExecResult?

From: Knut Auvor Grythe
Subject: Re: quoting and parentheses in ExecResult?
Date: Mon, 15 Aug 2005 01:22:03 +0200
User-agent: Mutt/1.5.6i

On Mon, Aug 15, 2005 at 10:29:34AM +1200, Steve Wray wrote:
> I get the feeling that the problem is somehow in the way that cfengine
> parses the parentheses, even though they are within double quotes,
> passed to a shell.

You're probably right. I believe cfengine ignores these quotes, since
they are not meant to be parsed by cfengine anyway. I am only surprised
that the remainder of the string is not causing a parse error. I think
it ought to barf on that if our assumptions about the parser are

It might help to quote the entire string. Like this:

  someresult = ( ExecResult("/bin/sh -c '/bin/echo baz|/bin/sed -e 

That way cfengine should read this as a single string all the way to the
next unescaped double quote (and naturally unescape the quotes inside
when running the command).

Older versions of cfengine seem to not like quoting of the entire
string, but this seems to be fixed in newer versions. Upgrading might be
worth a shot if you're still on an older version.

I used ticks instead of double quotes around the argument to /bin/sh, so
it wouldn't be necessary with so much escaping. 

I assume the missing -c to /bin/sh and the unnecessary parentheses in
the regex occured when creating a simplified example, and that they are
unrelated to the problem. But you might want to check for them in the
real problem as well.

Knut Auvor Grythe
ITEA Systemdrift

reply via email to

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