Skip to content

cmd/go: trimpath does not clean some CGO C filepaths #67011

Closed as not planned
Closed as not planned
@vivi365

Description

@vivi365

Go version

go version go1.21.6 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -fdebug-prefix-map=/tmp/go-build1815251191=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Compiled a go package containing C code dependencies using -trimpath flag.

go version -m geth

go-ethereum/build/bin/geth: go1.21.6
        ...
	build	-buildmode=exe
	build	-compiler=gc
	build	-tags=urfave_cli_no_docs,ckzg
	build	-trimpath=true
	build	DefaultGODEBUG=panicnil=1
	build	CGO_ENABLED=1
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1
	build	vcs=git
	build	vcs.revision=2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1
	build	vcs.time=2024-02-27T11:51:11Z
	build	vcs.modified=false

What did you see happen?

Some C packages with full paths embedded in binaries.

/root/go/pkg/mod/github.com/karalabe/[email protected]/libusb/libusb/os/linux_netlink.c
/root/go/pkg/mod/github.com/karalabe/[email protected]/libusb/libusb/os/linux_usbfs.c
/root/go/pkg/mod/github.com/ethereum/[email protected]/bindings/go/../../src/c_kzg_4844.c

What did you expect to see?

Relative, trimmed, paths for all C libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions