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

build: all.bash fails when GOBIN is set via 'go env -w' #37390

Closed
zephyr opened this issue Feb 23, 2020 · 7 comments
Closed

build: all.bash fails when GOBIN is set via 'go env -w' #37390

zephyr opened this issue Feb 23, 2020 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@zephyr
Copy link

zephyr commented Feb 23, 2020

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

$ go version
go version devel +5bd145413a 2020-02-23 18:06:08 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes, it reproduces under go1.13 [although it does not leave any test binaries in GOBIN]:

all.bashOutput
$ cd `go env GOROOT`
$ git checkout origin/release-branch.go1.13
$ cd src/
$ ./all.bash
Building Go cmd/dist using /home/dennis/go1.4.
ERROR: Cannot find /home/dennis/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
dennis@inara:/opt/golang/src$ GOROOT_BOOTSTRAP=/opt/golang1.4 ./all.bash 
Building Go cmd/dist using /opt/golang1.4.
Building Go toolchain1 using /opt/golang1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
Testing packages.

ok archive/tar 0.052s
ok archive/zip 0.066s
ok bufio 0.153s
ok bytes 0.227s
ok compress/bzip2 0.133s
ok compress/flate 0.553s
ok compress/gzip 0.040s
ok compress/lzw 0.016s
ok compress/zlib 0.053s
ok container/heap 0.040s
ok container/list 0.051s
ok container/ring 0.007s
ok context 0.978s
ok crypto 0.004s
ok crypto/aes 0.032s
ok crypto/cipher 0.017s
ok crypto/des 0.016s
ok crypto/dsa 0.012s
ok crypto/ecdsa 0.192s
ok crypto/ed25519 0.089s
ok crypto/elliptic 0.090s
ok crypto/hmac 0.015s
ok crypto/internal/subtle 0.036s
ok crypto/md5 0.017s
ok crypto/rand 0.025s
ok crypto/rc4 0.062s
ok crypto/rsa 0.079s
ok crypto/sha1 0.049s
ok crypto/sha256 0.013s
ok crypto/sha512 0.005s
ok crypto/subtle 0.008s
ok crypto/tls 1.375s
ok crypto/x509 0.643s
ok database/sql 0.575s
ok database/sql/driver 0.033s
ok debug/dwarf 0.025s
ok debug/elf 0.109s
ok debug/gosym 0.080s
ok debug/macho 0.003s
ok debug/pe 0.050s
ok debug/plan9obj 0.013s
ok encoding/ascii85 0.020s
ok encoding/asn1 0.009s
ok encoding/base32 0.067s
ok encoding/base64 0.024s
ok encoding/binary 0.066s
ok encoding/csv 0.043s
ok encoding/gob 0.025s
ok encoding/hex 0.090s
ok encoding/json 0.151s
ok encoding/pem 0.017s
ok encoding/xml 0.043s
ok errors 0.035s
ok expvar 0.022s
ok flag 0.038s
ok fmt 0.129s
ok go/ast 0.028s
ok go/build 0.139s
ok go/constant 0.026s
ok go/doc 0.076s
ok go/format 0.029s
ok go/importer 0.202s
ok go/internal/gccgoimporter 0.039s
ok go/internal/gcimporter 0.480s
ok go/internal/srcimporter 1.044s
ok go/parser 0.052s
ok go/printer 0.524s
ok go/scanner 0.034s
ok go/token 0.053s
ok go/types 1.014s
ok hash 0.046s
ok hash/adler32 0.050s
ok hash/crc32 0.015s
ok hash/crc64 0.036s
ok hash/fnv 0.021s
ok html 0.071s
ok html/template 0.062s
ok image 0.118s
ok image/color 0.037s
ok image/draw 0.115s
ok image/gif 0.410s
ok image/jpeg 0.241s
ok image/png 0.103s
ok index/suffixarray 0.414s
ok internal/cpu 0.043s
ok internal/fmtsort 0.016s
ok internal/poll 0.082s
ok internal/reflectlite 0.013s
ok internal/singleflight 0.014s
ok internal/trace 0.043s
ok internal/xcoff 0.051s
ok io 0.037s
ok io/ioutil 0.037s
ok log 0.052s
ok log/syslog 1.237s
ok math 0.030s
ok math/big 0.434s
ok math/bits 0.038s
ok math/cmplx 0.013s
ok math/rand 0.214s
ok mime 0.039s
ok mime/multipart 0.272s
ok mime/quotedprintable 0.048s
ok net 3.629s
ok net/http 2.920s
ok net/http/cgi 0.617s
ok net/http/cookiejar 0.075s
ok net/http/fcgi 0.010s
ok net/http/httptest 0.105s
ok net/http/httptrace 0.022s
ok net/http/httputil 0.222s
ok net/http/internal 0.046s
ok net/http/pprof 2.042s
ok net/internal/socktest 0.039s
ok net/mail 0.023s
ok net/rpc 0.088s
ok net/rpc/jsonrpc 0.045s
ok net/smtp 0.021s
ok net/textproto 0.021s
ok net/url 0.009s
ok os 0.740s
ok os/exec 0.797s
ok os/signal 5.098s
ok os/user 0.003s
ok path 0.015s
ok path/filepath 0.019s
ok plugin 0.035s
ok reflect 0.286s
ok regexp 0.133s
ok regexp/syntax 0.617s
ok runtime 40.954s
ok runtime/debug 0.074s
ok runtime/internal/atomic 0.063s
ok runtime/internal/math 0.018s
ok runtime/internal/sys 0.056s
ok runtime/pprof 6.614s
ok runtime/pprof/internal/profile 0.004s
ok runtime/trace 1.151s
ok sort 0.210s
ok strconv 0.739s
ok strings 0.193s
ok sync 0.473s
ok sync/atomic 0.206s
ok syscall 0.113s
ok testing 0.052s
ok testing/quick 0.065s
ok text/scanner 0.015s
ok text/tabwriter 0.052s
ok text/template 0.047s
ok text/template/parse 0.033s
ok time 2.633s
ok unicode 0.037s
ok unicode/utf16 0.027s
ok unicode/utf8 0.005s
ok cmd/addr2line 2.416s
ok cmd/api 0.023s
ok cmd/asm/internal/asm 0.970s
ok cmd/asm/internal/lex 0.025s
ok cmd/compile 0.029s
ok cmd/compile/internal/gc 11.118s
ok cmd/compile/internal/ssa 0.746s
ok cmd/compile/internal/syntax 0.017s
ok cmd/compile/internal/test 0.010s [no tests to run]
ok cmd/compile/internal/types 0.073s
ok cmd/cover 3.775s
ok cmd/doc 0.126s
ok cmd/fix 0.089s
ok cmd/go 50.865s
ok cmd/go/internal/auth 0.067s
ok cmd/go/internal/cache 0.415s
ok cmd/go/internal/dirhash 0.032s
ok cmd/go/internal/generate 0.057s
ok cmd/go/internal/get 0.070s
ok cmd/go/internal/imports 0.058s
ok cmd/go/internal/load 0.036s
ok cmd/go/internal/lockedfile 0.043s
ok cmd/go/internal/lockedfile/internal/filelock 0.184s
ok cmd/go/internal/modconv 0.057s
ok cmd/go/internal/modfetch 0.065s
ok cmd/go/internal/modfetch/codehost 0.021s
ok cmd/go/internal/modfile 0.027s
ok cmd/go/internal/modload 0.028s
ok cmd/go/internal/module 0.049s
ok cmd/go/internal/mvs 0.037s
ok cmd/go/internal/note 0.017s
ok cmd/go/internal/par 0.046s
ok cmd/go/internal/renameio 0.130s
ok cmd/go/internal/search 0.006s
ok cmd/go/internal/semver 0.017s
ok cmd/go/internal/sumweb 0.018s
ok cmd/go/internal/tlog 1.628s
ok cmd/go/internal/txtar 0.003s
ok cmd/go/internal/web 0.043s
ok cmd/go/internal/work 0.055s
ok cmd/gofmt 0.045s
ok cmd/internal/buildid 0.550s
ok cmd/internal/dwarf 0.008s
ok cmd/internal/edit 0.054s
ok cmd/internal/goobj 1.324s
ok cmd/internal/obj 0.034s
ok cmd/internal/obj/arm64 0.090s
ok cmd/internal/obj/x86 0.438s
ok cmd/internal/objabi 0.034s
ok cmd/internal/src 0.010s
ok cmd/internal/test2json 0.152s
ok cmd/link 7.113s
ok cmd/link/internal/ld 2.231s
ok cmd/link/internal/sym 0.012s
ok cmd/nm 3.638s
ok cmd/objdump 3.339s
ok cmd/pack 2.458s
ok cmd/trace 0.030s
ok cmd/vet 6.587s

os/user with tag osusergo

ok os/user 0.002s

GOMAXPROCS=2 runtime -cpu=1,2,4 -quick

ok runtime 8.642s

cmd/go terminal test

PASS
ok cmd/go/testdata/testterminal18153 0.002s

Testing without libgcc.

ok crypto/x509 0.329s
ok net 0.007s
ok os/user 0.020s

internal linking of -buildmode=pie

ok reflect 1.117s
ok os/user 0.430s

sync -cpu=10

ok sync 0.384s

Testing race detector

ok runtime/race 11.375s
ok flag 1.055s
ok net 1.048s
ok os 1.090s
ok os/exec 3.029s
ok encoding/gob 1.050s
ok flag 1.065s
ok os/exec 3.030s

../misc/cgo/stdio

PASS

../misc/cgo/life

PASS

../misc/cgo/fortran

PASS
ok misc/cgo/fortran 0.002s

../misc/cgo/test

PASS
ok misc/cgo/test 4.483s
PASS
ok misc/cgo/test 4.375s
PASS
ok misc/cgo/test 4.506s
PASS
ok misc/cgo/testtls 0.002s
PASS
ok misc/cgo/testtls 0.016s
PASS
ok misc/cgo/testtls 0.002s
PASS
ok misc/cgo/nocgo 0.002s
PASS
ok misc/cgo/nocgo 0.003s
PASS
ok misc/cgo/nocgo 0.002s
PASS
ok misc/cgo/test 3.752s
PASS
ok misc/cgo/test 4.111s
PASS
ok misc/cgo/test 3.703s
PASS
ok misc/cgo/testtls 0.002s
PASS
ok misc/cgo/nocgo 0.003s

../misc/cgo/testgodefs
../misc/cgo/testso

ok misc/cgo/testso 0.832s

../misc/cgo/testsovar

ok misc/cgo/testsovar 0.859s

../misc/cgo/testcarchive

SKIP - short mode and $GO_BUILDER_NAME not set

../misc/cgo/testcshared

SKIP - short mode and $GO_BUILDER_NAME not set

../misc/cgo/testshared

--- FAIL: TestTrivialExecutable (2.03s)
shared_test.go:41: executing ../../bin/trivial (trivial executable) failed fork/exec ../../bin/trivial: no such file or directory:
shared_test.go:394: elf.Open("../../bin/trivial") failed: open ../../bin/trivial: no such file or directory
--- FAIL: TestDivisionExecutable (0.43s)
shared_test.go:41: executing ../../bin/division (division executable) failed fork/exec ../../bin/division: no such file or directory:
--- FAIL: TestCgoExecutable (0.86s)
shared_test.go:41: executing ../../bin/execgo (cgo executable) failed fork/exec ../../bin/execgo: no such file or directory:
--- FAIL: TestGopathShlib (2.27s)
shared_test.go:456: elf.Open("../../bin/exe") failed: open ../../bin/exe: no such file or directory
--- FAIL: TestTwoGopathShlibs (2.39s)
shared_test.go:41: executing ../../bin/exe2 (executable linked to GOPATH library) failed fork/exec ../../bin/exe2: no such file or directory:
--- FAIL: TestThreeGopathShlibs (3.54s)
shared_test.go:41: executing ../../bin/exe3 (executable linked to GOPATH library) failed fork/exec ../../bin/exe3: no such file or directory:
shared_test.go:698: resetFileStamps failed: chtimes ../../bin: no such file or directory
FAIL misc/cgo/testshared 16.725s
FAIL
2020/02/23 21:06:17 Failed: exit status 1

../misc/cgo/testplugin

ok misc/cgo/testplugin 0.002s

../misc/cgo/testasan

2020/02/23 21:06:17 FAILED

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

I'm using a non-standard GOBIN:

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/dennis/bin/binaries-golang"
GOCACHE="/home/dennis/.cache/go-build"
GOENV="/home/dennis/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/dennis/Dokumente/Hobbies/Informatik/Sprache/Go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/golang/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-build076111528=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +5bd145413a 2020-02-23 18:06:08 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +5bd145413a 2020-02-23 18:06:08 +0000
uname -sr: Linux 4.19.0-8-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.28-10) stable release version 2.28.

