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: TIPC_WAIT_FOREVER isn't usable in TIPCSubscr.Timeout #34310

Closed
mischief opened this issue Sep 15, 2019 · 2 comments
Closed

x/sys/unix: TIPC_WAIT_FOREVER isn't usable in TIPCSubscr.Timeout #34310

mischief opened this issue Sep 15, 2019 · 2 comments

Comments

@mischief
Copy link
Contributor

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

$ go version
go version go1.13rc2 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mischief/.cache/go-build"
GOENV="/home/mischief/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mischief/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/mischief/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/mischief/src/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build480716661=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
	"fmt"

	"golang.org/x/sys/unix"
)

func main() {
	seq := unix.TIPCServiceRange{
		Type:  999,
		Lower: 0,
		Upper: ^uint32(0),
	}
	sub := &unix.TIPCSubscr{
		Seq:     seq,
		Timeout: unix.TIPC_WAIT_FOREVER,
		Filter:  unix.TIPC_SUB_PORTS,
	}
	fmt.Println(sub)
}

What did you expect to see?

the subscription is printed.

What did you see instead?

./f.go:17:3: constant -1 overflows uint32

TIPC_WAIT_FOREVER is a sentinel value to make a subscription never time out (see here).

its value is currently const TIPC_WAIT_FOREVER = -0x1. the kernel headers define it as a macro ((~0)). however, the TIPCSubscr.Timeout field is a uint32, so assignment doesn't work.

@gopherbot gopherbot added this to the Unreleased milestone Sep 15, 2019
@mischief
Copy link
Contributor Author

cc @mdlayher

@gopherbot
Copy link

Change https://golang.org/cl/195757 mentions this issue: unix: redefine TIPC_WAIT_FOREVER as a uint32 value

@golang golang locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants