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

cmd/go: go get -u: panic: runtime error: slice bounds out of range #16167

Closed
SpComb opened this issue Jun 23, 2016 · 6 comments
Closed

cmd/go: go get -u: panic: runtime error: slice bounds out of range #16167

SpComb opened this issue Jun 23, 2016 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@SpComb
Copy link

SpComb commented Jun 23, 2016

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

    This also happens with go 1.6: cmd/go: go get panic: runtime error: slice bounds out of range #14826 (comment)

    Verified against git master, but using a custom binary patched to workaround cmd/go: go 1.7 get does not clone git submodules #16165 with go 1.7 beta, which breaks git submodule clones. The issue above contains the complete diff that I used.

    go version devel +aa6345d Thu Jun 23 04:31:19 2016 +0000 linux/amd64
    
  2. What operating system and processor architecture are you using (go env)?

    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/root/go"
    GORACE=""
    GOROOT="/root/src/go"
    GOTOOLDIR="/root/src/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build329298084=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"
    
  3. What did you do?

    Run go get -u against a repo that is missing some git submodules:

    $ /root/src/go/bin/go get -v -u github.com/qmsk/e2/cmd/tally
    github.com/qmsk/e2 (download)
    github.com/jessevdk/go-flags (download)
    github.com/golang/glog (download)
    github.com/jessevdk/go-flags
    github.com/qmsk/e2/discovery
    github.com/golang/glog
    github.com/qmsk/e2/client
    github.com/qmsk/e2/vendor/github.com/kidoman/embd
    github.com/qmsk/e2/vendor/github.com/kidoman/embd/host/generic
    github.com/qmsk/e2/vendor/github.com/kidoman/embd/host/rpi
    github.com/qmsk/e2/tally
    github.com/qmsk/e2/cmd/tally
    $ cat src/github.com/qmsk/e2/.gitmodules 
    [submodule "vendor/github.com/kidoman/embd"]
        path = vendor/github.com/kidoman/embd
        url = git@github.com:SpComb/embd.git
        branch = digitalpin-exported
    $ rm -rf src/github.com/qmsk/e2/vendor/github.com/kidoman/embd/
    

    The original scenario for this was running the initial go get with missing SSH keys, causing the submodule clone to fail, and then re-running go get -u to fetch the missing submodules.

  4. What did you expect to see?

    I would expect go get to clone the missing submodules.

  5. What did you see instead?

    Go get panics, after succesfully cloning the missing vendor submodule:

    $ /root/src/go/bin/go get -v -u github.com/qmsk/e2/cmd/tally
    github.com/qmsk/e2 (download)
    github.com/jessevdk/go-flags (download)
    github.com/kidoman/embd (download)
    github.com/golang/glog (download)
    panic: runtime error: slice bounds out of range
    
    goroutine 1 [running]:
    panic(0x7dd7a0, 0xc420010120)
        /root/src/go/src/runtime/panic.go:500 +0x1a1
    main.vendoredImportPath(0xc4200b7680, 0xc420292de1, 0x24, 0x3, 0x0)
        /root/src/go/src/cmd/go/pkg.go:463 +0x668
    main.loadImport(0xc420292de1, 0x24, 0xc420145180, 0x47, 0xc4200b7680, 0xc42044f9f8, 0xc420292ed0, 0x1, 0x1, 0x1, ...)
        /root/src/go/src/cmd/go/pkg.go:333 +0x9ea
    main.(*Package).load(0xc4200b7680, 0xc42044f9f8, 0xc4202b8000, 0x0, 0x0, 0x4)
        /root/src/go/src/cmd/go/pkg.go:940 +0x12a5
    main.loadImport(0xc4203178c1, 0x20, 0xc420316f90, 0x25, 0xc4204f6900, 0xc42044f9f8, 0xc420317a10, 0x1, 0x1, 0x1, ...)
        /root/src/go/src/cmd/go/pkg.go:374 +0x470
    main.(*Package).load(0xc4204f6900, 0xc42044f9f8, 0xc420482380, 0x0, 0x0, 0x4)
        /root/src/go/src/cmd/go/pkg.go:940 +0x12a5
    main.loadImport(0xc42036b3e1, 0x18, 0xc420287a10, 0x29, 0xc42011bb00, 0xc42044f9f8, 0xc42028c1e0, 0x1, 0x1, 0x1, ...)
        /root/src/go/src/cmd/go/pkg.go:374 +0x470
    main.(*Package).load(0xc42011bb00, 0xc42044f9f8, 0xc4201c6a80, 0x0, 0x0, 0xc)
        /root/src/go/src/cmd/go/pkg.go:940 +0x12a5
    main.loadImport(0x7fff6d41d82d, 0x1c, 0xc420010054, 0x8, 0x0, 0xc42044f9f8, 0x0, 0x0, 0x0, 0x0, ...)
        /root/src/go/src/cmd/go/pkg.go:374 +0x470
    main.loadPackage(0x7fff6d41d82d, 0x1c, 0xc42044f9f8, 0x0)
        /root/src/go/src/cmd/go/pkg.go:1658 +0x28f
    main.packagesAndErrors(0xc4203969a0, 0x1, 0x1, 0xc420396980, 0x1c, 0x8444ad)
        /root/src/go/src/cmd/go/pkg.go:1703 +0x329
    main.packagesForBuild(0xc420396980, 0x1, 0x1, 0xc420396980, 0x1, 0x1)
        /root/src/go/src/cmd/go/pkg.go:1719 +0x75
    main.runGet(0xa20d40, 0xc420396980, 0x1, 0x1)
        /root/src/go/src/cmd/go/get.go:131 +0x318
    main.main()
        /root/src/go/src/cmd/go/main.go:181 +0x624
    
    $ ls -la src/github.com/qmsk/e2/vendor/github.com/kidoman/embd/
    total 120
    drwxr-xr-x 1 root root   650 Jun 23 13:50 .
    drwxr-xr-x 1 root root     8 Jun 23 13:50 ..
    -rw-r--r-- 1 root root   153 Jun 23 13:50 AUTHORS
    -rw-r--r-- 1 root root  1441 Jun 23 13:50 CONTRIBUTING.md
    -rw-r--r-- 1 root root   288 Jun 23 13:50 CONTRIBUTORS
        ....
    
@SpComb SpComb changed the title panic: runtime error: slice bounds out of rangego get -u: go get -u: panic: runtime error: slice bounds out of range Jun 23, 2016
@bradfitz bradfitz changed the title go get -u: panic: runtime error: slice bounds out of range cmd/go: go get -u: panic: runtime error: slice bounds out of range Jun 23, 2016
@bradfitz bradfitz modified the milestones: Go1.7Maybe, Go1.8 Jun 23, 2016
@bradfitz
Copy link
Contributor

Can you make this crash without changes to cmd/go? Otherwise this bug report can be read as "if I modify the cmd/go binary, I can make it crash", which is less compelling of a bug report than if you can crash it unmodified.

@SpComb
Copy link
Author

SpComb commented Jun 23, 2016

The exact same repro steps work with an unmodified go 1.6.1 binary, and it panics.

It does not crash with an unmodified go 1.7 beta binary, but it does not clone the vendor submodules either.

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 6, 2016
@quentinmit
Copy link
Contributor

I am able to reproduce the panic with current HEAD.

@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

I can't reproduce this. I'm trying:

rm -rf /tmp/zz
GOPATH=/tmp/zz go get -v -u github.com/qmsk/e2/cmd/tally
cat /tmp/zz/src/github.com/qmsk/e2/.gitmodules 
rm -rf /tmp/zz/src/github.com/qmsk/e2/vendor/github.com/kidoman/embd/
GOPATH=/tmp/zz go get -v -u github.com/qmsk/e2/cmd/tally

and I get:

$ rm -rf /tmp/zz
$ GOPATH=/tmp/zz go get -v -u github.com/qmsk/e2/cmd/tally
github.com/qmsk/e2 (download)
cat /tmp/zz/src/github.com/qmsk/e2/.gitmodules 
github.com/jessevdk/go-flags (download)
github.com/kr/pretty (download)
github.com/kr/text (download)
Fetching https://golang.org/x/net/websocket?go-get=1
Parsing meta tags from https://golang.org/x/net/websocket?go-get=1 (status code 200)
get "golang.org/x/net/websocket": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/websocket?go-get=1
get "golang.org/x/net/websocket": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
github.com/jessevdk/go-flags
github.com/kr/text
github.com/qmsk/e2/discovery
golang.org/x/net/websocket
github.com/kr/pretty
github.com/qmsk/e2/client
github.com/qmsk/e2/web
github.com/qmsk/e2/tally
github.com/qmsk/e2/universe
github.com/qmsk/e2/cmd/tally
$ cat /tmp/zz/src/github.com/qmsk/e2/.gitmodules 
[submodule "vendor/github.com/kidoman/embd"]
    path = vendor/github.com/kidoman/embd
    url = https://github.com/SpComb/embd.git
    branch = digitalpin-exported
$ rm -rf /tmp/zz/src/github.com/qmsk/e2/vendor/github.com/kidoman/embd/
$ GOPATH=/tmp/zz go get -v -u github.com/qmsk/e2/cmd/tally
github.com/qmsk/e2 (download)
github.com/jessevdk/go-flags (download)
github.com/kr/pretty (download)
github.com/kr/text (download)
Fetching https://golang.org/x/net/websocket?go-get=1
Parsing meta tags from https://golang.org/x/net/websocket?go-get=1 (status code 200)
get "golang.org/x/net/websocket": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/websocket?go-get=1
get "golang.org/x/net/websocket": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
$

I've tried go1.6, go1.7, and current master. What am I doing wrong?

@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

I did get #15201 to reproduce though. Maybe that's enough.

@gopherbot
Copy link

CL https://golang.org/cl/31665 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 24, 2017
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