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/lockedfile: os.Chmod call in openFile ignores overlays #44700

Closed
fhs opened this issue Mar 1, 2021 · 4 comments
Closed

cmd/go/internal/lockedfile: os.Chmod call in openFile ignores overlays #44700

fhs opened this issue Mar 1, 2021 · 4 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@fhs
Copy link
Contributor

fhs commented Mar 1, 2021

What version of Go are you using (go version)?

$ go version
go version devel +master Sun Feb 28 22:38:43 EST 2021 plan9/386

What did you do?

cd src/cmd/go
go test -run TestScript/mod_overlay

What did you expect to see?

Test pass

What did you see instead?

go test proxy running at GOPROXY=http://127.0.0.1:65174/mod
--- FAIL: TestScript (0.02s)
    --- FAIL: TestScript/mod_overlay (0.24s)
        script_test.go:213: 
            # Test overlays that affect go.mod files
            # The go.mod file can exist only in the overlay. (0.012s)
            > cd $WORK/gopath/src/no-go-mod
            $WORK/gopath/src/no-go-mod
            > go list -overlay overlay.json .
            [stderr]
            go: chmod $WORK/gopath/src/no-go-mod/go.mod: stat $WORK/gopath/src/no-go-mod/go.mod: '.../tmpdir4282295690/script-mod_overlay/gopath/src/no-go-mod/go.mod' does not exist
            [exit status: 'go 1689: 1']
            FAIL: testdata/script/mod_overlay.txt:5: unexpected command failure
            
FAIL
exit status: 'go.test 1537: 1'
FAIL	cmd/go	7.377s

The error is from os.Chmod in lockedfile package, which of course couldn't find the overlayed go.mod file. There is no Chmod function in cmd/go/internal/fsys, so either that can be added or have some other workaround.

@gopherbot NeedsFix, OS-Plan9

@gopherbot gopherbot added NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9 labels Mar 1, 2021
@bcmills
Copy link
Contributor

bcmills commented Mar 1, 2021

CC @matloob @jayconrod

@bcmills bcmills added this to the Go1.17 milestone Mar 1, 2021
@bcmills bcmills changed the title cmd/go: TestScript/mod_overlay failing on Plan 9 cmd/go/internal/lockedfile: os.Stat call in openFile ignores overlays Mar 1, 2021
@bcmills bcmills removed the OS-Plan9 label Mar 1, 2021
@oiooj oiooj self-assigned this Mar 2, 2021
@oiooj oiooj changed the title cmd/go/internal/lockedfile: os.Stat call in openFile ignores overlays cmd/go/internal/lockedfile: os.Chmod call in openFile ignores overlays Mar 5, 2021
@gopherbot
Copy link

Change https://golang.org/cl/299029 mentions this issue: cmd/go: add fsys.Chmod function in fsys package

@jayconrod
Copy link
Contributor

Echoing a comment from https://golang.org/cl/299029, I think we should take this in a different direction.

With the overlay, the expectation should be that the go command will not modify any replacement file. The overlay should be entirely read-only.

The problem described in this issue is that on Plan 9, we need to call os.Chmod to acquire a lock on go.mod. Rather than adding fsys.Chmod, it would be better to have a special case not to acquire locks on go.mod files in the overlay.

@jayconrod jayconrod added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsFix The path to resolution is known, but the work has not been done. labels May 17, 2021
@gopherbot
Copy link

Change https://golang.org/cl/333012 mentions this issue: cmd/go: don't lock .mod and .sum files for read in overlay

@rsc rsc unassigned oiooj Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants