justone/dockviz

dockviz panic when supplying image name to --tree

Closed this issue · 2 comments

Just fooling around with dockviz and ran across a crash. Don't know jack about Go yet or I'd try to come up with a pull request.

$ ./dockviz images --short
hello-world: latest
jupyter/notebook: latest
ipython/scipystack: latest

$ ./dockviz images --tree hello-world                                                                                                                                                               
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.PrintTreeNode(0xc208010310, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/cswarth/Development/dockviz/images.go:171 +0x504
main.WalkTree(0xc208010310, 0xc2080bda00, 0xc2080bda10, 0x1, 0x1, 0xc20803d9b0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:158 +0x519
main.jsonToTree(0xc2080bdb70, 0x7fff5fbffaf0, 0xb, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:132 +0x4e2
main.(*ImagesCommand).Execute(0x5c0b6c, 0xc20803d110, 0x1, 0x3, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:90 +0x470
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc20802e2d0, 0xc20800a010, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/src/github.com/jessevdk/go-flags/parser.go:278 +0x8c1
github.com/jessevdk/go-flags.(*Parser).Parse(0xc20802e2d0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/src/github.com/jessevdk/go-flags/parser.go:154 +0xb1
main.main()
        /Users/cswarth/Development/dockviz/cli.go:29 +0x4b

goroutine 7 [runnable]:
net/http.(*persistConn).readLoop(0xc20808e2c0)
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:660 +0xc9f

goroutine 8 [select]:
net/http.(*persistConn).writeLoop(0xc20808e2c0)
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:661 +0xcbc

Compiled dockviz from source using go1.4.2 on MacOS 10.10.4 (Yosemite)

$ docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): darwin/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

Hey, thanks for the report. I'll take a look.

Found the bug. dockviz wasn't set up to handle specifying the start image as a repo name. It assumed that what was passed was an image ID. I updated the code. Please download v0.2.1.

Thanks again for the report.