Skip to content

Commit

Permalink
syscallcompat: drop Fchmodat flags
Browse files Browse the repository at this point in the history
These were silently ignored until now (!) but
are rejected by Go 1.11 stdlib.

Drop the flags so the tests work again, until
we figure out a better solution.

golang/go#20130
  • Loading branch information
rfjakob committed Aug 26, 2018
1 parent 91dc44c commit 658cc4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/syscallcompat/sys_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func Dup3(oldfd int, newfd int, flags int) (err error) {

// Fchmodat syscall.
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
// Why would we ever want to call this without AT_SYMLINK_NOFOLLOW?
if flags&unix.AT_SYMLINK_NOFOLLOW == 0 {
tlog.Warn.Printf("Fchmodat: adding missing AT_SYMLINK_NOFOLLOW flag")
flags |= unix.AT_SYMLINK_NOFOLLOW
}
return syscall.Fchmodat(dirfd, path, mode, flags)
// Linux does not support passing flags to fchmodat! From the man page:
// AT_SYMLINK_NOFOLLOW ... This flag is not currently implemented.
// Linux ignores any flags, but Go stdlib rejects them with EOPNOTSUPP starting
// with Go 1.11. See https://github.com/golang/go/issues/20130 for more info.
// TODO: Use fchmodat2 once available on Linux.
return syscall.Fchmodat(dirfd, path, mode, 0)
}

// Fchownat syscall.
Expand Down

0 comments on commit 658cc4a

Please sign in to comment.