golang / go

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

gotest: segfault in linking #1443

Closed gopherbot closed 9 years ago

gopherbot commented 13 years ago

by eric.d.eisner:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. run gotest on any included package or contrived simple package

What is the expected output?

PASS

What do you see instead?

gopack grc _test/a.a _gotest_.8 
$GOROOT/bin/gotest: line 182:  3173 Segmentation fault      $GL _testmain.$O

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g

Which operating system are you using?
linux

Which revision are you using?  (hg identify)
cec205247d83, and hg bisect has revealed that this regression started with the
float/complex removal.

Please provide any additional information below.
Notably, the pkg tests don't segfault when run with all.bash, but they still segfault
when run with run.bash.

Replacing $GOROOT with a fresh clone fixes the problem. clean.bash should also fix it.
rsc commented 13 years ago

Comment 1:

I can't guess what is wrong.
It would help to run 8l under gdb and get
a stack trace.
gdb 8l
r _testmain.8
where

Owner changed to r...@golang.org.

Status changed to WaitingForReply.

rsc commented 13 years ago

Comment 2:

I cannot reproduce this.  I built a tree at 7180 with all.bash
and then I ran hg update and all.bash again.
By "clean.bash should also fix it", do you mean that
clean.bash does fix it, or clean.bash does not fix it but should?
gopherbot commented 13 years ago

Comment 3 by eric.d.eisner:

I originally meant that clean.bash does not fix it, but should. By iteratively deleting
ignored files in my segfaulting tree, I determined that the leftover files that cause
this problem are the old binaries in $GOROOT/bin.
My diagnosis is that I probably set $GOBIN to some external path after including
$GOROOT/bin in my $PATH. My clean.bash never deleted the $GOROOT/bin binaries, and my
make.bash never overwrote them. As a suggestion to prevent this happening in the future,
make.bash could write to both $GOROOT/bin and $GOBIN, maybe with hard links.
adg commented 13 years ago

Comment 4:

Status changed to Invalid.