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: cached artifacts are silently reused if we can't identify the C compiler's version #64589

Open
bcmills opened this issue Dec 6, 2023 · 0 comments
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Dec 6, 2023

Go version

go version devel go1.22-098f059d Mon Dec 4 23:03:04 2023 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/bcmills/.cache/go-build'
GOENV='/usr/local/google/home/bcmills/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/bcmills/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/usr/local/google/home/bcmills'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/bcmills/go-review'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/google/home/bcmills/go-review/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.22-ed30ee6c56 Tue Dec 5 21:18:08 2023 +0000'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='/usr/bin/clang'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/bcmills/go-review/src/go.mod'
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 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build5250197467984633244=/tmp/go-build -gno-record-gcc-switches'

What did you do?

(Forked from #64423.)

  1. Configure CC to refer to a C compiler (or wrapper) that doesn't produce a recognizable version string when run as $CC -### -x c -c -, but works otherwise.
  2. Run go test cmd/go -run=TestScript/cgo_stale_precompiled.

What did you expect to see?

Either the entire test passes (because some other property of the compiler is used as its cache ID instead), or builds that depend on the output artifacts of the C compiler fail with an informative error message.

What did you see instead?

Per #64423, go build commands succeed but the cache fails to distinguish between “no usable C compiler” and “the C compiler is unchanged”: removing the compiler from $PATH erroneously fails to invalidate the cache.

(I am fixing #64423 by fixing the version-parsing logic, but the error-handling bug remains.)

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Dec 6, 2023
@bcmills bcmills added this to the Go1.23 milestone Dec 6, 2023
@matloob matloob assigned matloob and samthanawalla and unassigned matloob Apr 29, 2024
@matloob matloob modified the milestones: Go1.23, Go1.24 May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants