RESOLVED FIXED Bug 53822
test-webkitpy crashes with a WindowsError when run under Win32 Python
https://bugs.webkit.org/show_bug.cgi?id=53822
Summary test-webkitpy crashes with a WindowsError when run under Win32 Python
Tony Chang
Reported 2011-02-04 15:56:59 PST
get test-webkitpy running on win32 python
Attachments
Patch (2.76 KB, patch)
2011-02-04 15:59 PST, Tony Chang
no flags
Tony Chang
Comment 1 2011-02-04 15:59:05 PST
Tony Chang
Comment 2 2011-02-04 15:59:34 PST
Eric Seidel (no email)
Comment 3 2011-02-04 16:12:30 PST
Comment on attachment 81312 [details] Patch I guess. Shell is *evil*. I suspect this will cause other troubles.
Eric Seidel (no email)
Comment 4 2011-02-04 16:13:31 PST
Comment on attachment 81312 [details] Patch Should we do our own path resolution instead? I feel like at some other point I needed/wanted a "which" command written in python. I guess if we don't use a shell, we won't get the environment in which PATH is defined anyway.
Evan Martin
Comment 5 2011-02-04 16:27:03 PST
FWIW, I would guess eseidel's dislike of going through a shell because of quoting issues, but on on Windows the low-level process creation API takes a string so you need to get quoting right anyway (http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx). Python implicitly converts the array of args to a quoted command line for you on Windows. Passing shell=True on Windows is pretty standard in Python code I see, though I admit it's all within a small circle of people.
Tony Chang
Comment 6 2011-02-04 16:30:25 PST
Mid-air conflict while I was writing pretty much what Evan wrote. The only thing I have to add is that since we expect subprocess.Popen to include the environment on other platforms, it seems to be semantically consistent to for us to use shell=True on Windows. Although in practice, maybe we don't need the environment to be copied to subprocesses. *shrug*
Eric Seidel (no email)
Comment 7 2011-02-04 16:35:14 PST
We've talked about creating our own POpen subclass to fix some of the popen bugs we work-around in Executive. This might be further (mild) motivation for such.
Adam Roben (:aroben)
Comment 8 2011-02-04 17:22:14 PST
I don't remember running into this problem back when I was working on getting test-webkitpy working with Win32 Python. But test-webkitpy has undoubtedly changed since then.
Adam Roben (:aroben)
Comment 9 2011-02-04 17:23:49 PST
The subprocess docs say this: The only reason you would need to specify shell=True on Windows is where the command you wish to execute is actually built in to the shell, eg dir, copy. You don’t need shell=True to run a batch file, nor to run a console-based executable. http://docs.python.org/library/subprocess.html#using-the-subprocess-module So…are the docs wrong? Is there some other reason you'd have to pass shell=True on Windows?
WebKit Commit Bot
Comment 10 2011-02-04 18:39:14 PST
Comment on attachment 81312 [details] Patch Clearing flags on attachment: 81312 Committed r77720: <http://trac.webkit.org/changeset/77720>
WebKit Commit Bot
Comment 11 2011-02-04 18:39:20 PST
All reviewed patches have been landed. Closing bug.
WebKit Commit Bot
Comment 12 2011-02-04 19:18:37 PST
The commit-queue encountered the following flaky tests while processing attachment 81312 [details]: http/tests/websocket/tests/send-throw.html bug 53834 (author: abarth@webkit.org) The commit-queue is continuing to process your patch.
WebKit Review Bot
Comment 13 2011-02-04 19:43:24 PST
http://trac.webkit.org/changeset/77720 might have broken GTK Linux 64-bit Debug
Tony Chang
Comment 14 2011-02-07 09:22:11 PST
(In reply to comment #9) > The subprocess docs say this: > > The only reason you would need to specify shell=True on Windows is where the command you wish to execute is actually built in to the shell, eg dir, copy. You don’t need shell=True to run a batch file, nor to run a console-based executable. > > http://docs.python.org/library/subprocess.html#using-the-subprocess-module > > So…are the docs wrong? Is there some other reason you'd have to pass shell=True on Windows? The docs are correct, it just doesn't enumerate all the reasons to use the shell on Windows. We needed it to search the path for things like 'svn' or 'ruby'. Here's the python bug tracking the difference: http://bugs.python.org/issue8557 Anyway, this was rolled out because when shell=True and the command isn't found, we raise ScriptError rather then OSError.
Eric Seidel (no email)
Comment 15 2011-02-07 12:44:10 PST
ScriptError was originally creaed as part of scm.py to indicate when git/svn returned non-zero. These days it's used for more than that I fear. But still we should return OSError when we can't find a command instead of ScriptError.
Tony Chang
Comment 16 2011-02-07 14:10:26 PST
(In reply to comment #15) > But still we should return OSError when we can't find a command instead of ScriptError. Hmm, I'm not sure how to do this. The return code is 1, but that doesn't always mean that the command wasn't found. I could search the command output to see if the command wasn't found, but I suspect for non-English versions of Windows, the text will differ. Eric's original suggestion of writing our own path resolution is possible (it's a cross product of PATH and PATHEXT), but I worry that we'll get it wrong. E.g., is it possible for other environment variables to be in %PATH%? What are the rules for case insensitivity?
Fujii Hironori
Comment 17 2024-09-23 19:14:23 PDT
no problem with Windows Python nowadays.
Radar WebKit Bug Importer
Comment 18 2024-09-23 19:15:15 PDT
Note You need to log in before you can comment on or make changes to this bug.