Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

panic when exec trash #22

Closed
nange opened this issue May 23, 2016 · 9 comments
Closed

panic when exec trash #22

nange opened this issue May 23, 2016 · 9 comments

Comments

@nange
Copy link

nange commented May 23, 2016

trash.yml:

import:
- package: github.com/Sirupsen/logrus               # package name
  version: v0.8.7                                   # tag or commit
  repo:    https://github.com/imikushin/logrus.git  # (optional) git URL

- package: github.com/codegangsta/cli
  version: b5232bb2934f606f9f27a1305f1eea224e8e8b88

- package: github.com/cloudfoundry-incubator/candiedyaml
  version: 55a459c2d9da2b078f0725e5fb324823b2c71702

exec trash cmd, panic occured:
root@0ad3b076d0bb:~/test_trash# trash
INFO[0000] Trash! Reading file: 'trash.yml'
INFO[0000] Preparing cache for 'github.com/Sirupsen/logrus'
INFO[0009] Preparing cache for 'github.com/codegangsta/cli'
INFO[0024] Preparing cache for 'github.com/cloudfoundry-incubator/candiedyaml'
INFO[0031] Checking out 'github.com/Sirupsen/logrus', commit: 'v0.8.7'
INFO[0031] Checking out 'github.com/codegangsta/cli', commit: 'b5232bb2934f606f9f27a1305f1eea224e8e8b88'
INFO[0031] Checking out 'github.com/cloudfoundry-incubator/candiedyaml', commit: '55a459c2d9da2b078f0725e5fb324823b2c71702'
INFO[0031] Copying deps...
INFO[0031] Copying deps... Done
INFO[0031] removing '/root/test_trash/vendor/github.com/Sirupsen/logrus/.git
INFO[0031] removing '/root/test_trash/vendor/github.com/cloudfoundry-incubator/candiedyaml/.git
INFO[0031] removing '/root/test_trash/vendor/github.com/codegangsta/cli/.git
INFO[0031] Collecting packages in 'test_trash'
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x40a98e]
/usr/local/go/src/runtime/panic.go:481 +0x3e6
main.listPackages.func1(0xc82000e02a, 0xa, 0x0, 0x0, 0x7f8d245902a8, 0xc820105200, 0x0, 0x0)
panic(0x/root/gopath/src/github.com/rancher/trash/trash.go:370 +0x4e
path/fil/usr/local/go/src/path/filepath/path.go:394 +0xa50x0)
main.lis/root/gopath/src/github.com/rancher/trash/trash.go:386 +0x9f
main.col/root/gopath/src/github.com/rancher/trash/trash.go:394 +0x187
main.cle/root/gopath/src/github.com/rancher/trash/trash.go:515 +0x49b
main.run/root/gopath/src/github.com/rancher/trash/trash.go:108 +0x626
main.mai/root/gopath/src/github.com/rancher/trash/trash.go:61 +0x21
github.c/root/gopath/src/github.com/rancher/trash/vendor/github.com/codegangsta/cli/app.go:132 +0xadb, 0x1, 0x0, 0x0)
main.mai/root/gopath/src/github.com/rancher/trash/trash.go:64 +0x6e6

go env:
root@0ad3b076d0bb:~/test_trash# go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

go version:
root@0ad3b076d0bb:~/test_trash# go version
go version go1.6.2 linux/amd64

@imikushin
Copy link
Contributor

@nange Does the panic occur with the latest release? (v0.2.0)

@nange
Copy link
Author

nange commented May 24, 2016

@imikushin
I tested on v0.1.0.

And I also test with the latest release(v0.2.0) today, below is the result:
root@0ad3b076d0bb:~/gopath/src/test# trash
INFO[0000] Trash! Reading file: 'trash.yml'
INFO[0000] Preparing cache for 'github.com/Sirupsen/logrus'
INFO[0009] Preparing cache for 'github.com/codegangsta/cli'
INFO[0024] Preparing cache for 'github.com/cloudfoundry-incubator/candiedyaml'
INFO[0051] Checking out 'github.com/Sirupsen/logrus', commit: 'v0.8.7'
INFO[0051] Checking out 'github.com/codegangsta/cli', commit: 'b5232bb2934f606f9f27a1305f1eea224e8e8b88'
INFO[0051] Checking out 'github.com/cloudfoundry-incubator/candiedyaml', commit: '55a459c2d9da2b078f0725e5fb324823b2c71702'
INFO[0051] Copying deps...
INFO[0051] Copying deps... Done
INFO[0051] removing '/root/gopath/src/test/vendor/github.com/Sirupsen/logrus/.git
INFO[0051] removing '/root/gopath/src/test/vendor/github.com/cloudfoundry-incubator/candiedyaml/.git
INFO[0051] removing '/root/gopath/src/test/vendor/github.com/codegangsta/cli/.git
INFO[0051] Collecting packages in 'gopath/src/test'
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x40a98e]

goroutine 1 [running]:
panic(0x649fe0, 0xc82000a090)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
main.listPackages.func1(0xc82000e04a, 0xf, 0x0, 0x0, 0x7f0c8a9942a8, 0xc820116ea0, 0x0, 0x0)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:370 +0x4e
path/filepath.Walk(0xc82000e04a, 0xf, 0xc8200bfc00, 0x0, 0x0)
/usr/local/Cellar/go/1.6.2/libexec/src/path/filepath/path.go:394 +0xa5
main.listPackages(0xc82000e04a, 0xf, 0xc820116e40)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:386 +0x9f
main.collectImports(0xc82000e04a, 0xf, 0x7f0c8a9942a8)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:394 +0x187
main.cleanup(0xc82000e044, 0x15, 0xc82000ee00, 0x0, 0x0)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:515 +0x49b
main.run(0xc8200980b0, 0x0, 0x0)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:108 +0x626
main.main.func1(0xc8200980b0)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:61 +0x21
github.com/rancher/trash/vendor/github.com/codegangsta/cli.(*App).Run(0xc82000c180, 0xc82000a210, 0x1, 0x1, 0x0, 0x0)
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/vendor/github.com/codegangsta/cli/app.go:132 +0xadb
main.main()
/Users/ivan/src/rancher/trash/src/github.com/rancher/trash/trash.go:64 +0x6e6

@karlmutch
Copy link
Contributor

karlmutch commented May 24, 2016

Hi, I believe this is the same issue I encountered, PR #26 on the way.

@imikushin
Copy link
Contributor

@karlmutch Yeah, looks like it's the same.

@nange Can you try to move the project to a directory which would be the project's root package name prepended with src? E.g. for trash that can be /go/src/github.com/rancher/trash or /home/ivan/projects/trash/src/github.com/rancher/trash where the important part is the last src/github.com/rancher/trash.

That should help with the panic until there's a better fix.

@imikushin
Copy link
Contributor

@nange Actually, trash expects the project's root package be something like github.com/nange/trashtest, so it's a 3 steps path.

Thanks for revealing this wrong assumption, btw! It should work for most people, but not for all, unfortunately.

@nange
Copy link
Author

nange commented May 25, 2016

@imikushin thanks for the help, now it works. I love the idea of trash, and expect it becomes better.

@nange
Copy link
Author

nange commented May 25, 2016

@karlmutch Yes, that's it. PR #26 can suppress the panic.

@imikushin
Copy link
Contributor

@nange Can you check if the issue is still present (in master)? Feel free to close if it's been resolved ;)

@nange
Copy link
Author

nange commented May 26, 2016

This issue has been resolved. close it.

@nange nange closed this as completed May 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants