Skip to content

x/sys/unix: fchmodat under linux silently fails when passing flags #20130

@darkliquid

Description

@darkliquid

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.8.1

What operating system and processor architecture are you using (go env)?

linux amd64

What did you do?

Using syscall.Fchmodat and setting the AT_SYMLINK_NOFOLLOW flag, e.g.

import (
	"syscall"
	"golang.org/x/sys/unix"
)

func main() {
	syscall.Fchmodat(unix.AT_FDCWD, "/tmp/file", 0755, unix.AT_SYMLINK_NOFOLLOW)
}

What did you expect to see?

Expected to see an error, as according to the kernel source the syscall doesn't accept the flags parameter and the glibc source returns an ENOTSUP.

What did you see instead?

Instead, the call silently drops the flags parameter and follows the symlink, applying the fchmodat to the destination (or failing if the destination file can not be altered).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions