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: user_test.go fails incorrectly; does not expect membership in group "5000" (OSX/darwin) #14806

Closed
dr2chase opened this issue Mar 13, 2016 · 14 comments

Comments

@dr2chase
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
go version devel +f6ceed2 Sun Mar 13 13:32:41 2016 +0000 darwin/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/drchase/GoogleDrive/work/gocode"
GORACE=""
GOROOT="/Users/drchase/GoogleDrive/work/go-ssa2"
GOTOOLDIR="/Users/drchase/GoogleDrive/work/go-ssa2/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?
    Checkout clean from tip, ./make.bash.
    Ensure that "groups" includes a numeric group, e.g.:
groups
5000 ...  everyone netaccounts admin ... com.apple.sharepoint.group.1
  1. What did you expect to see?
    That ./all.bash on a newly checked out top would pass clean with no errors.
  2. What did you see instead?
--- FAIL: TestLookupGroup (0.00s)
    user_test.go:107: LookupGroupId("5000"): group: unknown groupid ᎈ
FAIL
FAIL    os/user 0.039s
@bradfitz bradfitz changed the title os/user_test.go fails incorrectly; does not expect membership in group "5000" (OSX/darwin) os/user: user_test.go fails incorrectly; does not expect membership in group "5000" (OSX/darwin) Mar 13, 2016
@bradfitz
Copy link
Contributor

I don't follow what you did when you wrote:

Ensure that "groups" includes a numeric group, e.g.:

What is the following output?

@bradfitz
Copy link
Contributor

Sent https://go-review.googlesource.com/20642 for the error formatting at least.

@gopherbot
Copy link

CL https://golang.org/cl/20642 mentions this issue.

@dr2chase
Copy link
Contributor Author

"groups" is a command on OSX. The output that follows is a list of the groups I am in, with some of the employer-specific ones elided with "...". For whatever reason, I seem to be in group 5000 on my laptop. The test either needs to run in a more controlled environment, or be more tolerant of apparently peculiar environments.

@bradfitz
Copy link
Contributor

What did you do to add yourself to such a group, though?

@martisch
Copy link
Contributor

there seems to be more needed than just a group with a numeric name:
sudo dseditgroup -o create -r "5000" 5000
sudo dseditgroup -o edit -a USERNAMETOADD -t user 5000

whats the output of (e.g. to see the groupid):
sudo dseditgroup -o read 5000
?

@dr2chase
Copy link
Contributor Author

sudo dseditgroup -o read 5000
Password:
Group not found.

gopherbot pushed a commit that referenced this issue Mar 14, 2016
It was failing like "unknown groupid ᎈ|" instead of "unknown groupid
5000" due to the conversion from int to string.

Updates #14806

Change-Id: I83e4b478ff628ad4053573a9f32b3fadce22e847
Reviewed-on: https://go-review.googlesource.com/20642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
@dr2chase
Copy link
Contributor Author

For grins:

ls -lg ~
total 18088
drwx------   5 5000      170 Jan 20 11:41 Applications
drwx------+ 23 5000      782 Feb 19 12:45 Desktop
drwx------+ 31 5000     1054 Jan 19 22:57 Documents
drwx------+ 59 5000     2006 Mar 11 15:21 Downloads
...

I have no idea what/why/how, I try not to do a lot of hacking at my laptop's configuration.

@dr2chase
Copy link
Contributor Author

"What did you do to add yourself to such a group, though?"
Accepted employment at Google and took the company-issued laptop.

ls -lgd ~
drwxr-xr-x+ 76 5000  2584 Mar 13 14:01 /Users/drchase

My account was apparently born that way.

@rjammala
Copy link

I am having a similar issue. Go at tip used to pass all tests. Now it fails with the following:

--- FAIL: TestLookupGroup (0.00s)
user_test.go:107: LookupGroupId("2110994482"): group: unknown groupid 2110994482
FAIL
FAIL os/user 0.027s

@zombiezen
Copy link
Contributor

@dr2chase Odd. I was also testing on a Google-issued darwin laptop. :)

The test may need to be removed. As identified here, it fails in misconfigured environments where a user is not a part of their primary group. Unfortunately, I don't think there's a cross-platform way to make this test hermetic. However, the underlying getgrouplist call is documented to always add the supplied gid to the list, so this surprises me.

@bradfitz Should I go ahead and move all platforms to the /etc/group fallback? Seems more reliable than all the woes that my CL has introduced. Sorry that this has created so much noise.

For both of you, it would be helpful to know the number of supplementary groups your user is a part of -- is it greater than 256?

@rjammala
Copy link

@zombiezen It returns 116 for me

dscl . list /groups|wc -l
116

@dr2chase
Copy link
Contributor Author

For me:

dscl . list /groups|wc -l
     120

@bradfitz
Copy link
Contributor

@zombiezen, /etc/group fallback sounds good if you'd like. But only if it's actually a fallback; we should probably still try using C first. I'll leave it up to you as to how to change the tests.

@golang golang locked and limited conversation to collaborators Mar 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants