From bb729a57828d76e3050e664d86aa052741ab620f Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 21 Mar 2018 07:56:37 +0000 Subject: [PATCH] unix: fix TestFchmodat on Illumos On Illumos, TestFchmodat fails with: --- FAIL: TestFchmodat (0.00s) syscall_unix_test.go:502: Fchmodat: unexpected error: operation not supported on transport endpoint Like Linux, Illumos doesn't support flags != 0 in Fchmodat, see https://illumos.org/man/2/chmod Adjust TestFchmodat accordingly to handle EOPNOTSUPP on Illumos. Change-Id: Icd4564497a41c4aa962cd76604b5ca2c7575d96c Reviewed-on: https://go-review.googlesource.com/101775 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- unix/syscall_unix_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unix/syscall_unix_test.go b/unix/syscall_unix_test.go index 19f61e6c..bbdb6fa3 100644 --- a/unix/syscall_unix_test.go +++ b/unix/syscall_unix_test.go @@ -492,16 +492,18 @@ func TestFchmodat(t *testing.T) { } mode = os.FileMode(0644) + didChmodSymlink := true err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", uint32(mode), unix.AT_SYMLINK_NOFOLLOW) if err != nil { - if runtime.GOOS == "linux" && err == unix.EOPNOTSUPP { - // Linux doesn't support flags != 0 + if (runtime.GOOS == "linux" || runtime.GOOS == "solaris") && err == unix.EOPNOTSUPP { + // Linux and Illumos don't support flags != 0 + didChmodSymlink = false } else { t.Fatalf("Fchmodat: unexpected error: %v", err) } } - if runtime.GOOS == "linux" { + if !didChmodSymlink { // Didn't change mode of the symlink. On Linux, the permissions // of a symbolic link are always 0777 according to symlink(7) mode = os.FileMode(0777)