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

cmd/go: TestRespectSetgidDir can fail on *BSD #29160

mpx opened this issue Dec 9, 2018 · 2 comments


None yet
3 participants
Copy link

commented Dec 9, 2018

TestRespectSetgidDir assumes it can create a temporary directory with setgid. However, on *BSD mkdir will inherit the parent directory group. If the test process does not have permission for the group it will be unable to setgid.

This was fixed for FreeBSD in go1.9 (#19596), but remains a potential problem for other BSD platforms (including Darwin).

In particular, I found this with /tmp on OpenBSD:

drwxrwxrwt  14 root  wheel  512 Dec  9 12:23 /tmp

A process without wheel permissions will end up with a test temporary directory owned by "user:wheel" and fail to chmod setgid:

--- FAIL: TestRespectSetgidDir (0.00s)
    build_test.go:257: chmod /tmp/SetGroupID303193776: operation not permitted
FAIL    cmd/go/internal/work    0.527s

mkdir(2) documentation for each BSD:


This comment has been minimized.

Copy link

commented Dec 9, 2018

Change mentions this issue: cmd/go: fix group for TestRespectSetgidDir chmod on BSD

@bcmills bcmills added this to the Go1.13 milestone Dec 10, 2018


This comment has been minimized.

Copy link

commented Dec 12, 2018

Change mentions this issue: cmd/go/internal/work: always chown directory in TestRespectSetgidDir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.