-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/*: Go programs fails to start after upgrading go toolchain to 1.21.6 #65722
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
Comments
Strange. This looks like somehow your program is not being initialized correctly (or at all). |
Thanks for your response @randall77 . We tried 1.20.13 and that works fine and all go programs in our product came up fine. When we tried 1.21.0, it failed with the above mentioned error. Is there a way to verify the installation after the toolchain is upgraded? The go env seems ok. Any other way to check? |
Build a hello world that prints |
@randall77 Thanks for your suggestion. Tried the same and the programs seems to run fine on the target.
We see the programs (our most programs do) importing sha1, md5 and flag packages are exiting with the above mentioned index out of range error. |
Try adding Frankly, I'm at a loss for what this could be. Clearly something is getting screwed up very early in initialization. Are you doing anything nonstandard, like using a Go program called from a C library? |
After importing flag package, program did not start with the same error. No. We are not using go program from C library. |
So this program
Builds ok but crashes when you try to run it? |
That's correct. And FYI - we used the yocto patches available at https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/ to build go 1.21 toolchain |
Try without those patches. |
We were not able to get rid of the patches (it would take a lot of effort to redefine the build instruction for go programs) as the go programs in our product depend on yocto build system to compile and go toolchain is built differently in yocto (https://blog.gopheracademy.com/advent-2015/go-in-a-yocto-project/). We are able to build the go 1.21.6 toolchain in yocto build system and the programs are running fine on the target after using the patches provided by yocto contributions here https://patchwork.yoctoproject.org/project/oe-core/list/?series=22831. I guess yocto will soon align with upstream go release (1.22.x) soon and these run time panic may not be seen with the official recipes and patches. |
I'm going to close this as I don't think there's anything here for the Go project to do. |
Go version
go version go1.21.6 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Upgraded go toolchain in our product from go 1.18.9 to go1.21.6 and ran the image in the target. We use yocto build system to compile our product modules. go1.21.6 is built from source.
What did you see happen?
All go programs failed to start with index out of range in one of the sha1, md5 and flag packages.
panic: runtime error: index out of range [3] with length 0
goroutine 1 [running]:
crypto.RegisterHash(...)
/usr/lib/go/src/crypto/crypto.go:149
crypto/sha1.init.0()
/usr/lib/go/src/crypto/sha1/sha1.go:19 +0x65
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
flag.init()
/usr/lib/go/src/flag/flag.go:1199 +0xf9
What did you expect to see?
Go programs to start normally.
The text was updated successfully, but these errors were encountered: