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: go get all tries to update package in GOROOT, throws permission error #42620

Closed
FallenWarrior2k opened this issue Nov 15, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@FallenWarrior2k
Copy link

FallenWarrior2k commented Nov 15, 2020

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

$ go version
go version go1.15.5 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//.cache/go-build"
GOENV="/home//.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home//.local/share/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home//.local/share/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build135625205=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I use Go as provided by my distro's (Arch Linux) package manager. As such, my GOROOT is a directory that my user does not have permission to make changes to.
I also have the community/libguestfs package installed for unrelated reasons. This package, however, installs some files to GOROOT:

$ pacman -Ql libguestfs | grep `go env GOROOT`
libguestfs /usr/lib/go/
libguestfs /usr/lib/go/pkg/
libguestfs /usr/lib/go/pkg/linux_amd64/
libguestfs /usr/lib/go/pkg/linux_amd64/libguestfs.org/
libguestfs /usr/lib/go/pkg/linux_amd64/libguestfs.org/guestfs/
libguestfs /usr/lib/go/pkg/linux_amd64/libguestfs.org/guestfs/guestfs.a
libguestfs /usr/lib/go/src/
libguestfs /usr/lib/go/src/pkg/
libguestfs /usr/lib/go/src/pkg/libguestfs.org/
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_010_load_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_020_create_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_030_create_flags_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_040_create_multiple_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_050_handle_properties_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_060_explicit_close_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_070_optargs_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_100_launch_test.go
libguestfs /usr/lib/go/src/pkg/libguestfs.org/guestfs/guestfs_900_rstringlist_test.go

What did you expect to see?

go get all should continue to work normally.

What did you see instead?

Ever since installing this package, go get all (with or without -u) fails with go get pkg/libguestfs.org/guestfs: mkdir /usr/lib/go/pkg/linux_amd64/pkg: permission denied.

@seankhliao
Copy link
Member

This is a packaging issue with community/libguestfs, the issue should be raised in Arch's bugtracker for this

@bcmills bcmills changed the title go get all tries to update package in GOROOT, throws permission error cmd/go: go get all tries to update package in GOROOT, throws permission error Nov 16, 2020
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 16, 2020
@bcmills bcmills added this to the Unplanned milestone Nov 16, 2020
@bcmills
Copy link
Contributor

bcmills commented Nov 16, 2020

Agreed; this does not appear to be a bug in the go command proper. It is expected that users cannot reinstall a stale binary from GOROOT/src when they do not have permission to write to GOROOT/pkg.

On the other hand, it is not expected that distros add their own package to GOROOT/src. That location is reserved for the Go standard library.

@bcmills bcmills closed this as completed Nov 16, 2020
@golang golang locked and limited conversation to collaborators Nov 16, 2021
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