Skip to content

cmd/go: TestScript/build_trimpath_cgo fails to decode dwarf on release-branch.go1.23 #73922

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

Open
dmitshur opened this issue May 29, 2025 · 1 comment
Labels
arch-arm64 BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin

Comments

@dmitshur
Copy link
Member

Go version

This affects Go 1.23.x only. The test passes on Go 1.24.x and at tip.

Output of go env in your module/workspace:

GOOS='darwin'
GOARCH='arm64'

What did you do?

Looked at the failing builds on the build dashboard, e.g., https://ci.chromium.org/b/8713515151815260705, and tried to run the the test locally on darwin/arm64. It reproduced the failure.

Note that the darwin-arm64-longtest builder where this reproduces was added recently in #73488. The same test passes on darwin-amd64-longtest builders (e.g., https://ci.chromium.org/ui/p/golang/builders/ci/go1.23-darwin-amd64-longtest/b8713515151301513937/test-results?q=cmd%2Fgo.TestScript%2Fbuild_trimpath_cgo).

What did you see happen?

Test fails with:

script_test.go:159: FAIL: testdata/script/build_trimpath_cgo.txt:13: go run ./list-dwarf hello.exe: exit status 1

Full log:

# Go 1.25-ish
$ GOTOOLCHAIN=local go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
[...]
--- PASS: TestScript (0.04s)
    --- PASS: TestScript/build_trimpath_cgo (7.40s)
PASS
ok  	cmd/go	4.394s

$ GOTOOLCHAIN=go1.24.3 go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
[...]
PASS
ok  	cmd/go	4.572s

$ GOTOOLCHAIN=go1.23.9 go test -v -count=1 -run='^TestScript$/^build_trimpath_cgo$' cmd/go
=== RUN   TestScript
vcs-test.golang.org rerouted to http://127.0.0.1:63038
https://vcs-test.golang.org rerouted to https://127.0.0.1:63039
go test proxy running at GOPROXY=http://127.0.0.1:63040/mod
=== RUN   TestScript/build_trimpath_cgo
=== PAUSE TestScript/build_trimpath_cgo
=== CONT  TestScript/build_trimpath_cgo
    script_test.go:135: 2025-05-29T23:06:13Z
    script_test.go:137: $WORK=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657
    script_test.go:159: 
        PATH=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/testbin:/Users/gopher/go/pkg/mod/golang.org/[email protected]/bin:[...]:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:[...]:/Library/Apple/usr/bin:/usr/local/go/bin:/Users/gopher/go/bin:/Users/gopher/bin
        HOME=/no-home
        CCACHE_DISABLE=1
        GOARCH=arm64
        TESTGO_GOHOSTARCH=arm64
        GOCACHE=/Users/gopher/Library/Caches/go-build
        GOCOVERDIR=
        GODEBUG=
        GOEXE=
        GOEXPERIMENT=
        GOOS=darwin
        TESTGO_GOHOSTOS=darwin
        GOPROXY=http://127.0.0.1:63040/mod
        GOPRIVATE=
        GOROOT=/Users/gopher/go/pkg/mod/golang.org/[email protected]
        GOTRACEBACK=system
        TESTGO_GOROOT=/Users/gopher/go/pkg/mod/golang.org/[email protected]
        TESTGO_EXE=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/testbin/go
        TESTGO_VCSTEST_HOST=127.0.0.1:63038
        TESTGO_VCSTEST_TLS_HOST=127.0.0.1:63039
        TESTGO_VCSTEST_CERT=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/vcstest199468596/cert.pem
        TESTGONETWORK=panic
        GOSUMDB=localhost.localdev/sumdb+00000c67+AcTrnkbUA+TU4heY3hkjiSES/DSQniBqIeQ/YppAUtK6
        GONOPROXY=
        GONOSUMDB=
        GOVCS=*:all
        devnull=/dev/null
        goversion=1.23.9
        CMDGO_TEST_RUN_MAIN=true
        HGRCPATH=
        GOTOOLCHAIN=auto
        newline=
        
        WORK=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657
        TEST_TELEMETRY_DIR=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/telemetry
        TMPDIR=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/tmp
        GOPATH=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/gopath
        PWD=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/cmd-go-test-3448253444/tmpdir137029120/build_trimpath_cgo3434210657/gopath/src
        
        # This test builds a cgo binary and verifies the source directory path
        # does not appear in the binary, either literally or in compressed DWARF.
        # TODO(golang.org/issue/36072): ideally we should build a binary from identical
        # sources in different directories and verify the binary and all intermediate
        # files are identical. (0.000s)
        > [short] skip
        [condition not met]
        > [!cgo] skip
        [condition not met]
        # Check that the source path appears when -trimpath is not used. (1.242s)
        > go build -o hello.exe .
        > grep -q gopath[/\\]src hello.exe
        > go run ./list-dwarf hello.exe
        [stderr]
        2025/05/29 19:06:14 decoding dwarf section info at offset 0x5f2af: DW_FORM_strx with no .debug_str_offsets section
        exit status 1
    script_test.go:159: FAIL: testdata/script/build_trimpath_cgo.txt:13: go run ./list-dwarf hello.exe: exit status 1
--- FAIL: TestScript (0.04s)
    --- FAIL: TestScript/build_trimpath_cgo (1.25s)
FAIL
FAIL	cmd/go	1.795s
FAIL

What did you expect to see?

Passing test on Go 1.23 release branch, or skipped test if the failure is understood and it's better to skip.

The same test was also failing for @matloob in #70669 and was fixed in Go 1.24, but this appears to be a different issue in the same test.

CC @golang/command-line, @thanm. (Also FYI @mknyszek.)

@dmitshur dmitshur added OS-Darwin NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-arm64 labels May 29, 2025
@dmitshur dmitshur added the GoCommand cmd/go label May 29, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
None yet
Development

No branches or pull requests

2 participants