Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/user: TestGroupIds fails in Windows Server Core container #62712

Closed
corhere opened this issue Sep 18, 2023 · 2 comments
Closed

os/user: TestGroupIds fails in Windows Server Core container #62712

corhere opened this issue Sep 18, 2023 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@corhere
Copy link

corhere commented Sep 18, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ContainerAdministrator\AppData\Local\go-build
set GOENV=C:\Users\ContainerAdministrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\ContainerAdministrator\AppData\Local\Temp\go-build269861932=/tmp/go-build -gno-record-gcc-switches

What did you do?

docker run --rm -it golang:1.21.1-windowsservercore-ltsc2022 go test os/user

What did you expect to see?

ok  	os/user	1.005s

What did you see instead?

--- FAIL: TestGroupIds (0.13s)
    user_test.go:178: &{Uid:S-1-5-93-2-1 Gid:S-1-5-93-2-1 Username:User Manager\ContainerAdministrator Name:ContainerAdministrator HomeDir:C:\Users\ContainerAdministrator}.GroupIds(): The user name could not be found.
FAIL
FAIL    os/user 2.044s
FAIL

Through a liberal sprinkling of println() I have confirmed that the error is returned from the NetUserGetLocalGroups() call, same as #26041. I also tried forcing use of the fully-qualified user name User Manager\ContainerAdministrator as the query despite isDomainJoined() = (false, nil) with the same result.

The os/user tests do pass inside a container if a local user is created inside the container and the go test command run under that user. The issue only manifests with the ContainerAdministrator and ContainerUser default user accounts.

@bcmills bcmills added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 19, 2023
@bcmills
Copy link
Contributor

bcmills commented Sep 19, 2023

(attn @golang/windows)

@bcmills bcmills added this to the Backlog milestone Sep 19, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/611116 mentions this issue: os/user: fix Current().GroupIds() for AD joined users on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

3 participants