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/internal/work: building Go can fail on FreeBSD due to chmod failure #19596
Comments
I would be inclined to just skip the test on FreeBSD. |
Seeing this on Mac OS X too.
|
The Apparently normal (operating system) user accounts that are not root cannot set Maybe the best solution is to just skip the test whenever the build user lacks the permission to modify |
If you create directories two levels deep in /tmp on FreeBSD, it's possible to make the inner dir setgid without being root, if we do this then I think the test should pass there. This trick doesn't work on darwin though. |
CL https://golang.org/cl/41216 mentions this issue. |
FreeBSD doesn't allow non-root users to enable the SetGID bit on files or directories in /tmp, however it does allow this in subdirectories, so create the test directory one level deeper. Followup to #19596. Change-Id: I30e71c6d6a156badc863e8068df10ef6ed817e26 Reviewed-on: https://go-review.googlesource.com/41216 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Unfortunately commit e4852aa does not fix this issue because it is missing a vital step. It is not sufficient to make a directory in /tmp, make a subdirectory, and attempt to make the subdirectory setgid; this will (and does) fail, because your initial directory inherits group wheel from |
I will finish bringing up my FreeBSD VM and test this properly. I will also try to refactor this test a little to make it work on Darwin. |
CL https://golang.org/cl/41430 mentions this issue. |
The change above seems to work for me on Linux, FreeBSD and Darwin (10.12.4). |
On Darwin (10.9.5), I had to follow what @siebenmann said to make the tests pass. |
@nehaljwani please open a new issue. |
The current git tip will fail to build on FreeBSD under some circumstances because it attempts to make a directory in
/tmp
setgid and under some (possibly common) situations this will fail. The root of the issue is a FreeBSD feature where directories always behave as if they had the sticky bit set as far asmkdir(2)
is concerned, per the FreeBSDmkdir(2)
manpage.How the bug happens:
/tmp
ownership is, say, userroot
and groupwheel
.wheel
mkdir /tmp/GroupSticky
. Due to the FreeBSDmkdir(2)
feature this new directory winds up with owner you but in groupwheel
, which you are not a member of.EPERM
.There are two ways for the Go build to still succeed on FreeBSD as far as I know. The first is for the UID doing the build to be in the group that owns
/tmp
. The other is to setTMPDIR
to a directory which you've created and that has the group owner as one of your groups; this will typically be the case if you create it under$HOME
.What version of Go are you using (
go version
)?I am trying to build the latest git tip, 42e9746 as I write this. However this build failure happens as of commit e9bb9e5 which introduces this test. Reverting to 4e0f639 results in a tree that will build.
What operating system and processor architecture are you using (
go env
)?What did you do?
Attempted to build Go from git tip or any version since
What did you expect to see?
Success (ignoring issue #19592 for now, which also prevents the build from succeeding).
What did you see instead?
This machine's
/tmp
and a manually created/tmp/GroupSticky
directory have the ownership:(I am not in group
wheel
on this FreeBSD server; it is run by another group entirely.)The text was updated successfully, but these errors were encountered: