golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.83k stars 17.65k forks source link

cmd/go can attempt to rebuild packages outside current root #4106

Closed 4a6f656c closed 9 years ago

4a6f656c commented 12 years ago
If the linker or compiler is newer than a standard package, go will try to rebuild the
package even if it is outside of the current root (i.e. GOPATH != GOROOT). This is
similar to (or the same as) the problem detailed in issue #3149.

This can be triggered via the following:

$ touch /usr/local/go/pkg/${GOOS}_${GOARCH}/runtime.a
$ touch /usr/local/go/pkg/tool/${GOOS}_${GOARCH}/*
$ export GOPATH=/home/joel/src/mygo
$ go install example/newmath
go install runtime: open /usr/local/go/pkg/openbsd_amd64/runtime.a: permission
denied

Most of the binary distributions avoid this by retaining timestamps, however if this
does not occur (some packaging systems do not do this) it is easily hit due to file
ordering:

$ tar -C /usr/local -zxmf go-1.0.2-linux-amd64.tar.gz

As an aside, even when this is working correctly 'go install -a' still fails since '-a'
includes all packages, not just the ones in the current root.
4a6f656c commented 12 years ago

Comment 1:

This issue was closed by revision e80fccb441ac73a206bd99fb7f0dbea3eb9cc14.

Status changed to Fixed.