[Buildbot-devel] Using wildcards in a ShellCommand shell script

Martin Geisler mg at daimi.au.dk
Tue Apr 8 16:55:03 UTC 2008

"J. Félix Ontañón" <fontanon-WPHsDXFj2EXe5aOfsHch1g at public.gmane.org> writes:

> What is then the meaning of pass shell commands as a list of strings?
> Reading 6.1.3 in BuildBot Manual i can't see why this is useful.

Invoking the command using a list of strings means that you don't have
to pay attention to escaping special characters like ' ', '*', etc. You
can have a command like

  command = ['ls', 'filename with spaces']

and 'ls' will then really lookup a file called "filename with spaces"
instead of trying to lookup three files called "filename", "with", and
"spaces", respectively.

Also if "fname" is a Python variable holding some string, then

  command = ['ls', fname]

is safe, even if the string is something bad like "foo; rm -rf /", which
would run the rm command if you had done this instead

  command = 'ls %s' % fname

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20080408/6be4e30c/attachment.bin>

More information about the devel mailing list