mirror of https://github.com/golang/go.git
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/41216 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
be66d17452
commit
e4852aaa7e
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue