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/internal/moddeps: TestAllDependencies requires a writable GOPATH directory #46695

Closed
tamird opened this issue Jun 10, 2021 · 6 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@tamird
Copy link
Contributor

tamird commented Jun 10, 2021

--- FAIL: TestAllDependencies (14.42s)
    --- FAIL: TestAllDependencies/goroot(quick) (0.02s)
        moddeps_test.go:77: /opt/s/w/ir/x/w/go/bin/go list -mod=mod -m all: exit status 1
            go: could not create module cache: mkdir /nonexist-gopath: read-only file system
FAIL
FAIL	cmd/internal/moddeps	14.547s

Seen on go1.17beta1 in https://fxrev.dev/541662. Related to #46269. cc @bcmills

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 11, 2021
@ALTree ALTree added this to the Backlog milestone Jun 11, 2021
@bcmills
Copy link
Contributor

bcmills commented Jun 11, 2021

This needs more logging. It is checking a module in GOROOT that is not supposed to have any dependencies, but trying to create a module cache (which implies that the module does have dependencies, I think?).

@bcmills bcmills self-assigned this Jun 11, 2021
@bcmills bcmills modified the milestones: Backlog, Go1.17 Jun 11, 2021
@bcmills
Copy link
Contributor

bcmills commented Jun 11, 2021

I suspect that this is a bug in cmd/go, in the cmd/go/internal/modfetch.SideLock function:

if err := checkCacheDir(); err != nil {
base.Fatalf("go: %v", err)
}

There are places where we invoke modfetch.SideLock as a best-effort call, and those places should not fail if the module cache can't be created at all. (Moreover, if we're using -mod=readonly and the module cache directory doesn't exist, we probably shouldn't try to create it.)

@bcmills
Copy link
Contributor

bcmills commented Jun 11, 2021

(But also, the test should be passing -mod=readonly instead of -mod=mod.)

@bcmills bcmills changed the title cmd/internal/moddeps: TestAllDependencies tries to write to disk (and fails on read-only FS) cmd/internal/moddeps: TestAllDependencies requires a writable GOPATH Jun 16, 2021
@bcmills bcmills changed the title cmd/internal/moddeps: TestAllDependencies requires a writable GOPATH cmd/internal/moddeps: TestAllDependencies requires a writable GOPATH directory Jun 16, 2021
@gopherbot
Copy link

Change https://golang.org/cl/328769 mentions this issue: cmd/go: do not require the module cache to exist for 'go mod edit'

@gopherbot
Copy link

Change https://golang.org/cl/328771 mentions this issue: cmd/internal/moddeps: use a temporary directory for GOMODCACHE if needed

@gopherbot
Copy link

Change https://golang.org/cl/328770 mentions this issue: cmd/internal/moddeps: use -mod=readonly instead of -mod=mod

gopherbot pushed a commit that referenced this issue Jun 21, 2021
Updates #46695

Change-Id: I4afbc1401ef4183d94c1ac6271394fac1fff95ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/328769
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
gopherbot pushed a commit that referenced this issue Jun 21, 2021
TestAllDependencies is attempting to check that the modules in GOROOT
satisfy certain properties; it should not modify those modules itself.

The “quick” part of the test checks that vendored packages are present
and complete, without constructing a parallel GOROOT. It shouldn't
resolve new dependencies or change formatting in any way.

The longer version of the test already constructs a parallel GOROOT
and tidies the modules within it. That part of the test will flag any
modifications needed to the go.mod and go.sum files, without modifying
the original GOROOT.

From what I can tell, the failure mode in #46695 is caused by running
the test on a module rooted in $GOROOT proper. There is no such module
in the mainline Go repo, but it may have been introduced in the fork
and could also be introduced by stray edits in contributor CLs. It
should be diagnosed clearly.

For #46695

Change-Id: I62b90ccbd54cb3e3b413017021c952a7b1d455e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/328770
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@golang golang locked and limited conversation to collaborators Jun 21, 2022
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants