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

Closed
mpx opened this issue Dec 9, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@mpx
Copy link
Contributor

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
FAIL    cmd/go/internal/work    0.527s

mkdir(2) documentation for each BSD:
Darwin: https://github.com/apple/darwin-xnu/blob/master/bsd/man/man2/mkdir.2#L65
NetBSD: http://netbsd.gw.com/cgi-bin/man-cgi?mkdir+2+NetBSD-current
OpenBSD: http://man.openbsd.org/mkdir.2
FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=mkdir&sektion=2
DragonFly: https://www.dragonflybsd.org/cgi/web-man?command=mkdir&section=2

@gopherbot

This comment has been minimized.

Copy link

commented Dec 9, 2018

Change https://golang.org/cl/153357 mentions this issue: cmd/go: fix group for TestRespectSetgidDir chmod on BSD

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

@gopherbot

This comment has been minimized.

Copy link

commented Dec 12, 2018

Change https://golang.org/cl/153820 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.