-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: checksum mismatch for module containing Git LFS files #41708
Comments
I see the file is stored with Git LFS? I don't think the proxy has that setup |
@seankhliao oh man, that's embarassing. Totally overlooked LFS. Then this is just a duplicate of #38941. Then the question becomes: shouldn't the locally generated zip also ignore all filters, to ensure the content seen by the proxy is the same as seen by go when not using the proxy? The |
(Since #38941 timed out, let's continue the discussion here.) |
Picking up from #38941 (comment):
(I haven't used Git LFS, so the answers to those questions are not obvious to me.) |
I'm unfortunately not familiar with git internals, but I suspect the issue is not exclusive to LFS. Any comparable "git extension" requiring external binaries and opportunistic integration via It seems unrealistic to expect diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go
index 31921324a7..099837554a 100644
--- a/src/cmd/go/internal/modfetch/codehost/git.go
+++ b/src/cmd/go/internal/modfetch/codehost/git.go
@@ -820,7 +820,7 @@ func (r *gitRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser,
// text file line endings. Setting -c core.autocrlf=input means only
// translate files on the way into the repo, not on the way out (archive).
// The -c core.eol=lf should be unnecessary but set it anyway.
- archive, err := Run(r.dir, "git", "-c", "core.autocrlf=input", "-c", "core.eol=lf", "archive", "--format=zip", "--prefix=prefix/", info.Name, args)
+ archive, err := Run(r.dir, "git", "-c", "core.autocrlf=input", "-c", "core.eol=lf", "archive", "--worktree-attributes", "--format=zip", "--prefix=prefix/", info.Name, args)
if err != nil {
if bytes.Contains(err.(*RunError).Stderr, []byte("did not match any files")) {
return nil, os.ErrNotExist The documentation for the |
Got hit by this as well, the patch from @costela worked since it was kinda urgent. |
Workaround for golang/go#41708 : (use git lfs install before use Hugo (Go) modules) Signed-off-by: Daniel F. Dickinson <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I think I might have found data corruption on proxy.golang.org, and it's unfortunately unclear how it relates to the module's content.
First, the "correct" case: the zip file stored in
proxy.golang.org
matches the checksum onsum.golang.org
, as expected.NOTE: this repo was forked and tagged explicitly to debug this issue. The tag is new and hasn't been "moved".
Now we hit the problem with
GOPROXY=direct
:If we compare the zip file received from
proxy.golang.org
to the one generated locally as a tempfile when usingGOPROXY=direct
, we notice a discrepancy:$ diff -urN <(zipinfo goproxy.zip) <(zipinfo direct.zip)
It looks like
proxy.golang.org
silently truncated one binary file in the repository, so the checksum insum.golang.org
is for this "truncated" version, which doesn't correspond to the actual code in the original repository.What did you expect to see?
The checksum seen when downloading with or without
GOPROXY=direct
should be the same.What did you see instead?
Checksum mismatch.
The text was updated successfully, but these errors were encountered: