[Buildbot-devel] ShellCommand is failing when running with certain parameter

Charles Lepple clepple at gmail.com
Thu Aug 22 13:31:04 UTC 2013


On Aug 22, 2013, at 8:52 AM, Maria Marcano wrote:

> but I'm not sure how to fix this on the slave side because how could we distinguish from running 
> 
> something like echo %username%  (were we don't need to escape %) or a command like  git log --format=%H -1 -- (where we need to escape)

It isn't exactly the same situation (due to quoting), but on non-Windows systems, passing a single string means "let the shell interpret the command" (akin to calling system() in C with a string), whereas passing a list of strings means "assign each string to an element of argv without interpretation" (like passing a list to exec*()). There is code in Buildbot to emulate these semantics on Windows as well (see lines 416-426 in runprocess.py).

So at first glance, I'd say your code for converting '%' to '%%' could go in the Windows list-of-strings portion, and otherwise, '%' would be passed to the shell so that environment variables could be expanded on the slave side. It sounds like you would still keep the git command line as a list of strings, and that should work on all platforms. I don't have a Windows system handy to test any of the other corner cases, though.

-- 
Charles Lepple
clepple at gmail







More information about the devel mailing list