[Buildbot] #2878: Windows escaping seem to produce problems

Buildbot trac trac at buildbot.net
Wed Mar 9 22:57:54 UTC 2016

#2878: Windows escaping seem to produce problems
Reporter:  sa2ajj   |       Owner:
    Type:  defect   |      Status:  new
Priority:  major    |   Milestone:  0.9.+
 Version:  0.8.9    |  Resolution:
Keywords:  windows  |

Comment (by shoelzer):

 This is still a problem in Buildbot 0.8.12. I worked around it by
 modifying the "win32_batch_quote" function in buildslave\runprocess.py. I
 made two changes:

 1. Added a special case so "&&" is not escaped.
 2. Allowed environment variable expansion by not changing "%" characters
 to "%%".

 I'm not saying this is the right way to do it but it's working for me.
 Here is the complete function I'm using now:

 def win32_batch_quote(cmd_list):
     def escape_arg(arg):
         if arg == '|':
             return arg

         if arg == '&&':
             return arg

         arg = quoteArguments([arg])
         # escape shell special characters
         arg = re.sub(r'[@()^"<>&|]', r'^\g<0>', arg)
         return arg

     return ' '.join(map(escape_arg, cmd_list))

Ticket URL: <http://trac.buildbot.net/ticket/2878#comment:16>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation

More information about the bugs mailing list