Recipe: passing pipe character as an argument

23 views
Skip to first unread message

pcrespo

unread,
Sep 1, 2009, 10:19:13 AM9/1/09
to Bitten
Hi,

I have troubles using the | as an argument in a recipe. I would like
write a recipe that can execute a program in the shell as:

foo.exe --config "Deploy|x64"

Unfortunately, I do not manage to implement this instruction in the
recipe. When the slave reads the recipe it seems to neglect the quotes
of the arguments and it interprets that | is a pipe character.

For example, if I write the recipe that prints the arguments:

<build description="Building System"
xmlns:sh="http://bitten.cmlenz.net/tools/sh"

<step id="Example">
<sh:exec file="echo"
args="--config &quot;Deploy|x64&quot;"/>
</step>

</build>

The following error is reported:

[ERROR ] 'x64' is not recognized as an internal or external command

since he expects a command closing the pipe |.

Is there any way to avoid this error or this is a bug?
My version is bitten-slave-script.py 0.6dev-r0

Thank you very much in advance

osimons

unread,
Sep 1, 2009, 5:19:13 PM9/1/09
to Bitten
On Sep 1, 4:19 pm, pcrespo <pedro.crespoval...@gmail.com> wrote:
>  <step id="Example">
>    <sh:exec file="echo"
>                  args="--config &quot;Deploy|x64&quot;"/>
>   </step>

I tried your example step on both OSX and Windows using latest trunk,
and both result in correct echo output from my slave:

--config "Deploy|x64"

> My version is bitten-slave-script.py 0.6dev-r0

Seems you are using Subversion 1.6.x - setuptools cannot parse the
revision number, so it just uses r0 for lack of exact revision. Could
you do a svn checkout of very latest trunk, and run "python setup.py
install" again to make sure you have latest revision?

If the problem persists, then by all means make a ticket for it at the
Bitten project with details.



:::simon

https://www.coderesort.com
http://www.ohloh.net/accounts/osimons

John Hampton

unread,
Sep 1, 2009, 5:43:22 PM9/1/09
to bit...@googlegroups.com
osimons wrote:

> Seems you are using Subversion 1.6.x - setuptools cannot parse the
> revision number, so it just uses r0 for lack of exact revision. Could

FYI, the ticket to address the setuptools issue is:

http://bugs.python.org/setuptools/issue64

The svn_versioning_4.patch does fix the issue. However, it requires one
to checkout the setuptools code from subversion and apply the patch.

Here is to hoping that they fix the bug soon.

-John

pcrespo

unread,
Sep 2, 2009, 10:36:59 AM9/2/09
to Bitten
Simon, thanks for your answer.

Please, let me comment

> Seems you are using Subversion 1.6.x - setuptools cannot parse the
> revision number, so it just uses r0 for lack of exact revision. Could
> you do a svn checkout of very latest trunk, and run "python setup.py
> install" again to make sure you have latest revision?

I uninstalled bitten and re-installed the latest trunk as you
suggested.


Then I did the follow steps:

a) Wrote the following recipe into example_recipe.xml:

<build description="Building System"
xmlns:sh="http://bitten.cmlenz.net/tools/sh" >
<step id="Example">
<sh:exec file="echo" args="--config &quot;Deploy-x64&quot;"/>
<sh:exec file="echo" args="--config &quot;Deploy|x64&quot;"/>
<sh:exec file="echo" args="--config &quot;Deploy&#124;x64&quot;"/>
</step>
</build>

b) Run within the same folder bitten-slave as

bitten-slave example_recipe.xml


c) In OSX, it prints

--config Deploy-x64
--config Deploy|x64
--config Deploy|x64

but *neglects* the quotes!

In Windows (two different installations) it prints errors and again,
it neglects the quote characters

C:\Development\Projects\Slave\recipes>bitten-slave example_recipe.xml
[INFO ] Slave launched at 2009-09-02 16:21:19
[INFO ] Executing build step 'Example'
[INFO ] --config Deploy-x64
[ERROR ] 'x64' is not recognized as an internal or external command,
[ERROR ] operable program or batch file.
[ERROR ] 'x64' is not recognized as an internal or external command,
[ERROR ] operable program or batch file.
[ERROR ] Executing echo failed (error code 255)
[ERROR ] Executing echo failed (error code 255)
[ERROR ] Build step 'Example' failed
[WARNING ] Stopping build due to failure
[INFO ] Slave exited at 2009-09-02 16:21:20

Am I missing something??

Thanks


osimons

