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

panic when using custom SSH client #519

@dirkaholic

Description

@dirkaholic

I was about to use the recently added feature of using a custom SSH client config. However I ran into the following panic when trying to clone a repo:

NewKnownHostsCallback: 0xa4d070
git clone [email protected]:organization/project.git using branch refs/heads/test/automator-playground2 to /tmp/repo ...
panic: reflect: reflect.Value.Set using unaddressable value

goroutine 1 [running]:
reflect.flag.mustBeAssignable(0x99)
	/usr/local/go/src/reflect/value.go:228 +0xf9
reflect.Value.Set(0xba1660, 0xc4201f8540, 0x99, 0xba1660, 0xc4201f8480, 0x99)
	/usr/local/go/src/reflect/value.go:1345 +0x2f
gopkg.in/src-d/go-git.v4/plumbing/transport/ssh.overrideConfig(0xc4201f8180, 0xc4201f83c0)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/common.go:155 +0x262
gopkg.in/src-d/go-git.v4/plumbing/transport/ssh.(*command).connect(0xc42006f950, 0x7f827c0502f0, 0xc4201b1cb0)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/common.go:107 +0xce
gopkg.in/src-d/go-git.v4/plumbing/transport/ssh.(*runner).Command(0xc4201b6090, 0xc24b44, 0xf, 0xf55120, 0xc4202163f0, 0x7f827c0502f0, 0xc4201b1cb0, 0xa5107e, 0xb2cb20, 0xc4201b1530, ...)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/common.go:40 +0xb8
gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common.(*client).newSession(0xc4201b5a40, 0xc24b44, 0xf, 0xf55120, 0xc4202163f0, 0x7f827c0502f0, 0xc4201b1cb0, 0x0, 0xf55120, 0xc4202163f0)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common/common.go:103 +0x96
gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common.(*client).NewUploadPackSession(0xc4201b5a40, 0xf55120, 0xc4202163f0, 0x7f827c0502f0, 0xc4201b1cb0, 0xc4202163f0, 0x0, 0x0, 0xc4201b5c50)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common/common.go:80 +0x6f
gopkg.in/src-d/go-git%2ev4.newUploadPackSession(0xc4201b2680, 0x2f, 0x7f827c0502f0, 0xc4201b1cb0, 0xc420214bc0, 0xc420157c50, 0xa61d9e, 0xc42006f8a0)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/remote.go:207 +0xb3
gopkg.in/src-d/go-git%2ev4.(*Remote).fetch(0xc420214a80, 0xc420157cb8, 0x0, 0x0, 0x0, 0x0)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/remote.go:150 +0x12c
gopkg.in/src-d/go-git%2ev4.(*Repository).clone(0xc420216120, 0xc4201fa930, 0x410c00, 0xc420216120)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/repository.go:395 +0x1b8
gopkg.in/src-d/go-git%2ev4.PlainClone(0xc4201b4fe0, 0x9, 0x0, 0xc4201fa930, 0x0, 0x0, 0x88)
	/home/organization/development/go/src/gopkg.in/src-d/go-git.v4/repository.go:289 +0x8b
gitlab.com/organization/project-api/service.(*GitService).CloneRepo(0xc4201b9fc0, 0xc4201b1e30, 0x1)
	/home/organization/development/go/src/gitlab.com/organization/project-api/service/git.go:174 +0x331
main.main()
	/home/organization/development/go/src/gitlab.com/organization/project-api/main.go:40 +0x80e

After some investigation I tried to replace

if isZeroValue(vcf) {

with

if isZeroValue(vcf) && vcf.CanSet() {

in common.go:154 but then not a single setting was overwritten.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions