-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/godoc: confused by symlinks in GOROOT: godoc: corpus fstree is nil #15049
Comments
Unfortunately godoc gets confused by the symlinks in $GOROOT. The debian packaging of godoc carries a patch that hacks around this, I guess some kind of better solution would be, well, better. |
Hmmm... in the meantime, could you point me to the patch and/or package with the fix? Might help other people searching for this bug too. |
Here's a partially functioning workaround for anyone who cares. If I run |
I got this working by removing the docs symlink and taking a copy of the docs source.. in
|
CL https://golang.org/cl/45096 mentions this issue. |
Repro instructions:
|
Change https://golang.org/cl/53634 mentions this issue: |
Revert https://golang.org/cl/45096. Original change description: godoc: follow symbolic links to folders in GOROOT Directory walking in godoc relies on ReadDir which returns the result of os.Lstat. Instead make the the OS VFS's ReadDir use os.Stat on symlinks before returning. Updates golang/go#15049 Fixes golang/go#21061 Change-Id: Ieaa7923d85842f3da5696a7f46134d16407dae66 Reviewed-on: https://go-review.googlesource.com/53634 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
Change https://golang.org/cl/57870 mentions this issue: |
Revert https://golang.org/cl/45096. Original change description: godoc: follow symbolic links to folders in GOROOT Directory walking in godoc relies on ReadDir which returns the result of os.Lstat. Instead make the the OS VFS's ReadDir use os.Stat on symlinks before returning. Updates golang/go#15049 Fixes golang/go#21061 Change-Id: Ieaa7923d85842f3da5696a7f46134d16407dae66 Reviewed-on: https://go-review.googlesource.com/53634 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://go-review.googlesource.com/57870 Reviewed-by: Russ Cox <[email protected]>
I think this is basically working as intended. Every time anyone tries to make godoc do more with symlinks it ends up chasing its own tail. Symlinks in Go file trees should just be disallowed, honestly. |
so this will be fixed in go 1.10? |
1.10 will work as well or as poorly as 1.9. |
It is not even poorly. It doesn't work at all now. Here is the the command log:
The only change from my side is I removed the GOPATH and GOROOT envs from There is not any symlink involved in my Go setup. Is there a workable workaround? |
guess: go install .../cmd/godoc to rebuild godoc. It looks like the value
encoded in your current godoc command is hard coded to look for GOROOT at
/usr/local/go
…On Thu, Nov 30, 2017 at 11:24 PM, Go101 ***@***.***> wrote:
It is not even poorly. It doesn't work at all now.
I don't know what have changed in the past several months.
I often used `godoc -http :9999" to open a local doc server several months
ago.
But I yesterday, I re-run this command again, I found it didn't work any
more.
Here is the the command log:
***@***.***:~$ godoc -http=:8080
2017/11/30 07:16:39 newDirectory(/): stat /usr/local/go: no such file or directory
2017/11/30 07:16:39 godoc: corpus fstree is nil
***@***.***:~$
***@***.***:~$ godoc -http=:8080 -goroot /home/myname/gosdk
(will stuck here for ever, cpu usage is 0%, I must use ctrl-c to stop it)
^C
***@***.***:~$
***@***.***:~$ GOROOT=/home/myname/sdks/go
***@***.***:~$ GOPATH=/home/myname/go
***@***.***:~$ godoc -http=:8080
2017/11/30 07:21:35 newDirectory(/): stat /usr/local/go: no such file or directory
2017/11/30 07:21:35 godoc: corpus fstree is
The only change from my side is I removed the GOPATH and GOROOT envs from
.bashrc.
But it still doesn't work when I set the two envs back.
There is not any symlink involved in my Go setup.
Is there a workable workaround?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#15049 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA3v12E_6F8Qm4euAw_XvHEl4Z25kks5s7p6CgaJpZM4H9CU1>
.
|
OK, add
It looks So, |
@davecheney |
So, godoc doesn't work if GOROOT is not set. Bug? And will be fixed on
1.10?
A some point my guess is the value of runtime.GOROOT() is going to be used,
and the fallback for that function is the GOROOT that the Go compiler that
built this program knew at the time it was compiled.
…On Thu, Nov 30, 2017 at 11:44 PM, Go101 ***@***.***> wrote:
OK, add export when setting back the GOROOT env works.
***@***.***:~$ export GOROOT=/home/myname/gosdk
***@***.***:~$ godoc -http=:8080
It looks godoc -http :8080 -goroot /home/myname/gosdk also works.
I don't know why the last run is stuck.
So, godoc doesn't work if GOROOT is not set. Bug? And will be fixed on
1.10?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#15049 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA8sCRZiUnxcuQhDJjgf9WA_wBDLrks5s7qMsgaJpZM4H9CU1>
.
|
I can confirm |
@tsuna if that's true, please open a separate issue with the details of your environment and how to reproduce the issue. This issue is old and closed, so it's not the best place to discuss it. |
This is tracked under #23445. |
Directory walking in godoc relies on ReadDir which returns the result of os.Lstat. Instead make the the OS VFS's ReadDir use os.Stat on symlinks before returning. Fixes golang/go#15049 Change-Id: I34d17ca0027b0245f5ef434a000e5a3fe2af11cf Reviewed-on: https://go-review.googlesource.com/45096 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.6 linux/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/me/Code/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
go get golang.org/x/tools/cmd/godoc
sudo -E go install golang.org/x/tools/cmd/godoc
godoc -http=":8080"
godoc running on the command line, listening to HTTP requests
"2016/03/31 11:15:45 godoc: corpus fstree is nil", followed by program exit with status code -1
which godoc
gives "/usr/lib/go/bin/godoc"godoc net/http
prints the documentation on the command line, as expected.The text was updated successfully, but these errors were encountered: