[Buildbot-devel] Annoying behavior for ShellCommand under Win32

fabrice fabrice fcrestois at hotmail.com
Wed Jan 27 21:01:19 UTC 2010


Hello jean Paul thanks for publishing updated link 
 
I don’t like to re-open the “windows quoted mess” thread
 
Buidbot does nothing at the “quoting” level
 
if runtime.platformType  == 'win32':
  argv = os.environ['COMSPEC'].split() # allow %COMSPEC% to have args
  if '/c' not in argv: argv += ['/c']
  argv += [self.command]
 
p = reactor. spawnProcess (self.pp, argv[0], argv,
                         self.environ,
                         self.workdir,
                         usePTY=self.usePTY)
 
But because the “spawned process” is CMD, the quoted rules must be the 
  7.  The cmd.exe Command Prompt Parsing Rules (thanks for the link Http://www.autohotkey.net/~deleyd/parameters/parameters.htm) 
 
Twisted don’t give the choice of not quoting or quoting rules
 
Twisted choice the CreateProcess() quoting rules that make sense
 
How to write the command line argument to have the expected behaviors ?

C:\>C:\WINDOWS\system32\cmd.exe /c echo "quote|pipe"
"quote|pipe"
 
Could we have a “Not quoted” choice (like subprocess.Popen) ?
or what is the “pythonic” way to change this behavior without patching the twisted files 
or a better way to call spawnProcess from Buildbot to have CMD.exe args working
 
Fabrice

 
> From: exarkun at twistedmatrix.com
> To: fcrestois at hotmail.com; buildbot-devel at lists.sourceforge.net
> Subject: Re: [Buildbot-devel] Annoying behavior for ShellCommand under Win32
> Date: Wed, 27 Jan 2010 19:44:49 +0000
> 
> On 07:12 pm, fcrestois at hotmail.com wrote:
> >
> >I am integrating Buildbot 7.12 with Python 2.6 and Twisted 8.2 under 
> >Windows XP
> >And I find the same annoying behavior than BuildBot 7.5 with Python 2.4 
> >and Twisted 2.4
> >
> >For windows user, It is very convenient to start directly the 
> >VisualStudio devenv command line to make a build
> >This command line have a parameters like 1Cplateform|configuration 1D
> >
> >If I run a simple build factory with a shell command step like
> >
> >from buildbot.steps.shell import ShellCommand
> >factory.addStep(ShellCommand(command=r'echo "Win32|Release"'))
> >
> >The stdio display the wrong result \"Win32|Release\"
> >
> >The problem come from the function cmdLineQuote(s) from 
> >twisted\python\win32.py
> >The 1Cquoting under windows 1D thread is a 5 years old bug : 
> >http://twistedmatrix.com/trac/ticket/1123
> 
> Thanks for pointing this out. I was going to point you at this buildbot 
> ticket:
> 
> http://buildbot.net/trac/ticket/377
> 
> which itself refers to another ticket in the Twisted tracker:
> 
> http://twistedmatrix.com/trac/ticket/3933
> 
> which is closed as invalid. I think #3933 was a duplicate of #1123, so 
> I'm going to go close #1123 as invalid now as well.
> 
> Here's my conclusion from ticket #3933:
> 
> Okay, so after some more careful investigation, including tracking down 
> the source of this report to http://buildbot.net/trac/ticket/377 and far 
> more time than I really cared to spend reading documentation about 
> Windows brain damage, my conclusion is that this isn't a valid bug.
> 
> The API Twisted wraps, CreateProcess, does not require | to be quoted. 
> Quoting does no harm, but neither does it do any good. Instead, it is 
> certain other programs which have quoting rules of which Twisted is 
> presently unaware. For example, cmd.exe does require | to be quoted. 
> spawnProcess is the wrong place to fix cmd.exe quoting issues, though. 
> Instead, if a nice, error-resistant cmd.exe-invocation API is desired, 
> it should be layered on top of spawnProcess and the appropriate quoting 
> rules added there.
> 
> I still think this is true. BuildBot is providing an API for invoking 
> cmd.exe, apparently. This means the quoting rules belong somewhere in 
> BuildBot. I'm not familiar enough with BuildBot's command running code 
> to say exactly where this belongs, though.
> 
> Jean-Paul
 		 	   		  
_________________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20100127/c0123868/attachment.html>


More information about the devel mailing list