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
ghost opened this issue May 14, 2019 · 2 comments
Open

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

ghost opened this issue May 14, 2019 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ghost
Copy link

ghost 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
Copy link
Contributor

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

/cc owners @ianlancetaylor @bradfitz @tklauser

@FiloSottile FiloSottile added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 14, 2019
@bradfitz
Copy link
Contributor

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.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

3 participants