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

cmd/go: go version -m panics on non-Go binaries #49181

Closed
ALTree opened this issue Oct 27, 2021 · 2 comments
Closed

cmd/go: go version -m panics on non-Go binaries #49181

ALTree opened this issue Oct 27, 2021 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Oct 27, 2021

$ gotip version
go version devel go1.18-bdefb77309 Wed Oct 27 08:50:27 2021 +0000 linux/amd64

Since a8c5a99, go version -m crashes upon encountering any non-Go binary, because the scanFile function in src/cmd/go/internal/version/version.go does not return early on a non-nil err from buildinfo.ReadFile:

$ gotip version -m /usr/bin/

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8c25b8]

goroutine 1 [running]:
cmd/go/internal/version.scanFile({0xc0000cf2d8, 0x11}, {0xa8e808, 0xc000127ee0}, 0x0)
	/home/alberto/go/src/cmd/go/internal/version/version.go:157 +0x418
cmd/go/internal/version.scanDir.func1({0xc0000cf2d8, 0x11}, {0xa8df78, 0xc000175640}, {0xc0000cf2a8, 0x12})
	/home/alberto/go/src/cmd/go/internal/version/version.go:107 +0x159
path/filepath.walkDir({0xc0000cf2d8, 0x11}, {0xa8df78, 0xc000175640}, 0x9fb658)
	/home/alberto/go/src/path/filepath/path.go:386 +0x63
path/filepath.walkDir({0x7ffc1f57d51f, 0x9}, {0xa8dfb0, 0xc000099500}, 0x9fb658)
	/home/alberto/go/src/path/filepath/path.go:405 +0x22b
path/filepath.WalkDir({0x7ffc1f57d51f, 0x9}, 0x9fb658)
	/home/alberto/go/src/path/filepath/path.go:469 +0xb0
cmd/go/internal/version.scanDir({0x7ffc1f57d51f, 0x9})
	/home/alberto/go/src/cmd/go/internal/version/version.go:98 +0x25
cmd/go/internal/version.runVersion({0xa8dd80, 0xc0000a2000}, 0xc0000ce330, {0xc0000b4030, 0x1, 0x1f})
	/home/alberto/go/src/cmd/go/internal/version/version.go:89 +0x273
main.invoke(0xd29020, {0xc0000b4010, 0x3, 0x3})
	/home/alberto/go/src/cmd/go/main.go:216 +0x2ee
main.main()
	/home/alberto/go/src/cmd/go/main.go:173 +0x78e
@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 27, 2021
@ALTree ALTree added this to the Go1.18 milestone Oct 27, 2021
@ALTree ALTree self-assigned this Oct 27, 2021
@gopherbot
Copy link

Change https://golang.org/cl/359154 mentions this issue: cmd/go: don't try to print build info of non-Go binaries

@dmitshur
Copy link
Contributor

This is a regression, the bug is a simple missing return, a CL is ready and reviewed with +2, so marking as release-blocker to ensure it's not accidentally missed.

@bcmills bcmills added the okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 label Nov 12, 2021
@rsc rsc unassigned ALTree Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants