Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.15k stars 540 forks source link

Panic using glide update --strip-vendor #1016

Open perdasilva opened 6 years ago

perdasilva commented 6 years ago
[INFO]  Removing: .../gocode/src/github.wdf.sap.corp/ICN-ML/mlf-notebooks/vendor/github.com/docker/distribution/vendor
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x131f192]

goroutine 1 [running]:
github.com/Masterminds/glide/path.StripVendor.func1(0xc00033a580, 0x7a, 0x0, 0x0, 0x1540360, 0xc0003975c0, 0x0, 0x0)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/path/strip.go:28 +0x42
path/filepath.walk(0xc000514a80, 0x6f, 0x1547640, 0xc000785930, 0xc0004ec160, 0x0, 0x0)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:378 +0x21f
path/filepath.walk(0xc000311570, 0x68, 0x1547640, 0xc000702b60, 0xc0004ec160, 0x0, 0x0)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:382 +0x2fe
path/filepath.walk(0xc0002cfda0, 0x5b, 0x1547640, 0xc000702a90, 0xc0004ec160, 0x0, 0x0)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:382 +0x2fe
path/filepath.walk(0xc0002ce780, 0x54, 0x1547640, 0xc0004084e0, 0xc0004ec160, 0x0, 0x0)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:382 +0x2fe
path/filepath.walk(0xc0002c8aa0, 0x49, 0x1547640, 0xc000408410, 0xc0004ec160, 0x0, 0x20)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:382 +0x2fe
path/filepath.Walk(0xc0002c8aa0, 0x49, 0xc0004ec160, 0xc000408340, 0x0)
        /usr/local/Cellar/go/1.11/libexec/src/path/filepath/path.go:404 +0x105
github.com/Masterminds/glide/path.StripVendor(0x14d5ddf, 0x3b)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/path/strip.go:22 +0x106
github.com/Masterminds/glide/action.Update(0xc0001da640, 0x14c0100)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/action/update.go:108 +0x2b4
main.commands.func13(0xc000126dc0, 0x0, 0xc000126dc0)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/glide.go:634 +0x34b
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.HandleAction(0x1438080, 0x14e03f8, 0xc000126dc0, 0xc0000c9500, 0x0)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/app.go:490 +0xc8
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.Command.Run(0x14bf40c, 0x6, 0x14be02e, 0x2, 0x0, 0x0, 0x0, 0x14caa06, 0x1f, 0x0, ...)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/command.go:210 +0x990
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.(*App).Run(0xc0000bd1e0, 0xc0000b2090, 0x3, 0x3, 0x0, 0x0)
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/app.go:255 +0x687
main.main()
        /private/tmp/glide-20180907-39878-1g2n9m3/glide-0.13.1/src/github.com/Masterminds/glide/glide.go:104 +0x556
eparis commented 6 years ago

I just had the same problem. The WalkFunc to filepath.Walk doesn't check errors. If you return the error you see the glide is deleting the directory and then trying to continue walking it...

...
[INFO]  Removing: /home/eparis/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/vendor
[INFO]  Removing: /home/eparis/go/src/github.com/openshift/origin/vendor/k8s.io/sample-apiserver/vendor
[INFO]  Removing: /home/eparis/go/src/github.com/openshift/origin/vendor/github.com/vmware/photon-controller-go-sdk/Godeps/_workspace
[ERROR] Unable to strip vendor directories: lstat /home/eparis/go/src/github.com/openshift/origin/vendor/github.com/vmware/photon-controller-go-sdk/Godeps/_workspace/.gitignore: no such file or directory
An Error has occurred
[ERROR] PID 22972: hack/update-deps.sh:37: `glide update --strip-vendor` exited with status 2.
[INFO]      Stack Trace: 
[INFO]        1: hack/update-deps.sh:37: `glide update --strip-vendor`
[INFO]   Exiting with code 2.