From a95e2ae2804becdda6c265c6d589ae8184a34160 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 24 Mar 2021 21:51:44 -0400 Subject: [PATCH] test: skip fixedbugs/issue36705 on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Run-TryBot: Bryan C. Mills Reviewed-by: Matthew Dempsky TryBot-Result: Go Bot --- test/fixedbugs/issue36705.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixedbugs/issue36705.go b/test/fixedbugs/issue36705.go index d5a0e7fadef..b0485c63356 100644 --- a/test/fixedbugs/issue36705.go +++ b/test/fixedbugs/issue36705.go @@ -1,4 +1,4 @@ -// +build cgo +// +build cgo,!windows // run fake-arg-to-force-use-of-go-run // Copyright 2020 The Go Authors. All rights reserved.