What did you do?

I run all.bash under tip.

What did you expect to see?

All tests pass and no extra left over binaries in GOBIN.

What did you see instead?

all.bash returned go tool dist: FAILED:

all.bashOutput
$ cd `go env GOROOT`
$ git checkout origin/master
$ cd src/
$ ./all.bash

dennis@inara:/opt/golang/src$ GOROOT_BOOTSTRAP=/opt/golang1.4 ./all.bash
Building Go cmd/dist using /opt/golang1.4. (go1.4-bootstrap-20170531 linux/amd64)
Building Go toolchain1 using /opt/golang1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.

Testing packages.

ok archive/tar 0.047s
ok archive/zip 0.086s
ok bufio 0.137s
ok bytes 0.244s
ok compress/bzip2 0.092s
ok compress/flate 0.680s
ok compress/gzip 0.033s
ok compress/lzw 0.019s
ok compress/zlib 0.087s
ok container/heap 0.011s
ok container/list 0.013s
ok container/ring 0.019s
ok context 0.996s
ok crypto 0.020s
ok crypto/aes 0.039s
ok crypto/cipher 0.032s
ok crypto/des 0.027s
ok crypto/dsa 0.023s
ok crypto/ecdsa 0.301s
ok crypto/ed25519 0.114s
ok crypto/elliptic 0.079s
ok crypto/hmac 0.007s
ok crypto/internal/subtle 0.006s
ok crypto/md5 0.038s
ok crypto/rand 0.050s
ok crypto/rc4 0.078s
ok crypto/rsa 0.124s
ok crypto/sha1 0.029s
ok crypto/sha256 0.019s
ok crypto/sha512 0.008s
ok crypto/subtle 0.004s
ok crypto/tls 1.559s
ok crypto/x509 0.660s
ok database/sql 0.635s
ok database/sql/driver 0.002s
ok debug/dwarf 0.079s
ok debug/elf 0.062s
ok debug/gosym 0.024s
ok debug/macho 0.018s
ok debug/pe 0.006s
ok debug/plan9obj 0.027s
ok encoding/ascii85 0.021s
ok encoding/asn1 0.008s
ok encoding/base32 0.048s
ok encoding/base64 0.058s
ok encoding/binary 0.035s
ok encoding/csv 0.052s
ok encoding/gob 0.034s
ok encoding/hex 0.041s
ok encoding/json 0.150s
ok encoding/pem 0.032s
ok encoding/xml 0.032s
ok errors 0.010s
ok expvar 0.015s
ok flag 0.010s
ok fmt 0.123s
ok go/ast 0.042s
ok go/build 0.253s
ok go/constant 0.021s
ok go/doc 0.105s
ok go/format 0.042s
ok go/importer 0.151s
ok go/internal/gccgoimporter 0.038s
ok go/internal/gcimporter 0.629s
ok go/internal/srcimporter 1.075s
ok go/parser 0.035s
ok go/printer 0.421s
ok go/scanner 0.038s
ok go/token 0.038s
ok go/types 1.255s
ok hash 0.048s
ok hash/adler32 0.026s
ok hash/crc32 0.014s
ok hash/crc64 0.004s
ok hash/fnv 0.036s
ok hash/maphash 0.141s
ok html 0.047s
ok html/template 0.069s
ok image 0.108s
ok image/color 0.061s
ok image/draw 0.067s
ok image/gif 0.503s
ok image/jpeg 0.291s
ok image/png 0.100s
ok index/suffixarray 0.343s
ok internal/cpu 0.060s
ok internal/fmtsort 0.018s
ok internal/poll 0.106s
ok internal/reflectlite 0.096s
ok internal/singleflight 0.058s
ok internal/trace 0.060s
ok internal/xcoff 0.021s
ok io 0.061s
ok io/ioutil 0.024s
ok log 0.019s
ok log/syslog 1.241s
ok math 0.010s
ok math/big 1.922s
ok math/bits 0.035s
ok math/cmplx 0.039s
ok math/rand 0.167s
ok mime 0.023s
ok mime/multipart 0.290s
ok mime/quotedprintable 0.029s
ok net 3.983s
ok net/http 8.468s
ok net/http/cgi 0.801s
ok net/http/cookiejar 0.036s
ok net/http/fcgi 0.042s
ok net/http/httptest 0.061s
ok net/http/httptrace 0.042s
ok net/http/httputil 0.047s
ok net/http/internal 0.041s
ok net/http/pprof 2.014s
ok net/internal/socktest 0.039s
ok net/mail 0.021s
ok net/rpc 0.037s
ok net/rpc/jsonrpc 0.017s
ok net/smtp 0.010s
ok net/textproto 0.013s
ok net/url 0.006s
ok os 0.751s
ok os/exec 0.825s
ok os/signal 5.081s
ok os/user 0.004s
ok path 0.006s
ok path/filepath 0.014s
ok plugin 0.004s
ok reflect 0.435s
ok regexp 0.173s
ok regexp/syntax 0.652s
ok runtime 58.634s
ok runtime/debug 0.130s
ok runtime/internal/atomic 0.021s
ok runtime/internal/math 0.044s
ok runtime/internal/sys 0.055s
ok runtime/pprof 6.487s
ok runtime/pprof/internal/profile 0.050s
ok runtime/trace 0.960s
ok sort 0.131s
ok strconv 0.580s
ok strings 0.163s
ok sync 0.668s
ok sync/atomic 0.128s
ok syscall 0.165s
ok testing 0.296s
ok testing/iotest 0.004s
ok testing/quick 0.070s
ok text/scanner 0.007s
ok text/tabwriter 0.018s
ok text/template 0.057s
ok text/template/parse 0.015s
ok time 1.673s
ok unicode 0.028s
ok unicode/utf16 0.039s
ok unicode/utf8 0.037s
ok cmd/addr2line 2.078s
ok cmd/api 0.020s
ok cmd/asm/internal/asm 1.041s
ok cmd/asm/internal/lex 0.003s
ok cmd/compile 0.022s
ok cmd/compile/internal/gc 10.243s
ok cmd/compile/internal/logopt 0.163s
ok cmd/compile/internal/ssa 0.996s
ok cmd/compile/internal/syntax 0.038s
ok cmd/compile/internal/test 0.022s [no tests to run]
ok cmd/compile/internal/types 0.016s
ok cmd/cover 3.770s
ok cmd/doc 0.118s
ok cmd/fix 1.961s
ok cmd/go 42.825s
ok cmd/go/internal/auth 0.022s
ok cmd/go/internal/cache 0.233s
ok cmd/go/internal/generate 0.069s
ok cmd/go/internal/get 0.050s
ok cmd/go/internal/imports 0.059s
ok cmd/go/internal/load 0.089s
ok cmd/go/internal/lockedfile 0.102s
ok cmd/go/internal/lockedfile/internal/filelock 0.071s
ok cmd/go/internal/modconv 0.044s
ok cmd/go/internal/modfetch 0.057s
ok cmd/go/internal/modfetch/codehost 0.019s
ok cmd/go/internal/modfetch/zip_sum_test 0.021s
ok cmd/go/internal/modload 0.048s
ok cmd/go/internal/mvs 0.026s
ok cmd/go/internal/par 0.070s
ok cmd/go/internal/renameio 0.132s
ok cmd/go/internal/search 0.030s
ok cmd/go/internal/txtar 0.019s
ok cmd/go/internal/web 0.048s
ok cmd/go/internal/work 0.028s
ok cmd/gofmt 0.080s
ok cmd/internal/buildid 0.374s
ok cmd/internal/dwarf 0.003s
ok cmd/internal/edit 0.010s
ok cmd/internal/goobj 1.434s
ok cmd/internal/moddeps 2.277s
ok cmd/internal/obj 0.062s
ok cmd/internal/obj/arm64 0.063s
ok cmd/internal/obj/riscv 0.147s
ok cmd/internal/obj/x86 0.586s
ok cmd/internal/objabi 0.080s
ok cmd/internal/src 0.047s
ok cmd/internal/test2json 0.244s
ok cmd/link 23.466s
ok cmd/link/internal/ld 6.937s
ok cmd/link/internal/sym 0.081s
ok cmd/nm 5.220s
ok cmd/objdump 4.566s
ok cmd/pack 3.183s
ok cmd/trace 0.148s
ok cmd/vet 14.208s

