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: missing ETHTOOL_FLAG_ constants in v0.23.0 #68761

Closed
smira opened this issue Aug 7, 2024 · 7 comments
Closed

x/sys/unix: missing ETHTOOL_FLAG_ constants in v0.23.0 #68761

smira opened this issue Aug 7, 2024 · 7 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@smira
Copy link

smira commented Aug 7, 2024

Go version

go version go1.22.5 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/smira/.cache/go-build'
GOENV='/home/smira/.config/go/env'
GOEXE=''
GOEXPERIMENT='loopvar'
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/smira/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/smira/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/smira/sdk/go1.22.5'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/smira/sdk/go1.22.5/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/smira/Documents/image-factory/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1214322846=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Tried to run e.g. https://github.com/mdlayher/ethtool/blob/main/client_linux.go#L567 with golang.org/x/sys v0.23.0

What did you see happen?

In the commit https://cs.opensource.google/go/x/sys/+/31ef9e726f987c593d73c3c35ca1c7477cf0e480, the constants
ETHTOOL_FLAG_* were removed (https://cs.opensource.google/go/x/sys/+/31ef9e726f987c593d73c3c35ca1c7477cf0e480:unix/zerrors_linux.go;dlc=d03a807229bc212694753d74c81119a9b4adb711).

What did you expect to see?

The constants to stay :)

@gopherbot gopherbot added this to the Unreleased milestone Aug 7, 2024
@gabyhelp
Copy link

gabyhelp commented Aug 7, 2024

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@ianlancetaylor
Copy link
Contributor

This is from https://go.dev/cl/600516. The constants disappeared, apparently because they changed from #define macros to enums. Somehow we didn't pick up the enums, and thought that the names had in fact disappeared from the kernel.

CC @mauri870

@mauri870
Copy link
Member

mauri870 commented Aug 7, 2024

@ianlancetaylor Thanks for the ping. What is the proper way to guarantee these constants don't disappear when they are converted into enums? Should we always default to define them manually when this happens? I don't think there is a way to handle this during auto generation, at least not currently. This is not the first time x/sys breaks because of disappearing constants as well.

@dr2chase dr2chase added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 7, 2024
@ianlancetaylor
Copy link
Contributor

I haven't looked closely, but I suspect that we need to add the names to x/sys/unix/linux/types.go. See the ETHTOOL symbols that are already there. It's possible that these names were previously being handled by the ETHTOOL match in x/sys/unix/mkerrors.sh.

But I could be mistaken about this.

@mauri870 mauri870 self-assigned this Aug 7, 2024
@mauri870
Copy link
Member

mauri870 commented Aug 7, 2024

I haven't looked closely, but I suspect that we need to add the names to x/sys/unix/linux/types.go. See the ETHTOOL symbols that are already there. It's possible that these names were previously being handled by the ETHTOOL match in x/sys/unix/mkerrors.sh.

But I could be mistaken about this.

Thanks, there is a mention to a perl command in x/sys/unix/linux/types.go, but it needs to be executed manually and the output added manually to the constants list.

I will send a fix shortly. I think it is worth it to integrate this into the automated mkall.sh workflow somehow in the future.

mauri870 added a commit to mauri870/sys that referenced this issue Aug 7, 2024
Some constants were removed in CL 600516 that included changes for the Linux
kernel 6.10.

This kernel version moved C defines to an enum ethtool_header_flags that was
not picked up by the mkall.sh script.

For enums, there is a perl script that needs to be run manually, and the
output must be added by hand to the list of constants in unix/linux/types.go.

Fixes golang/go#68761
@dmitshur dmitshur changed the title x/sys: missing ETHTOOL_FLAG_ constants in v0.23.0 x/sys/unix: missing ETHTOOL_FLAG_ constants in v0.23.0 Aug 7, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 7, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/604098 mentions this issue: unix: add missing ETHTOOL_FLAG_ constants

@mauri870
Copy link
Member

mauri870 commented Aug 7, 2024

I'm sorry for the inconvenience. The issue should be fixed in the linked CL. Some parts of x/sys are not fully autogenerated, I'll pay more attention when updating this in the future.

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. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants