]> Cypherpunks.ru repositories - gostls13.git/commit
test: skip fixedbugs/issue36705 on Windows
authorBryan C. Mills <bcmills@google.com>
Thu, 25 Mar 2021 01:51:44 +0000 (21:51 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 25 Mar 2021 02:50:11 +0000 (02:50 +0000)
commita95e2ae2804becdda6c265c6d589ae8184a34160
tree7707edebe6fca21e4a82fc2d01087ce0d7aad100
parent80157b5144191e88b18937eb9b6ee5b6046f3f20
test: skip fixedbugs/issue36705 on Windows

This test is verifying that setting or unsetting an environment
variable in Go via the "os" package makes that change visible to the C
getenv function. The test has been failing on Windows since CL 304569;
it isn't clear to me whether it was running at all before that point.

On Windows the getenv and _putenv C functions are not thread-safe,
so Go's os.Setenv and os.Getenv use the SetEnvironmentVariable and
GetEnvironmentVariable system calls instead. That seems to work fine
in practice; however, changes via SetEnvironmentVariable are
empirically not visible to the C getenv function on certain versions
of Windows.

The MSDN getenv documentation¹ states that ‘getenv operates only on
the data structures accessible to the run-time library and not on the
environment “segment” created for the process by the operating system.
Therefore, programs that use the envp argument to main or wmain may
retrieve invalid information.’ That may be related to what we're
seeing here.

(https://github.com/curl/curl/issues/4774 describes this same behavior
observed in the curl project.)

¹https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getenv-wgetenv?view=msvc-160#remarks

Updates #36705

Change-Id: I222792f75c650f32c5025b0fa3edab232ff66353
Reviewed-on: https://go-review.googlesource.com/c/go/+/304669
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
test/fixedbugs/issue36705.go