if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
t.Skip("can't set SetGID bit with chmod on iOS")
}
+ case "windows", "plan9":
+ t.Skip("chown/chmod setgid are not supported on Windows and Plan 9")
}
var b Builder
}
defer os.RemoveAll(setgiddir)
- if runtime.GOOS == "freebsd" {
- err = os.Chown(setgiddir, os.Getuid(), os.Getgid())
- if err != nil {
- t.Fatal(err)
- }
+ // BSD mkdir(2) inherits the parent directory group, and other platforms
+ // can inherit the parent directory group via setgid. The test setup (chmod
+ // setgid) will fail if the process does not have the group permission to
+ // the new temporary directory.
+ err = os.Chown(setgiddir, os.Getuid(), os.Getgid())
+ if err != nil {
+ t.Fatal(err)
}
// Change setgiddir's permissions to include the SetGID bit.