[
https://issues.apache.org/jira/browse/STDCXX-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563436#action_12563436
]
Farid Zaripov commented on STDCXX-646:
--------------------------------------
No. The putenv() can't define the empty environment variable, nor
SetEnvironmentVariable(). Actually there are two types of environments: CRT and
OS.
The putenv() updates the both of them (it uses SetEnvironmentVariable() the
change OS environment). The getenv() looking into CRT environment only and
GetEnvironmentVariable() looking into OS environment respectively.
As for the modifying the environment directly - I think it's not reliable
operation and even if we know the format in memory of the CRT environment, we
don't know anything about format in memory of the OS environment (and there is
no guaranty that this format is would not be changed in future versions of
Windows).
But since the rw_putenv() is used in library tests only, we may modify the CRT
environment directly, assuming that {S|G}etEnvironmentVariable() will not be
used in tests.
> [MSVC] rw_putenv() limitations
> ------------------------------
>
> Key: STDCXX-646
> URL: https://issues.apache.org/jira/browse/STDCXX-646
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Test Driver
> Affects Versions: 4.2.0
> Environment: MSVC, ICC/Windows
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: stdcxx-646.patch
>
> Time Spent: 4.07h
> Remaining Estimate: 0h
>
> In 0.printf.cpp test the rw_putenv() is used to define variable to null and
> to undefine variable.
> ---------------
> 1. rw_putenv ("NULL="); // define to null (empty string)
> 2. rw_putenv ("UNSET"); // undefine if defined
> ---------------
> But on MSVC putenv() could not define variable to null, so:
> 1. rw_putenv ("NULL="); undefines the NULL variable instead defining it to
> null;
> 2. rw_putenv ("UNSET"); does nothing instead of undefining variable
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.