[Bug 8924] New: values returned by getenv() are not persistent!
Wine Bugs
wine-bugs at winehq.org
Wed Jul 11 19:24:22 CDT 2007
http://bugs.winehq.org/show_bug.cgi?id=8924
Summary: values returned by getenv() are not persistent!
Product: Wine
Version: 0.9.40.
Platform: Other
OS/Version: other
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: wine-msvcrt
AssignedTo: wine-bugs at winehq.org
ReportedBy: dmda at yandex.ru
some applications, including php.exe/php-cgi.exe rely on persistence of the
environment variable values returned by getenv(). In other words, if I set
str=getenv("OS"), it is expected to remain pointing to "Windows_NT" if I
change any other variables in the environment, add new one or remove any
other, except "OS" itself.
With WINE something happens to _environ and it reallocates _all_ the variables
if only one is changed with _putenv.
Unfortunately, I could not replicate it in a simple application I created, but
in the real one (php-cgi.exe) I added some print statements and got an
evidence that all the variables are re-allocated at once.
Code:
char **sstr, *str;
sstr = _environ;
while (1) {
str = *sstr;
if (!str) break;
printf("%p %s\n", str, str);
sstr++;
}
_sapi_cgibin_putenv("ORIG_SCRIPT_FILENAME", orig_script_filename); // it calls
_putenv("ORIG_SCRIPT_FILENAME=blah blah blah")
sstr = _environ;
while (1) {
str = *sstr;
if (!str) break;
printf("%p %s\n", str, str);
sstr++;
}
0015DE00 SSH_AGENT_PID=2432
0015DE13 HOSTNAME=xd.localdomain
0015DE2B DESKTOP_STARTUP_ID=
0015DE3F TERM=xterm
0015DE4A SHELL=/bin/bash
0015DE5A XDG_SESSION_COOKIE=b2c74538c7d7db193de3650046928200-1184171678.822200-
436245997
0015DEAA HISTSIZE=1000
...
<< call to _putenv()
0101D914 SSH_AGENT_PID=2432
0101D927 HOSTNAME=xd.localdomain
0101D93F DESKTOP_STARTUP_ID=
0101D953 TERM=xterm
0101D95E SHELL=/bin/bash
0101D96E XDG_SESSION_COOKIE=b2c74538c7d7db193de3650046928200-1184171678.822200-
436245997
0101D9BE HISTSIZE=1000
...
--
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