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: workspace recursive add panics on permission errors #51960

Closed
sding3 opened this issue Mar 26, 2022 · 3 comments
Closed

cmd/go: workspace recursive add panics on permission errors #51960

sding3 opened this issue Mar 26, 2022 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@sding3
Copy link
Contributor

sding3 commented Mar 26, 2022

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

$ go version
go version devel go1.19-0652274c10 Sat Mar 26 01:27:54 2022 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/shang/.cache/go-build"
GOENV="/home/shang/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/shang/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/shang/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/shang/go/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/shang/go/src/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.19-0652274c10 Sat Mar 26 01:27:54 2022 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK="/tmp/reproduce-issue/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2978051223=/tmp/go-build -gno-record-gcc-switches"

What did you do?

mkdir /tmp/reproduce-issue
cd /tmp/reproduce-issue

mkdir dir
chmod 000 dir

go work init
go work use -r .

What did you expect to see?

Expected go work use -r . to not panic.

What did you see instead?

Saw the following panic:

go: stat /tmp/reproduce-issue/dir/go.mod: permission denied
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x81ff85]

goroutine 1 [running]:
cmd/go/internal/workcmd.runUse.func1({0xc0000a89b0?, 0xc0001500c0?})
        /usr/local/go/src/cmd/go/internal/workcmd/use.go:97 +0x165
cmd/go/internal/workcmd.runUse.func2({0xc0000a89b0, 0x3}, {0xae1500, 0xc000146c30}, {0x5?, 0xc0000a89ab?})
        /usr/local/go/src/cmd/go/internal/workcmd/use.go:126 +0x113
cmd/go/internal/fsys.walk({0xc0000a89b0, 0x3}, {0xae1500, 0xc000146c30}, 0xc0000f1998)
        /usr/local/go/src/cmd/go/internal/fsys/fsys.go:413 +0xba
cmd/go/internal/fsys.walk({0x7ffd30b97189, 0x1}, {0xae1500, 0xc000146a90}, 0xc0000f1998)
        /usr/local/go/src/cmd/go/internal/fsys/fsys.go:427 +0x1dc
cmd/go/internal/fsys.Walk({0x7ffd30b97189, 0x1}, 0xc0000f1998)
        /usr/local/go/src/cmd/go/internal/fsys/fsys.go:443 +0x85
cmd/go/internal/workcmd.runUse({0xae0ac0?, 0xc0000a8000?}, 0xc0000d45b8?, {0xc0000be040, 0x1, 0x3?})
        /usr/local/go/src/cmd/go/internal/workcmd/use.go:117 +0x97f
main.invoke(0xdbf780, {0xc0000be020, 0x3, 0x3})
        /usr/local/go/src/cmd/go/main.go:225 +0x34e
main.main()
        /usr/local/go/src/cmd/go/main.go:179 +0x7ce

sding3 added a commit to sding3/go that referenced this issue Mar 26, 2022
This update fixes the panic by returning when os.Stat
errors. Previously, nil results from os.Stat was dereferenced,
causing panic.

Fixes golang#51960
@gopherbot
Copy link

Change https://go.dev/cl/395917 mentions this issue: cmd/go: fix panic in workspace recursive use

@seankhliao seankhliao added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Mar 28, 2022
@bcmills
Copy link
Contributor

bcmills commented May 11, 2022

Looks like the Gerrit CL was closed as a duplicate — is there anything left to be done here?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 11, 2022
@bcmills bcmills added this to the Backlog milestone May 11, 2022
@sding3
Copy link
Contributor Author

sding3 commented May 11, 2022

CL 394154 fixed this.

@sding3 sding3 closed this as completed May 11, 2022
@golang golang locked and limited conversation to collaborators May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants