msg63583 - (view) |
Author: Tim Golden (tim.golden) *  |
Date: 2008-03-16 16:32 |
The subprocess.Popen function reorganises the command line for process
creation when shell=True is passed in under Windows. It runs the
existing executable & arguments as arguments to %COMSPEC% /c. However
this fails when a second parameter (typically a filename) has an
embedded space. The patch attached adds extra parameters in this case
and adds appropriate unit tests.
Frankly I'm new to unittests and I more-or-less cloned an existing one
to make this work. Happy to be corrected if there's things done wrong &c.
|
msg63610 - (view) |
Author: Gabriel Genellina (ggenellina) |
Date: 2008-03-17 00:59 |
You aren't testing the modified code, the Popen call should say
shell=True.
I think that a more PEP8-compliant style would be nice (removing the
spaces after open and read, and using consistent indentation)
|
msg63623 - (view) |
Author: Tim Golden (tim.golden) *  |
Date: 2008-03-17 08:08 |
Gabriel Genellina wrote:
> Gabriel Genellina <gagsl-py2@yahoo.com.ar> added the comment:
>
> You aren't testing the modified code, the Popen call should say
> shell=True.
>
> I think that a more PEP8-compliant style would be nice (removing the
> spaces after open and read, and using consistent indentation)
D'oh. Thanks, Gabriel. I'll rework the test and tidy
up the patch.
|
msg63907 - (view) |
Author: Tim Golden (tim.golden) *  |
Date: 2008-03-18 10:37 |
Updated patch against r61514. Test code now PEP8-compliant (I hope). New
tests cover spaces in command and parameter with and without shell=True,
both as simple command string and as list of command/args.
|
msg95284 - (view) |
Author: Gabriel Genellina (ggenellina) |
Date: 2009-11-15 10:46 |
An up-to-date patch; same contents, but this one can be cleanly
applied to trunk (as of r76294)
|
msg95328 - (view) |
Author: David Fraser (davidfraser) |
Date: 2009-11-16 08:44 |
This is closely related to http://bugs.python.org/issue6689
|
msg111352 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-07-23 16:05 |
@Tim: @Gabriel: test_subprocess has changed a lot since the patch was done. If one of you could provide a new patch for 2.7 and py3k I'll test it, thanks.
|
msg113279 - (view) |
Author: Tim Golden (tim.golden) *  |
Date: 2010-08-08 16:21 |
Committed as r83830, r83831, r83832
|
msg113299 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2010-08-08 19:09 |
Reverted because of test-breakage on unixes.
|
msg113674 - (view) |
Author: Tim Golden (tim.golden) *  |
Date: 2010-08-12 12:35 |
ReComitted as r83947, r83956, r83957 and this time the buildbots look happy. (At least as regards this change).
|
msg120727 - (view) |
Author: Weeble (weeble) |
Date: 2010-11-08 10:58 |
Is there any way to write code that's safe with or without this fix? If I have code that currently does this:
subprocess.check_call('""c:\some path with spaces" arg1 arg2 "a quoted arg""', shell=True)
...will it break when running on a version of Python with this fix? Is there any good way to detect whether the running Python has this fix or not?
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:31 | admin | set | github: 46557 |
2010-11-08 10:58:28 | weeble | set | nosy:
+ weeble messages:
+ msg120727
|
2010-08-12 12:35:49 | tim.golden | set | status: open -> closed resolution: fixed messages:
+ msg113674
|
2010-08-08 19:09:53 | benjamin.peterson | set | status: closed -> open
nosy:
+ benjamin.peterson messages:
+ msg113299
resolution: fixed -> (no value) |
2010-08-08 16:21:35 | tim.golden | set | status: open -> closed resolution: fixed messages:
+ msg113279
stage: patch review -> resolved |
2010-08-06 15:45:31 | tim.golden | set | assignee: tim.golden components:
+ Windows nosy:
davidfraser, ggenellina, dstanek, tim.golden, BreamoreBoy |
2010-07-31 17:40:45 | dstanek | set | nosy:
+ dstanek
|
2010-07-23 16:05:20 | BreamoreBoy | set | nosy:
+ BreamoreBoy
messages:
+ msg111352 versions:
- Python 2.6 |
2009-11-16 08:44:30 | davidfraser | set | messages:
+ msg95328 |
2009-11-15 10:46:54 | ggenellina | set | files:
+ subprocess.diff
messages:
+ msg95284 versions:
+ Python 3.1, Python 2.7, Python 3.2 |
2009-08-12 07:33:27 | davidfraser | set | nosy:
+ davidfraser
|
2009-04-07 23:13:40 | tleeuwenburg@gmail.com | set | stage: patch review |
2008-03-18 10:37:19 | tim.golden | set | files:
+ subprocess-r61514.patch messages:
+ msg63907 |
2008-03-17 08:08:41 | tim.golden | set | messages:
+ msg63623 title: subprocess under windows fails to quote properly when shell=True -> subprocess under windows fails to quote properly when shell=True |
2008-03-17 00:59:31 | ggenellina | set | nosy:
+ ggenellina messages:
+ msg63610 |
2008-03-16 16:36:27 | tim.golden | set | title: subprocess under windows fails to quote properly under Windows when shell=True -> subprocess under windows fails to quote properly when shell=True |
2008-03-16 16:32:18 | tim.golden | create | |