[Bug 2298] New: wine messes up child process environment
Wine Bugs
wine-bugs at winehq.org
Fri Jun 18 13:12:22 CDT 2004
http://bugs.winehq.org/show_bug.cgi?id=2298
Summary: wine messes up child process environment
Product: Wine
Version: 20040309
Platform: PC
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: wine-kernel
AssignedTo: wine-bugs at winehq.org
ReportedBy: xavim at ubxlab.com
CC: xavim at ubxlab.com
When a process calls CreateProcessA (or its C runtime library wrapper _spawn*)
to invoke a child process with a newly generated environment, wine modifies this
environment before passing it to the child.
Namely, it adds entries for HOME, COMSPEC, PATH, TEMP, TMP, windir and winsysdir
variables.
This behaviour is incompatible with Windows, as the following example shows:
<code filename="parent.c">
#include <process.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
char *child_env[] = {
"entry_0",
"entry_1",
"entry_2",
NULL
};
char cmdname[] = "child.exe";
printf("Parent started.\n");
_spawnle(_P_WAIT, cmdname, cmdname, NULL, child_env);
return 0;
}
</code>
<code filename="child.c">
#include <stdio.h>
#include <stdlib.h>
static void print_env(char **env);
int
main(int argc, char *argv[])
{
printf("Child started.\n");
printf("In child: ");
print_env(_environ);
return 0;
}
static void
print_env(char **env)
{
printf("env = [ ");
if (env != NULL) {
while (*env != NULL) {
printf("%s, ", *env);
++env;
}
}
printf("]\n");
}
</code>
After compiling these two programs with MinGW under Win98SE, we get the
following output:
Running in Win98 (SE):
E:\...>parent.exe
Parent started.
Child started.
In child: env = [ entry_0, entry_1, entry_2, ]
E:\...>
Running wine under Debian (unstable):
$ wine parent.exe
Parent started.
Child started.
In child: env = [ HOME=/home/javi, entry_0, entry_1, entry_2,
COMSPEC=C:\WINDOWS\SYSTEM\wcmd.exe,
PATH=C:\syntech\bin;C:\Windows;C:\Windows\system;X:\;X:\test;Y:\, TEMP=C:\TMP,
TMP=C:\TMP, windir=C:\WINDOWS, winsysdir=C:\WINDOWS\SYSTEM, SYSTEMROOT=C:\WINDOWS, ]
Wine exited with a successful status
$
$ wine --version
Wine 20040309
Wine exited with a successful status
$ uname -a
Linux pandora 2.4.22 #1 Sat Oct 11 23:23:24 CEST 2003 i686 GNU/Linux
$
This incompatibility is giving some problems because of the following:
Due to the old DOS restriction about command line length (I think it was about
max. 127 bytes), some command line tools used to pass arguments using the
environment. When this tools were ported to Win32, this behaviour remained.
Because of this behaviour, when wine messes up the environment, the child
process complains about "Bad arguments" and exits.
I am having this problem with a Win32 Toshiba toolchain for a microcontroller.
The C compiler is actually a driver that invokes child process to perform the
different compilation phases, and they fail for the aforementioned reason.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the wine-bugs
mailing list