Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/unix: InotifyRmWatch should take int, not uint32 #32020

Open
dbuteyn opened this issue May 14, 2019 · 2 comments

Comments

@dbuteyn
Copy link

commented May 14, 2019

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

$ go version
go1.10.4 linux/amd64

Does this issue reproduce with the latest release?

Yes, https://github.com/golang/sys/blob/master/unix/zsyscall_linux_arm64.go still shows the following signature: InotifyRmWatch(fd int, watchdesc uint32).

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home//.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home//go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build762147821=/tmp/go-build -gno-record-gcc-switches"

What did you do?

wd,_ := unix.InotifyAddWatch(...) // wd is of type int
unix.InotifyRmWatch(..., wd) // function expects uint32 but wd is of type int

What did you expect to see?

According to man, inotify_rm_watch is defined as: int inotify_rm_watch(int fd, int wd). So I would expect InotifyRmWatch to take two regular ints.

What did you see instead?

Compiler complaining about type conversion (int -> uint32).

@gopherbot gopherbot added this to the Unreleased milestone May 14, 2019

@FiloSottile

This comment has been minimized.

Copy link
Member

commented May 14, 2019

The definition in syscall_linux.go dates back to 5 years ago, but it does look mismatched.

/cc owners @ianlancetaylor @bradfitz @tklauser

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 15, 2019

I guess it depends whether changing it would do more good than harm.

I suspect it'd break a number of people and the benefit of changing it seems low-ish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.