os/user with tag osusergo

ok os/user 0.002s

GOMAXPROCS=2 runtime -cpu=1,2,4 -quick

ok runtime 9.220s

cmd/go terminal test

PASS
ok cmd/go/testdata/testterminal18153 0.003s

Testing without libgcc.

ok crypto/x509 0.428s
ok net 0.011s
ok os/user 0.038s

internal linking of -buildmode=pie

ok reflect 0.111s
ok os/user 0.004s

sync -cpu=10

ok sync 0.282s

Testing race detector

ok runtime/race 7.481s
ok flag 0.090s
ok net 0.099s
ok os 0.093s
ok os/exec 0.058s
ok encoding/gob 0.036s
ok flag 0.102s
ok os/exec 0.069s

../misc/cgo/stdio

PASS

../misc/cgo/life

PASS

../misc/cgo/fortran

PASS
ok misc/cgo/fortran 0.003s

../misc/cgo/test

PASS
ok misc/cgo/test 4.249s
PASS
ok misc/cgo/test 4.212s
PASS
ok misc/cgo/test 4.311s
PASS
ok misc/cgo/testtls 0.002s
PASS
ok misc/cgo/testtls 0.010s
PASS
ok misc/cgo/testtls 0.003s
PASS
ok misc/cgo/nocgo 0.001s
PASS
ok misc/cgo/nocgo 0.007s
PASS
ok misc/cgo/nocgo 0.004s
PASS
ok misc/cgo/test 3.626s
PASS
ok misc/cgo/test 4.323s
PASS
ok misc/cgo/test 4.294s
PASS
ok misc/cgo/test 4.248s
PASS
ok misc/cgo/testtls 0.003s
PASS
ok misc/cgo/nocgo 0.003s

../misc/cgo/testgodefs

PASS

../misc/cgo/testso

ok misc/cgo/testso 0.710s

../misc/cgo/testsovar

ok misc/cgo/testsovar 0.798s

../misc/cgo/testcarchive

SKIP - short mode and $GO_BUILDER_NAME not set

../misc/cgo/testcshared

SKIP - short mode and $GO_BUILDER_NAME not set

../misc/cgo/testshared

--- FAIL: TestTrivialExecutable (2.08s)
shared_test.go:43: executing ../../bin/trivial (trivial executable) failed fork/exec ../../bin/trivial: no such file or directory:
shared_test.go:457: elf.Open("../../bin/trivial") failed: open ../../bin/trivial: no such file or directory
--- FAIL: TestDivisionExecutable (0.36s)
shared_test.go:43: executing ../../bin/division (division executable) failed fork/exec ../../bin/division: no such file or directory:
--- FAIL: TestCgoExecutable (0.85s)
shared_test.go:43: executing ../../bin/execgo (cgo executable) failed fork/exec ../../bin/execgo: no such file or directory:
--- FAIL: TestGopathShlib (2.16s)
shared_test.go:519: elf.Open("../../bin/exe") failed: open ../../bin/exe: no such file or directory
--- FAIL: TestTwoGopathShlibs (2.09s)
shared_test.go:43: executing ../../bin/exe2 (executable linked to GOPATH library) failed fork/exec ../../bin/exe2: no such file or directory:
--- FAIL: TestThreeGopathShlibs (3.16s)
shared_test.go:43: executing ../../bin/exe3 (executable linked to GOPATH library) failed fork/exec ../../bin/exe3: no such file or directory:
shared_test.go:761: resetFileStamps failed: chtimes ../../bin: no such file or directory
--- FAIL: TestRebuilding (1.13s)
--- FAIL: TestRebuilding/newsource (0.00s)
panic: resetFileStamps failed: chtimes ../../bin: no such file or directory [recovered]
panic: resetFileStamps failed: chtimes ../../bin: no such file or directory

goroutine 70 [running]:
testing.tRunner.func1.1(0x5d8580, 0xc0001ba0a0)
/opt/golang/src/testing/testing.go:941 +0x3d0
testing.tRunner.func1(0xc0001ea000)
/opt/golang/src/testing/testing.go:944 +0x3f9
panic(0x5d8580, 0xc0001ba0a0)
/opt/golang/src/runtime/panic.go:967 +0x15d
log.Panicf(0x62da6c, 0x1a, 0xc0001cee80, 0x1, 0x1)
/opt/golang/src/log/log.go:358 +0xc0
misc/cgo/testshared_test.resetFileStamps.func2(0x627ad8, 0x9)
/opt/golang/misc/cgo/testshared/shared_test.go:761 +0x9e
misc/cgo/testshared_test.resetFileStamps()
/opt/golang/misc/cgo/testshared/shared_test.go:765 +0x61
misc/cgo/testshared_test.TestRebuilding.func1(0xc0001ea000)
/opt/golang/misc/cgo/testshared/shared_test.go:873 +0x70
testing.tRunner(0xc0001ea000, 0xc0001b81e0)
/opt/golang/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
/opt/golang/src/testing/testing.go:1043 +0x357
FAIL misc/cgo/testshared 15.867s
FAIL
2020/02/23 21:16:44 Failed: exit status 1

../misc/cgo/testplugin

ok misc/cgo/testplugin 0.002s

../misc/cgo/testasan

ok testasan 74ms
go tool dist: FAILED

And it failed to clean up some test binaries in GOBIN:

ls -ltr `go env GOBIN` | tail -n6Output
-rwxr-xr-x 1 dennis dennis   19192 Feb 23 21:16 trivial
-rwxr-xr-x 1 dennis dennis   19176 Feb 23 21:16 division
-rwxr-xr-x 1 dennis dennis  160192 Feb 23 21:16 execgo
-rwxr-xr-x 1 dennis dennis   19296 Feb 23 21:16 exe2
-rwxr-xr-x 1 dennis dennis   19104 Feb 23 21:16 exe3
-rwxr-xr-x 1 dennis dennis 1423736 Feb 23 21:16 exe

I'm mentioning this because this seems to be the binaries that all.bash failed to found (according to some of the error messages).

@mvdan
Copy link
Member

mvdan commented Feb 24, 2020

Perhaps related to #32674? CC @jayconrod @bcmills

@jayconrod
Copy link
Contributor

Perhaps the misc tests should be better isolated from the user environment in general? I've also seen issues with CGO_CFLAGS breaking misc tests.

@jayconrod jayconrod changed the title tip: all.bash fails for custum GOBIN and leaves test binaries in GOBIN build: all.bash fails for custom GOBIN and leaves test binaries in GOBIN Feb 24, 2020
@jayconrod jayconrod added this to the Backlog milestone Feb 24, 2020
@bcmills
Copy link
Contributor

bcmills commented Feb 24, 2020

I don't understand how these tests are passing in the first place, if they're hard-coding ../../bin — they shouldn't be allowed to write to GOROOT/bin in the first place (#30316).

@bcmills
Copy link
Contributor

bcmills commented Feb 24, 2020

Oh, that's how: the test is changing to a subdirectory of its own GOPATH:
https://github.com/golang/go/blob/master/misc/cgo/testshared/shared_test.go#L108

Probably when we call os.Setenv("GOPATH", gopath) we should also os.Unsetenv("GOBIN").

@bcmills bcmills added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Feb 24, 2020
@bcmills
Copy link
Contributor

bcmills commented Feb 24, 2020

Oh, we do that too!

// Some of the tests install binaries into a custom GOPATH.
// That won't work if GOBIN is set.
os.Unsetenv("GOBIN")

I also can't reproduce the problem by setting GOBIN in my environment.

I bet the GOBIN value is coming from go env -w rather than the environment, so os.Unsetenv isn't strong enough to unset it.

@bcmills
Copy link
Contributor

bcmills commented Feb 24, 2020

Bingo:

~/go/misc/cgo/testshared$ go env -w GOBIN=$(mktemp -d)

~/go/misc/cgo/testshared$ go test . -run=TestTrivialExecutable -count=1
--- FAIL: TestTrivialExecutable (0.45s)
    shared_test.go:43: executing ../../bin/trivial (trivial executable) failed fork/exec ../../bin/trivial: no such file or directory:
    shared_test.go:458: elf.Open("../../bin/trivial") failed: open ../../bin/trivial: no such file or directory
FAIL
FAIL    misc/cgo/testshared     1.614s
FAIL

@bcmills bcmills changed the title build: all.bash fails for custom GOBIN and leaves test binaries in GOBIN build: all.bash fails when GOBIN is set via 'go env -w' Feb 24, 2020
@bcmills bcmills self-assigned this Feb 24, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/220652 mentions this issue: misc/cgo/testshared: explicitly set GOBIN (instead of unsetting it)

@golang golang locked and limited conversation to collaborators Feb 23, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants