Glide: Getting nil pointer dereference error when using --strip-vendor option after updating to Go 1.10

Created on 19 Feb 2018  路  4Comments  路  Source: Masterminds/glide

Steps that I did:

  • Working project. (Tests work, glide install --strip vendor works)
  • Update to Go 1.10
  • Run glide install --strip-vendor
  • Now get this error:
[INFO]  Removing: /go/src/github.com/3dsim/workflow/vendor/github.com/aws/aws-sdk-go/awsmigrate/awsmigrate-renamer/vendor
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x6fdf72]

goroutine 1 [running]:
github.com/Masterminds/glide/path.StripVendor.func1(0xc4208b7a00, 0x72, 0x0, 0x0, 0x8f3540, 0xc42001ee70, 0x0, 0x0)
    /go/src/github.com/Masterminds/glide/path/strip.go:28 +0x42
path/filepath.walk(0xc4208cce00, 0x67, 0x8fa4c0, 0xc42090c000, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:377 +0x20d
path/filepath.walk(0xc4208c3d40, 0x60, 0x8fa4c0, 0xc4208c9790, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4203d7090, 0x4d, 0x8fa4c0, 0xc4208c96c0, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4205c57c0, 0x42, 0x8fa4c0, 0xc420708dd0, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4202fc100, 0x37, 0x8fa4c0, 0xc420708d00, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc42061b500, 0x33, 0x8fa4c0, 0xc4204a6750, 0xc4203b6a60, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc42061f680, 0x28, 0x8fa4c0, 0xc42068e680, 0xc4203b6a60, 0x0, 0x20)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.Walk(0xc42061f680, 0x28, 0xc4203b6a60, 0xc42068e5b0, 0x0)
    /usr/local/go/src/path/filepath/path.go:403 +0x106
github.com/Masterminds/glide/path.StripVendor(0x8b060c, 0x3b)
    /go/src/github.com/Masterminds/glide/path/strip.go:22 +0x10a
github.com/Masterminds/glide/action.Install(0xc4201c7600, 0x89bf01)
    /go/src/github.com/Masterminds/glide/action/install.go:62 +0x35b
main.commands.func12(0xc420232420, 0x0, 0xc420232420)
    /go/src/github.com/Masterminds/glide/glide.go:510 +0x2bf
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.HandleAction(0x8113e0, 0x8bac08, 0xc420232420, 0xc4201ec300, 0x0)
    /go/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(0x89a0cb, 0x7, 0x898720, 0x1, 0x0, 0x0, 0x0, 0x8a5b30, 0x20, 0x0, ...)
    /go/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/command.go:210 +0xa36
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.(*App).Run(0xc420220000, 0xc420096060, 0x3, 0x3, 0x0, 0x0)
    /go/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/app.go:255 +0x6a0
main.main()
    /go/src/github.com/Masterminds/glide/glide.go:104 +0x5a9

Most helpful comment

@ryanwalls if you upgrade to 3e13fd16ed5b0808ba0fb2e4bd98eb325ccde0a1, you'll find the same stack trace as @jayschwa. I've opened #990 to fix the issue. Let me know if this works for you guys.

All 4 comments

At first glance, the issue seems to be that stripGodepWorkspaceHandler is not checking the err input before attempting to use the other arguments.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x6fb26f]

goroutine 1 [running]:
github.com/Masterminds/glide/godep/strip.stripGodepWorkspaceHandler(0xc4207850e0, 0x48, 0x0, 0x0, 0x8f3620, 0xc4202c6f00, 0x0, 0x0)
    /go/src/github.com/Masterminds/glide/godep/strip/strip.go:62 +0x4f
path/filepath.walk(0xc420702240, 0x3d, 0x8fa5a0, 0xc4206feb60, 0x8baaf8, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:377 +0x20d
path/filepath.walk(0xc420702080, 0x32, 0x8fa5a0, 0xc4206fe8f0, 0x8baaf8, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4205548a0, 0x2b, 0x8fa5a0, 0xc4206fe820, 0x8baaf8, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4205547e0, 0x25, 0x8fa5a0, 0xc42077e820, 0x8baaf8, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4201f5620, 0x1f, 0x8fa5a0, 0xc42066c680, 0x8baaf8, 0x0, 0x0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.walk(0xc4204452e0, 0x14, 0x8fa5a0, 0xc42066c5b0, 0x8baaf8, 0x0, 0x8fa5a0)
    /usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.Walk(0xc4204452e0, 0x14, 0x8baaf8, 0xc42066c4e0, 0x0)
    /usr/local/go/src/path/filepath/path.go:403 +0x106
github.com/Masterminds/glide/godep/strip.GodepWorkspace(0xc4204452e0, 0x14, 0xc4203fc100, 0x0)
    /go/src/github.com/Masterminds/glide/godep/strip/strip.go:39 +0x11e
github.com/Masterminds/glide/path.StripVendor(0x8b06d6, 0x3b)
    /go/src/github.com/Masterminds/glide/path/strip.go:52 +0x139
github.com/Masterminds/glide/action.Install(0xc4201c7600, 0x89bf01)
    /go/src/github.com/Masterminds/glide/action/install.go:62 +0x35b
main.commands.func12(0xc420234420, 0x0, 0xc420234420)
    /go/src/github.com/Masterminds/glide/glide.go:510 +0x2bf
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.HandleAction(0x8113c0, 0x8bacd8, 0xc420234420, 0xc4201f0500, 0x0)
    /go/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(0x89a18b, 0x7, 0x8987e0, 0x1, 0x0, 0x0, 0x0, 0x8a5bfa, 0x20, 0x0, ...)
    /go/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/command.go:210 +0xa36
github.com/Masterminds/glide/vendor/github.com/codegangsta/cli.(*App).Run(0xc420222000, 0xc42001e090, 0x3, 0x3, 0x0, 0x0)
    /go/src/github.com/Masterminds/glide/vendor/github.com/codegangsta/cli/app.go:255 +0x6a0
main.main()
    /go/src/github.com/Masterminds/glide/glide.go:104 +0x5a9

We stopped getting the SIGSEGV by downgrading to go v1.9:

$ brew uninstall glide #not sure if this is strictly needed
$ brew uninstall go
$ brew install [email protected]
$ brew link [email protected] --force
$ brew install glide # also installs go 1.10, but is not linked on our $PATH
$ glide update --strip-vendor #SUCCESS!

@ryanwalls if you upgrade to 3e13fd16ed5b0808ba0fb2e4bd98eb325ccde0a1, you'll find the same stack trace as @jayschwa. I've opened #990 to fix the issue. Let me know if this works for you guys.

https://github.com/Masterminds/glide/releases/tag/v0.13.2 was released yesterday with a bugfix for this particular issue. This stack trace in particular was fixed for Helm, so it's likely fixed for other projects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kofalt picture kofalt  路  5Comments

hlltarakci picture hlltarakci  路  4Comments

gm42 picture gm42  路  6Comments

clarsonneur picture clarsonneur  路  5Comments

james-lawrence picture james-lawrence  路  5Comments