http://bugs.winehq.org/show_bug.cgi?id=21338
Summary: cmd needs to set COMSPEC, PATHEXT, and PROMPT environment variables Product: Wine Version: unspecified Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd AssignedTo: wine-bugs@winehq.org ReportedBy: dima@gmail.com
In Windows XP, if I start "cmd /c set" with an empty environment, I always get these variables:
COMSPEC=C:\WINDOWS\system32\cmd.exe PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS PROMPT=$P$G
In Wine, however, cmd prints nothing. (I guess Wine sets those variables only on startup, while Windows sets them in every instance of cmd.)
I tested it by running this Python script:
import subprocess subprocess.Popen(["cmd", "/c", "set"], env={}).communicate()
(It just runs CreateProcess with "\0" as the environment, as far as I understand.)
The problem I'm running into is: I run SCons, which starts a new Python script in a mostly empty environment. The Python script calls os.popen, which relies on COMSPEC to find "cmd.exe", and therefore fails.
http://bugs.winehq.org/show_bug.cgi?id=21338
Andrew Nguyen arethusa26@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |minor
--- Comment #1 from Andrew Nguyen arethusa26@gmail.com 2010-01-11 22:48:30 --- Please specify your Wine version. Those environment variables should be set in wine-1.1.36.
http://bugs.winehq.org/show_bug.cgi?id=21338
Dima Ryazanov dima@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.1.36
--- Comment #2 from Dima Ryazanov dima@gmail.com 2010-01-11 22:50:26 --- Oh sorry. I am using Wine 1.1.36, built from git.
http://bugs.winehq.org/show_bug.cgi?id=21338
--- Comment #3 from Jeff Zaroyko jeffz@jeffz.name 2010-01-11 22:57:47 --- wine-1.1.36 has ComSpec, PATHEXT, and PROMPT.
scons must be failing for some other reason, can you link to the version of scons you are using, the error message and terminal output?
http://bugs.winehq.org/show_bug.cgi?id=21338
--- Comment #4 from Dima Ryazanov dima@gmail.com 2010-01-11 23:08:07 --- I'm using SCons version v1.2.0.r3842.
Here's my SConstruct:
env = Environment() env.Command("foo", "", "C:/Python26/python temp.py")
temp.py:
import os os.popen("dir")
And the output:
scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... C:/Python26/python temp.py Traceback (most recent call last): File "temp.py", line 2, in <module> os.popen("dir") RuntimeError: Cannot locate a COMSPEC environment variable to use as the shell scons: *** [foo] Error 1 scons: building terminated because of errors.
I can try to come up with a simple C testcase, if that helps.
http://bugs.winehq.org/show_bug.cgi?id=21338
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|cmd needs to set COMSPEC, |scons cannot locate a |PATHEXT, and PROMPT |COMSPEC environment |environment variables |variable
http://bugs.winehq.org/show_bug.cgi?id=21338
--- Comment #5 from Dima Ryazanov dima@gmail.com 2010-01-11 23:23:30 --- Created an attachment (id=25687) --> (http://bugs.winehq.org/attachment.cgi?id=25687) Test case
On Windows XP, it prints: C:\WINDOWS\system32\cmd.exe
On Wine, it prints: %COMSPEC%
http://bugs.winehq.org/show_bug.cgi?id=21338
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|scons cannot locate a |cmd needs to set COMSPEC, |COMSPEC environment |PATHEXT, and PROMPT |variable |environment variables on | |startup
--- Comment #6 from Jeff Zaroyko jeffz@jeffz.name 2010-01-11 23:57:54 --- (In reply to comment #5)
Created an attachment (id=25687)
--> (http://bugs.winehq.org/attachment.cgi?id=25687) [details]
Test case
On Windows XP, it prints: C:\WINDOWS\system32\cmd.exe
On Wine, it prints: %COMSPEC%
You're right, cmd sets them if they're unset when it starts. Revising summary again.
http://bugs.winehq.org/show_bug.cgi?id=21338
--- Comment #7 from Dima Ryazanov dima@gmail.com 2010-01-12 10:14:20 --- Created an attachment (id=25697) --> (http://bugs.winehq.org/attachment.cgi?id=25697) Patch
It's a little redundant, but I'm not sure what's the best way to fix that: - WCMD_show_prompt sets a default PROMPT if it's missing - but this isn't needed anymore. However, the user could theoretically make PROMPT longer than MAX_PATH, so this case still needs to be handled. - WCMD_run_program sets a default PATHEXT, same as above.
http://bugs.winehq.org/show_bug.cgi?id=21338
Andrew Nguyen arethusa26@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, testcase
http://bugs.winehq.org/show_bug.cgi?id=21338
Frédéric Delanoy frederic.delanoy@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |frederic.delanoy@gmail.com Resolution| |FIXED
--- Comment #8 from Frédéric Delanoy frederic.delanoy@gmail.com 2011-07-14 11:41:08 CDT --- Works in 1.3.24 Please advise if you still have the issue.
http://bugs.winehq.org/show_bug.cgi?id=21338
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2011-07-22 12:43:18 CDT --- Closing bugs fixed in 1.3.25.