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/internal/modfetch/codehost: test fails with git 2.47.1 #71261

Closed
ianlancetaylor opened this issue Jan 14, 2025 · 7 comments
Closed

cmd/go/internal/modfetch/codehost: test fails with git 2.47.1 #71261

ianlancetaylor opened this issue Jan 14, 2025 · 7 comments
Labels
BugReport Issues describing a possible bug in the Go implementation. GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ianlancetaylor
Copy link
Member

Go version

HEAD

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/iant/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/iant/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1332981680=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/iant/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/iant/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org'
GOROOT='/home/iant/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/iant/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/iant/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.24-431c67ec4b Mon Jan 13 15:16:24 2025 -0800'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

go test cmd/go/internal/modfetch/codehost

(This is run as part of all.bash).

What did you see happen?

vcs-test.golang.org rerouted to http://127.0.0.1:43021
https://vcs-test.golang.org rerouted to https://127.0.0.1:37841
--- FAIL: TestStat (0.00s)
    --- FAIL: TestStat/gitrepo1/HEAD (1.02s)
        git_test.go:662: Stat: incorrect info
            have {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:ede458df7cd0fdca520df19a33158086a8a68e81 Time:2018-04-17 19:43:22 +0000 UTC Tags:[]}
            want {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:ede458df7cd0fdca520df19a33158086a8a68e81 Time:2018-04-17 19:43:22 +0000 UTC Tags:[v1.2.3 v1.2.4-annotated]}
    --- FAIL: TestStat/gitrepo1/ede458df (0.07s)
        git_test.go:662: Stat: incorrect info
            have {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:ede458df7cd0fdca520df19a33158086a8a68e81 Time:2018-04-17 19:43:22 +0000 UTC Tags:[v1.2.4-annotated]}
            want {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:ede458df7cd0fdca520df19a33158086a8a68e81 Time:2018-04-17 19:43:22 +0000 UTC Tags:[v1.2.3 v1.2.4-annotated]}
    --- FAIL: TestStat/gitrepo1/v1.2.4-annotated (1.12s)
        git_test.go:662: Stat: incorrect info
            have {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:v1.2.4-annotated Time:2018-04-17 19:43:22 +0000 UTC Tags:[v1.2.4-annotated]}
            want {Origin:<nil> Name:ede458df7cd0fdca520df19a33158086a8a68e81 Short:ede458df7cd0 Version:v1.2.4-annotated Time:2018-04-17 19:43:22 +0000 UTC Tags:[v1.2.3 v1.2.4-annotated]}
FAIL
FAIL	cmd/go/internal/modfetch/codehost	38.401s
FAIL

What did you expect to see?

ok  	cmd/go/internal/modfetch/codehost	6.896s

This test has started failing with earlier versions of Go as well. My assumption is that it is due to an updated version of git on my system.

@ianlancetaylor
Copy link
Member Author

@gopherbot Please open backport issues

This test is failing with older versions of Go, presumably because of a newer versions of git. We should backport the fix to supported versions, so that people using older Go versions don't complain when the update to a newer version of git.

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #71262 (for 1.22), #71263 (for 1.23).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/642377 mentions this issue: cmd/go/internal/modfetch/codehost: add --unshallow to git fetch

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 14, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/642437 mentions this issue: cmd/go/internal/modfetch: do not trust server to send all tags in shallow fetch

@mknyszek mknyszek added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 14, 2025
@mknyszek mknyszek modified the milestones: Backlog, Go1.24 Jan 14, 2025
@dmitshur dmitshur added the GoCommand cmd/go label Jan 14, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/642695 mentions this issue: [release-branch.go1.22] cmd/go/internal/modfetch: do not trust server to send all tags in shallow fetch

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/642696 mentions this issue: [release-branch.go1.23] cmd/go/internal/modfetch: do not trust server to send all tags in shallow fetch

@seankhliao seankhliao marked this as a duplicate of #71310 Jan 17, 2025
gopherbot pushed a commit that referenced this issue Jan 17, 2025
… to send all tags in shallow fetch

Newer git versions (at least git 2.47.1) do not send all the matching tags
for a shallow fetch of a specific hash anymore. The go command assumes
that git servers do this. Since that assumption is broken, use the local
copy of the remote refs list to augment the tags sent by the server.
This makes the cmd/go/internal/modfetch tests pass again with newer git.

For #71261
Fixes #71262

Change-Id: I9fd4f3fd7beeb68a522938599f8f3acd887d0b26
Reviewed-on: https://go-review.googlesource.com/c/go/+/642437
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
(cherry picked from commit bd80d89)
Reviewed-on: https://go-review.googlesource.com/c/go/+/642695
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
gopherbot pushed a commit that referenced this issue Jan 17, 2025
… to send all tags in shallow fetch

Newer git versions (at least git 2.47.1) do not send all the matching tags
for a shallow fetch of a specific hash anymore. The go command assumes
that git servers do this. Since that assumption is broken, use the local
copy of the remote refs list to augment the tags sent by the server.
This makes the cmd/go/internal/modfetch tests pass again with newer git.

For #71261
Fixes #71263

Change-Id: I9fd4f3fd7beeb68a522938599f8f3acd887d0b26
Reviewed-on: https://go-review.googlesource.com/c/go/+/642437
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
(cherry picked from commit bd80d89)
Reviewed-on: https://go-review.googlesource.com/c/go/+/642696
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
algitbot pushed a commit to alpinelinux/aports that referenced this issue Jan 17, 2025
bell-sw pushed a commit to bell-sw/alpaquita-aports that referenced this issue Jan 20, 2025
[ commit dfc4d4843a4fe7b2d175c50e35233cc5241bfeaa ]

See golang/go#71261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. 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

5 participants