unread,
Sep 2, 2009, 12:01:07 PM9/2/09
to Bitten
On Sep 2, 4:36 pm, pcrespo <pedro.crespoval...@gmail.com> wrote:
> I uninstalled bitten and re-installed the latest trunk as you
> suggested.
>
> Then I did the follow steps:
>
> a) Wrote the following recipe into example_recipe.xml:
>
>  <step id="Example">
>    <sh:exec file="echo" args="--config &quot;Deploy-x64&quot;"/>
>    <sh:exec file="echo" args="--config &quot;Deploy|x64&quot;"/>
>    <sh:exec file="echo" args="--config &quot;Deploy&#124;x64&quot;"/>
>   </step>
>
> b) Run within the same folder bitten-slave as
>
> bitten-slave example_recipe.xml

I'm running mine against a test server, not using local execution that
I have seen before may not yield identical results. Running your step,
here is what I get in logs:

Windows:
--config Deploy-x64
--config "Deploy|x64"
--config "Deploy|x64"

OSX:
--config Deploy-x64
--config Deploy|x64
--config Deploy|x64

=> So, OSX (posix) seems to drop the quotes as you indicate.

I use -v on command-line to turn on verbose logging from the slave -
it gives additional output. Mine shows OSX executing:

[DEBUG ] Executing ['echo', '--config', 'Deploy-x64'], (pid = 3140)
[INFO ] --config Deploy-x64

With Windows looking identical

[DEBUG ] Executing ['echo', '--config', 'Deploy-x64'], (pid = 2832)
[INFO ] --config Deploy-x64

- but Windows still then includes the quotes in the output... So, it
looks like that is some difference in how echo works on the platforms
handle arguments and quotes. Quotes are after all used to split
arguments, and we do call the regular shlex.split() to split
arguments. To have the quotes carry meaning, what I did was to escape
them:

<sh:exec file="echo" args="--config \&quot;Deploy|x64\&quot;"/>

Then OSX also included the quotes in output: --config "Deploy|x64"

... which of course did not work on Windows:

'x64\""' is not recognized as an internal or external command,
operable program or batch file.

That's all I got for now - like you I'll be interested in finding the
correct way to handle this cross-platform, including patching Bitten
if anyone has good ideas for how to make this work consistently.

pcrespo

unread,
Sep 3, 2009, 12:41:08 PM9/3/09
to Bitten
yeh, I do not manage to make it work. It is a bit frustrating since I
cannot run ms devenv.exe to compile my code using bitten :-(

For the moment, I created a ticket http://bitten.edgewall.org/ticket/441

Ole Trenner

unread,
Sep 3, 2009, 3:06:50 PM9/3/09
to bit...@googlegroups.com
Am 03.09.2009 um 18:41 schrieb pcrespo:
> yeh, I do not manage to make it work. It is a bit frustrating since I
> cannot run ms devenv.exe to compile my code using bitten :-(

Just a thought... as a workaround you might want to try to include a
batch file containing the offensive command into your repository and
just to call it from the recipe. This works around most of bitten's
idiosyncrasies.

Cheers,
Ole.


--
Ole Trenner
<o...@jayotee.de>


osimons

unread,
Sep 3, 2009, 5:37:13 PM9/3/09
to Bitten
On Sep 3, 6:41 pm, pcrespo <pedro.crespoval...@gmail.com> wrote:
> yeh, I do not manage to make it work. It is a bit frustrating since I
> cannot run ms devenv.exe to compile my code using bitten :-(
>
> For the moment, I created a tickethttp://bitten.edgewall.org/ticket/441
>

Check the ticket again - it all makes sense to me now, and hopefully
others can verify.

osimons

unread,
Sep 4, 2009, 8:23:34 PM9/4/09
to Bitten
On Sep 3, 11:37 pm, osimons <oddsim...@gmail.com> wrote:
> On Sep 3, 6:41 pm, pcrespo <pedro.crespoval...@gmail.com> wrote:
>
> > yeh, I do not manage to make it work. It is a bit frustrating since I
> > cannot run ms devenv.exe to compile my code using bitten :-(
>
> > For the moment, I created a tickethttp://bitten.edgewall.org/ticket/441
>
> Check the ticket again - it all makes sense to me now, and hopefully
> others can verify.

I've committted it in http://bitten.edgewall.org/changeset/745 -
please update to latest trunk and try again, following the updated
documentation on quoting and escaping that is part of the changeset.


:::simon
Reply all
Reply to author
Forward
0 new messages