I'm still having issues with the quotation rules for ReturnsZero, though
I did find a workaround. I am trying to embed a command like:

    /bin/sh -c "/usr/bin/python -c \"import asdf\""

But I don't seem to be able to get the backslashes down to the shell. I
would expect this to work, escaping the backslashes, as it does in C:

    ReturnsZero("/bin/sh -c \"${python} -c \\\"import asdf\\\"\"")

But it does not. With an echo on the front, it seems clear that the parser
is not being greedy enough, as the output I get is:

    /usr/local/bin/python -c \

So it is throwing away everything after the underlined section:

    ReturnsZero("/bin/sh -c \"${python} -c \\\"import asdf\\\"\"")
                            ^^^^^^^^^^^^^^^^^^^

I did find that the following works:

    ReturnsZero("/bin/sh -c \"${python} -c ${quote}import asdf${quote}\"")

So maybe there is a bug with escaping backslashes.

I guess I will add a paragraph to my best practices document saying that
one should avoid complicated escaping. It is hard to read, anyways.

Best,
Brendan

--
Senior System Administrator
The University of Chicago
Department of Computer Science

http://www.cs.uchicago.edu/people/brendan
http://praksys.blogspot.com/


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

Reply via email to