Message224512
| Author |
eryksun |
| Recipients |
asvetlov, chris.jerdonek, christian.heimes, eric.araujo, eryksun, ezio.melotti, gregory.p.smith, lyapun, neologix, pitrou, r.david.murray, serhiy.storchaka |
| Date |
2014年08月01日.17:51:34 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1406915494.57.0.661057749301.issue16353@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Defaulting to just "cmd.exe" can execute an arbitrary program named "cmd.exe" in the application directory or current directory.
When CreateProcess needs to find the shell to execute a batch file (.bat or .cmd), it doesn't search for "cmd.exe" -- at least not in NT 6. If ComSpec isn't set, it defaults to "%SystemRoot%\system32\cmd.exe". If both ComSpec and SystemRoot are unset, executing a batch file via CreateProcess fails with ERROR_DIRECTORY.
I think Python should use the same default path if it's ignoring ComSpec:
default_shell = path.join(environ["SystemRoot"], "system32", "cmd.exe")
A KeyError shouldn't be a problem here. CPython won't even run if SystemRoot isn't set to the correct path:
C:\>set SystemRoot=
C:\>py -3
Fatal Python error: Failed to initialize Windows random API (CryptoGen) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年08月01日 17:51:34 | eryksun | set | recipients:
+ eryksun, gregory.p.smith, pitrou, christian.heimes, ezio.melotti, eric.araujo, r.david.murray, asvetlov, chris.jerdonek, neologix, serhiy.storchaka, lyapun |
| 2014年08月01日 17:51:34 | eryksun | set | messageid: <1406915494.57.0.661057749301.issue16353@psf.upfronthosting.co.za> |
| 2014年08月01日 17:51:34 | eryksun | link | issue16353 messages |
| 2014年08月01日 17:51:34 | eryksun | create |
|