Bug 14976

Summary: go crashes with "panic: runtime error: index out of range [0] with length 0"
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Denys Dmytriyenko <denis>
Component: devtools / tool chainAssignee: Unassigned <unassigned>
Status: RESOLVED OBSOLETE QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie
Version: 4.2   
Target Milestone: 5.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Denys Dmytriyenko 2022-11-28 21:20:33 UTC
On some platforms, including, but not limited to, riscv64/qemuriscv64, go lang crashes with "panic: runtime error: index out of range [0] with length 0" when building several packages, namely docker/container related from meta-virtualization.

This has previously discussed in this thread:
https://lists.openembedded.org/g/openembedded-core/topic/94022663

And identified to be caused by this patch:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch

$ bitbake docker-ce -k
Loading cache: 100% |#######################################################################| Time: 0:00:00
Loaded 4136 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.2.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "riscv64-poky-linux"
MACHINE              = "qemuriscv64"
DISTRO               = "poky"
DISTRO_VERSION       = "4.1"
TUNE_FEATURES        = "riscv64"
meta                 
meta-poky            
meta-yocto-bsp       = "master:b3061544c2bb4c0f47681f8a0cc700c84440cd7e"
meta-oe              
meta-networking      
meta-python          
meta-filesystems     = "master:c4829fa338dae008c75cfffd4a712813a99c33c4"
meta-virtualization  = "master:3626f2c9ccd56c6a3ee51304a7da7aafb395a588"

Initialising tasks: 100% |###########################################################################################| Time: 0:00:00


| HASH subkey 4dad2cb36e6f0723b2a5c4133077e3da50b0efe2c8bfa38ded136139f27b8085 "stdout" = 04e7bcaf88bbb52c44ee7a2bd00dd468fe6edff4518beb3f433e6f1a478debed
| HASH subkey 1a898b46dfb141ffb81736c647cd39359e80ed266cc8956eb04746ab065df683 "srcfiles" = e43323c8f7a53cce942af7898fca6214bb27dcafa121e8f9da4284295b713487
| panic: runtime error: index out of range [0] with length 0
| 
| goroutine 11454 [running]:
| cmd/go/internal/work.(*Builder).buildActionID(0xc000003180, 0xc002502000)
|       /OE/poky-virt-master/build/tmp/work/x86_64-linux/go-cross-riscv64/1.19.3-r0/recipe-sysroot-native/usr/lib/riscv64-poky-linux/go/src/cmd/go/internal/work/exec.go:281 +0x2425
| cmd/go/internal/work.(*Builder).build(0xc000003180, {0xc00002a268?, 0x0?}, 0xc002502000)
|       /OE/poky-virt-master/build/tmp/work/x86_64-linux/go-cross-riscv64/1.19.3-r0/recipe-sysroot-native/usr/lib/riscv64-poky-linux/go/src/cmd/go/internal/work/exec.go:478 +0x199
| cmd/go/internal/work.(*Builder).Do.func2({0xb2f8d0, 0xc00002a268}, 0xc002502000)
|       /OE/poky-virt-master/build/tmp/work/x86_64-linux/go-cross-riscv64/1.19.3-r0/recipe-sysroot-native/usr/lib/riscv64-poky-linux/go/src/cmd/go/internal/work/exec.go:139 +0x5fc
| cmd/go/internal/work.(*Builder).Do.func3()
|       /OE/poky-virt-master/build/tmp/work/x86_64-linux/go-cross-riscv64/1.19.3-r0/recipe-sysroot-native/usr/lib/riscv64-poky-linux/go/src/cmd/go/internal/work/exec.go:201 +0xb9
| created by cmd/go/internal/work.(*Builder).Do
|       /OE/poky-virt-master/build/tmp/work/x86_64-linux/go-cross-riscv64/1.19.3-r0/recipe-sysroot-native/usr/lib/riscv64-poky-linux/go/src/cmd/go/internal/work/exec.go:187 +0x3f5
| WARNING: exit code 2 from a shell command.
ERROR: Task (/OE/poky-virt-master/meta-virtualization/recipes-containers/docker/docker-ce_git.bb:do_compile) failed with exit code '1'


Summary: 3 tasks failed:
  /OE/poky-virt-master/meta-virtualization/recipes-containers/runc/runc-opencontainers_git.bb:do_compile
  /OE/poky-virt-master/meta-virtualization/recipes-containers/containerd/containerd-opencontainers_git.bb:do_compile
  /OE/poky-virt-master/meta-virtualization/recipes-containers/docker/docker-ce_git.bb:do_compile
Comment 1 Denys Dmytriyenko 2022-11-28 21:22:51 UTC
A patch has been proposed on the list:
https://lists.openembedded.org/g/openembedded-core/topic/95320460
Comment 3 Randy MacLeod 2022-12-08 15:37:52 UTC
Patch fixes one problem but there are more issues to deal with.
Comment 4 Randy MacLeod 2023-10-24 14:24:51 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 5 Randy MacLeod 2026-02-19 16:26:01 UTC
Create a new bug with specific reproducer if it is still a problem.