Commit e4852aaa authored by Mostyn Bramley-Moore's avatar Mostyn Bramley-Moore Committed by Ian Lance Taylor

cmd/go/internal/work: fix TestRespectGroupSticky on FreeBSD

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 golang/go#19596.

Change-Id: I30e71c6d6a156badc863e8068df10ef6ed817e26
Reviewed-on: https://go-review.googlesource.com/41216Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent be66d174
......@@ -195,8 +195,13 @@ func TestRespectGroupSticky(t *testing.T) {
}
defer os.RemoveAll(stickydir)
// Change stickydir's permissions to include group sticky bit.
if err := os.Chmod(stickydir, 0755|os.ModeSetgid); err != nil {
testdir, err := ioutil.TempDir(stickydir, "testdir")
if err != nil {
t.Fatal(err)
}
// Change testdir's permissions to include group sticky bit.
if err := os.Chmod(testdir, 0755|os.ModeSetgid); err != nil {
t.Fatal(err)
}
......@@ -207,7 +212,7 @@ func TestRespectGroupSticky(t *testing.T) {
defer os.Remove(pkgfile.Name())
defer pkgfile.Close()
stickyFile := filepath.Join(stickydir, "sticky")
stickyFile := filepath.Join(testdir, "sticky")
if err := b.moveOrCopyFile(nil, stickyFile, pkgfile.Name(), 0666, true); err != nil {
t.Fatalf("moveOrCopyFile: %v", err)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment