You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
The code is incorrect in the current tip.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/manlio/.local/bin"
GOCACHE="/home/manlio/.cache/go-build"
GOENV="/home/manlio/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="*.local"
GOMODCACHE="/home/manlio/.local/lib/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="*.local"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/src/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"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/manlio/src/contrib/go/go.googlesource.com/go/src/cmd/go.mod"
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-build924785553=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.16 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.16
uname -sr: Linux 5.11.2-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.33.
gdb --version: GNU gdb (GDB) 10.1
What did you do?
In the internal/base/base.go file in the cmd/go package, there is a mutex that protects the access to the global exitStatus variable. The mutex is locked in the SetExitStatus function, but exitStatus is not protected in the ExitIfErrors and GetExitStatus functions.
Looking at the code, GetExitStatus is only used in the test but ExitIfErrors is used in several sub packages. It is possible that there are only concurrent write access and no read/write concurrent access.
GetExitStatus should lock the exitStatus variable and ExitIfErrors should be changed to call GetExitStatus internally.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
The code is incorrect in the current tip.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In the
internal/base/base.go
file in thecmd/go
package, there is a mutex that protects the access to the globalexitStatus
variable. The mutex is locked in theSetExitStatus
function, butexitStatus
is not protected in theExitIfErrors
andGetExitStatus
functions.Looking at the code,
GetExitStatus
is only used in the test butExitIfErrors
is used in several sub packages. It is possible that there are only concurrent write access and no read/write concurrent access.GetExitStatus
should lock theexitStatus
variable andExitIfErrors
should be changed to callGetExitStatus
internally.The text was updated successfully, but these errors were encountered: