Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

dep: Panic observed on init #1130

Closed
simar7 opened this issue Sep 5, 2017 · 8 comments
Closed

dep: Panic observed on init #1130

simar7 opened this issue Sep 5, 2017 · 8 comments

Comments

@simar7
Copy link

simar7 commented Sep 5, 2017

Hey folks,

Just noticed dep panic out while I was trying to dep init a repo that was previously managed with glide.

What version of dep are you using (dep version)?

v0.3.0-248-gd3e738d

What dep command did you run?

dep init -v
Getting direct dependencies...
Checked 6 directories for packages.
Found 8 direct dependencies.
Importing configuration from glide. These are only initial constraints, and are further refined during the solve process.
Detected glide configuration files...
  Loading <path/to/gopath/repo>/glide.yaml
  Loading <path/to/gopath/repo>/glide.lock
Converting from glide.yaml and glide.lock...
  Using ^1.3.0 as initial constraint for imported dep github.com/gorilla/mux
  Using * as initial constraint for imported dep github.com/hashicorp/logutils
  Using ^3.0.0 as initial constraint for imported dep github.com/dgrijalva/jwt-go
  Using ^1.1.0 as initial constraint for imported dep github.com/satori/go.uuid
  Using ^1.0.0 as initial constraint for imported dep github.com/garyburd/redigo
  Using * as initial constraint for imported dep github.com/emicklei/forest
  Using * as initial constraint for imported dep github.com/wsxiaoys/terminal
  Using * as initial constraint for imported dep gopkg.in/xmlpath.v2
  Using * as initial constraint for imported dep golang.org/x/net
  Using * as initial constraint for imported dep github.com/stretchr/testify
  Using * as initial constraint for imported dep github.com/davecgh/go-spew
  Using * as initial constraint for imported dep github.com/pmezard/go-difflib
  Using ^1.8.4 as initial constraint for imported dep github.com/aws/aws-sdk-go
  Trying * (95125df) as initial lock for imported dep github.com/emicklei/forest
  Trying * (95125df) as initial lock for imported dep github.com/go-ini/ini
  Trying * (95125df) as initial lock for imported dep github.com/gorilla/context
  Trying * (95125df) as initial lock for imported dep github.com/hashicorp/logutils
  Trying * (95125df) as initial lock for imported dep github.com/jmespath/go-jmespath
  Trying * (95125df) as initial lock for imported dep github.com/stretchr/testify
  Trying * (95125df) as initial lock for imported dep github.com/wsxiaoys/terminal
  Trying * (95125df) as initial lock for imported dep golang.org/x/net
  Trying * (95125df) as initial lock for imported dep gopkg.in/xmlpath.v2
Root project is "<path/to/gopath/repo>"
 1 transitively valid internal packages
 14 external packages imported from 8 projects
(0)   ✓ select (root)
panic: Unknown version type <nil>

goroutine 136 [running]:
github.com/golang/dep/internal/gps.(*singleSourceCacheMemory).toRevision(0xc4201f4c00, 0x0, 0x0, 0x1028e3e, 0xc400000008, 0xc420353140)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source_cache.go:200 +0x270
github.com/golang/dep/internal/gps.(*sourceGateway).convertToRevision(0xc4200749c0, 0x16e0900, 0xc420018718, 0x0, 0x0, 0x14dc03d, 0xc4205afe30, 0x1029506, 0xc420042de0)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source.go:392 +0x52
github.com/golang/dep/internal/gps.(*sourceGateway).listPackages(0xc4200749c0, 0x16e0900, 0xc420018718, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source.go:329 +0x126
github.com/golang/dep/internal/gps.(*SourceMgr).ListPackages(0xc420075440, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x3731656134343036, 0x3565633434666666, 0x3536326437383339, ...)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source_manager.go:403 +0x14d
github.com/golang/dep/internal/gps.(*bridge).breakLock.func1(0xc4203edb00, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/bridge.go:213 +0xc9
created by github.com/golang/dep/internal/gps.(*bridge).breakLock
	/Users/simar/go/src/github.com/golang/dep/internal/gps/bridge.go:214 +0x240

What did you expect to see?

dep init working without a panic and setting up dependencies as expected.

What did you see instead?

dep panicking.

panic: Unknown version type <nil>

goroutine 136 [running]:
github.com/golang/dep/internal/gps.(*singleSourceCacheMemory).toRevision(0xc4201f4c00, 0x0, 0x0, 0x1028e3e, 0xc400000008, 0xc420353140)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source_cache.go:200 +0x270
github.com/golang/dep/internal/gps.(*sourceGateway).convertToRevision(0xc4200749c0, 0x16e0900, 0xc420018718, 0x0, 0x0, 0x14dc03d, 0xc4205afe30, 0x1029506, 0xc420042de0)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source.go:392 +0x52
github.com/golang/dep/internal/gps.(*sourceGateway).listPackages(0xc4200749c0, 0x16e0900, 0xc420018718, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source.go:329 +0x126
github.com/golang/dep/internal/gps.(*SourceMgr).ListPackages(0xc420075440, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x3731656134343036, 0x3565633434666666, 0x3536326437383339, ...)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/source_manager.go:403 +0x14d
github.com/golang/dep/internal/gps.(*bridge).breakLock.func1(0xc4203edb00, 0xc4202c80a0, 0x1d, 0x0, 0x0, 0x0, 0x0)
	/Users/simar/go/src/github.com/golang/dep/internal/gps/bridge.go:213 +0xc9
created by github.com/golang/dep/internal/gps.(*bridge).breakLock
	/Users/simar/go/src/github.com/golang/dep/internal/gps/bridge.go:214 +0x240
@carolynvs
Copy link
Collaborator

Can you provide the original glide config files? Looks like a bug in the glide importer, notice that all the initial locks are the same revision 95125df.

@simar7
Copy link
Author

simar7 commented Sep 5, 2017

Hey @carolynvs for sure, please see below.

glide.yaml

package: <package/name>
import:
- package: github.com/gorilla/mux
  version: v1.3.0
- package: github.com/hashicorp/logutils
- package: github.com/dgrijalva/jwt-go
  version: v3.0.0
- package: github.com/satori/go.uuid
  version: v1.1.0
- package: github.com/garyburd/redigo
  version: v1.0.0
  subpackages:
  - redis
- package: github.com/emicklei/forest
- package: github.com/wsxiaoys/terminal
  subpackages:
  - color
- package: gopkg.in/xmlpath.v2
- package: golang.org/x/net
  subpackages:
  - html
- package: github.com/stretchr/testify
  subpackages:
  - assert
- package: github.com/davecgh/go-spew
  subpackages:
  - spew
- package: github.com/pmezard/go-difflib
  subpackages:
  - difflib
- package: github.com/aws/aws-sdk-go
  version: v1.8.4
  subpackages:
  - service/dynamodb
  - aws/session
  - service/dynamodb/dynamodbattribute

glide.lock

hash: f9b866af758a04c829c2aecd148e52464cabfbb5c428e5943b8416214992ad5c
updated: 2017-03-30T15:41:16.780451659-07:00
imports:
- name: github.com/aws/aws-sdk-go
  version: ""
  subpackages:
  - service/dynamodb
  - aws/session
  - service/dynamodb/dynamodbattribute
  - aws
  - aws/awserr
  - aws/awsutil
  - aws/client
  - aws/client/metadata
  - aws/request
  - aws/signer/v4
  - private/protocol
  - private/protocol/jsonrpc
  - aws/corehandlers
  - aws/credentials
  - aws/credentials/stscreds
  - aws/defaults
  - aws/endpoints
  - private/protocol/rest
  - private/protocol/json/jsonutil
  - service/sts
  - aws/credentials/ec2rolecreds
  - aws/credentials/endpointcreds
  - aws/ec2metadata
  - private/protocol/query
  - private/protocol/query/queryutil
  - private/protocol/xml/xmlutil
- name: github.com/davecgh/go-spew
  version: ""
  subpackages:
  - spew
- name: github.com/dgrijalva/jwt-go
  version: ""
- name: github.com/emicklei/forest
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
- name: github.com/garyburd/redigo
  version: ""
  subpackages:
  - redis
  - internal
- name: github.com/go-ini/ini
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
- name: github.com/gorilla/context
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
- name: github.com/gorilla/mux
  version: ""
- name: github.com/hashicorp/logutils
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
- name: github.com/jmespath/go-jmespath
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
- name: github.com/pmezard/go-difflib
  version: ""
  subpackages:
  - difflib
- name: github.com/satori/go.uuid
  version: ""
- name: github.com/stretchr/testify
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
  subpackages:
  - assert
- name: github.com/wsxiaoys/terminal
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
  subpackages:
  - color
- name: golang.org/x/net
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
  subpackages:
  - html
  - html/atom
- name: gopkg.in/xmlpath.v2
  version: 95125df35a2d14d3e61b9d76d9e4b97160691d34
testImports: []

@sdboyer
Copy link
Member

sdboyer commented Sep 5, 2017

@carolynvs when we get to the fix on this one, can we try to make sure to include some regression tests for this + similar cases?

@carolynvs
Copy link
Collaborator

Ah okay yeah I totally did not expect that a valid glide.lock would contain empty revisions

- name: github.com/garyburd/redigo
  version: ""

I'll make sure #1100 has a testcase for this as well so that it's covered for all importers.

@carolynvs
Copy link
Collaborator

@simar7 FYI, I am only looking at fixing how dep handles missing revisions in glide.lock.

I'm not sure if the glide files you posted are "scrubbed"(?) but the lock is invalid. Even after I fix the panic, dep init isn't going to import the revisions in the glide.lock because every package has the same non-existing revision. So dep is going to essentially ignore glide.lock completely, and just import the constraints from the glide.yaml file.

@simar7
Copy link
Author

simar7 commented Sep 6, 2017

@carolynvs Correct me if I'm wrong but I believe the reason version: "" shows up the way it is, if you choose to skip ranges (lock the current version) while doing a glide setup.

@carolynvs
Copy link
Collaborator

I just ran glide install on the config files you provided and it errors out due to the bad revisions. I don't know enough about glide to really comment further, but I don't consider it to be a dep problem (beyond addressing the panic, which will be fixed in #1100).

@carolynvs
Copy link
Collaborator

The panic has been fixed in #1100.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants