Closed bcmills closed 2 years ago
This is probably a symptom of a missing error-check somewhere, combined with an intermittent flake connecting to cloud.google.com
or its VCS host (compare #51051).
Independent of the flaky cloud.google.com
dependency, we should find and fix the missing error check.
A mod_invalid_version
failure with a similar pathology:
2022-08-18T19:12:13-0eb56ca/linux-386-longtest
> go mod edit -require github.com/pierrec/lz4@473cd7ce01a1
> go list -m github.com/pierrec/lz4
[stdout]
github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1
> stdout 'github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1'
FAIL: testdata/script/mod_invalid_version.txt:186: no match for `(?m)github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1` found in stdout
Change https://go.dev/cl/426079 mentions this issue: cmd/go/internal/modfetch: report error on failing to derive pseudo version from recent tag
I have managed to reproduce the issue with this script:
#!/bin/bash
for i in {1..10000}; do
echo "$(date +%T): try $i times"
echo "$(date +%T): try $i times ======" >> log.txt
go clean -modcache && GOPROXY=direct GOSUMDB=off gotip list -x -m github.com/pierrec/lz4@473cd7ce01a1 >>log.txt 2>&1
if tail -n 2 log.txt | grep -F v0.0.0; then
echo "$(date +%T): reproduced"
exit 0
fi
done
The script is executed in the directory with the following files:
-- go.mod --
module example.com
go 1.14
-- go.sum --
Notes:
cloud.google.com
so I tested against github.com/pierrec/lz4@473cd7ce01a1
instead.github.com
is bad (which makes it easy to reproduce the issue :smile: )From the log I found that git fetch --unshallow -f origin
is not executed when it failed. Which could happen on line 558
below:
And finally I found that the error is ignored on line 610
below:
I can reproduce the issue by modifying src/cmd/go/internal/modfetch/codehost/git.go
like this:
diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go
index ac2dc2348e..921f7d32cf 100644
--- a/src/cmd/go/internal/modfetch/codehost/git.go
+++ b/src/cmd/go/internal/modfetch/codehost/git.go
@@ -554,9 +554,7 @@ func (r *gitRepo) fetchRefsLocked() error {
// golang.org/issue/34266 and
// https://github.com/git/git/blob/4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a/transport.c#L1303-L1309.)
- if _, err := Run(r.dir, "git", "fetch", "-f", r.remote, "refs/heads/*:refs/heads/*", "refs/tags/*:refs/tags/*"); err != nil {
- return err
- }
+ return fmt.Errorf("Hardcoded error")
if _, err := os.Stat(filepath.Join(r.dir, "shallow")); err == nil {
if _, err := Run(r.dir, "git", "fetch", "--unshallow", "-f", r.remote); err != nil {
https://go.dev/cl/426079 has been sent to fix this issue.
@gopherbot, please backport to Go 1.18 and 1.19. This can cause the go
command to resolve unexpected pseudo-versions for commits and branches, and the fix is very small.
Backport issue(s) opened: #54733 (for 1.18), #54734 (for 1.19).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
Change https://go.dev/cl/426494 mentions this issue: [release-branch.go1.19] cmd/go/internal/modfetch: report error on failing to derive pseudo version from recent tag
Change https://go.dev/cl/426514 mentions this issue: [release-branch.go1.18] cmd/go/internal/modfetch: report error on failing to derive pseudo version from recent tag
Change https://go.dev/cl/426495 mentions this issue: cmd/go/internal/modfetch: distinguish "unsupported" errors from RecentTag
greplogs -l -e 'FAIL: TestScript/mod_get_direct .*(?:\n .*)*found in stdout: v0.0.0-'
2022-07-14T21:16:23-dc00aed/linux-amd64-longtest 2022-05-19T15:38:08-e23cc08/linux-386-longtest 2022-05-18T15:25:04-1f9f7db/linux-386-longtest