Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/vgo: disable git password prompts #25544

Closed
t94j0 opened this issue May 24, 2018 · 5 comments
Closed

x/vgo: disable git password prompts #25544

t94j0 opened this issue May 24, 2018 · 5 comments
Milestone

Comments

@t94j0
Copy link

t94j0 commented May 24, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10.2 linux/amd64
go version go1.10.2 linux/amd64 vgo:2018-02-20.1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Manjaro Linux

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/Programming/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build576044457=/tmp/go-build -gno-record-gcc-switches"

What did you do?

The company I am working for has a GitLab server hosting our Go packages. We all connect to the git server with SSH keys. Co-workers and I used vgo build ..

This should be reproducable if you have a private GitHub repository, SSH keys attached to your account (https://github.com/settings/keys) with passwords on them and do a vgo get github.com/USER/PRIVATE_REPO.

What did you expect to see?

vgo: resolving import "gitlabserver.local/user/repo"
vgo: finding gitlabserver.local/user/repo (latest)
vgo: adding gitlabserver.local v0.0.1

What did you see instead?

An infinite loop of asking Enter passphrase for key '/home/user/.ssh/id_rsa':. This is a normal message when doing git clone gitlab.server.local/user/repo, but only once. You would imagine vgo would ask for the SSH keys recursively for every local Go package which is a requirement of the /user/repo package, but when doing an strace, it shows that nothing is really happening:

--- CUT ---
futex(0xb999e8, FUTEX_WAIT, 0, NULLvgo: finding github.com/lib/pq (latest)
vgo: adding github.com/lib/pq v0.0.0-20180523175426-90697d60dd84
)    = 0
vgo: resolving import "gitlabserver.local/user/package/subpackage"
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = -1 EAGAIN (Resource temporarily unavailable)
futex(0xc42007c148, FUTEX_WAKE, 1)      = 1
futex(0xb9cfe0, FUTEX_WAIT, 0, {tv_sec=29, tv_nsec=999605255}) = 0
futex(0xb9cfe0, FUTEX_WAIT, 0, {tv_sec=29, tv_nsec=993649801}Enter passphrase for key '/home/user/.ssh/id_rsa': 
Enter passphrase for key '/home/user/.ssh/id_rsa': 
Enter passphrase for key '/home/user/.ssh/id_rsa': ) = -1 ETIMEDOUT (Connection timed out)
futex(0xb98f90, FUTEX_WAKE, 1)          = 1
futex(0xb98eb0, FUTEX_WAKE, 1)          = 1
futex(0xb999e8, FUTEX_WAIT, 0, NULL
)    = 0
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xc42007d148, FUTEX_WAKE, 1)      = 1
read(6, 0xc420252000, 512)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xc420047548, FUTEX_WAKE, 1)      = 1
read(6, 0xc420270c00, 512)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = -1 EAGAIN (Resource temporarily unavailable)
futex(0xc42007c548, FUTEX_WAKE, 1)      = 1
read(6, 0xc420250200, 512)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xb999e8, FUTEX_WAIT, 0, NULLEnter passphrase for key '/home/user/.ssh/id_rsa': 
)    = 0
futex(0xc42007c548, FUTEX_WAKE, 1)      = 1
read(6, 0xc420269200, 512)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xb999e8, FUTEX_WAIT, 0, NULL)    = 0
futex(0xc42007d148, FUTEX_WAKE, 1)      = 1
read(6, 0xc420250400, 512)              = -1 EAGAIN (Resource temporarily unavailable)
futex(0xb999e8, FUTEX_WAIT, 0, NULLEnter passphrase for key '/home/user/.ssh/id_rsa': 

This is returned infinitely.

@gopherbot gopherbot added this to the vgo milestone May 24, 2018
@rsc
Copy link
Contributor

rsc commented May 24, 2018

It can do multiple git commands per repo, sorry. I don't think it's an infinite loop, just very annoying. Regular "go get" disables git prompting for passwords entirely. Probably vgo should do the same.

@rsc rsc changed the title x/vgo: Infinite loop asking for SSH password when vgo build on package x/vgo: disable git password prompts May 24, 2018
@t94j0
Copy link
Author

t94j0 commented May 24, 2018

I thought so too when I first looked at it and kept entering the SSH password, but after looking at the strace, it seems like it's not really doing anything but waiting on a futex and asking for the password again.

@gopherbot
Copy link

Change https://golang.org/cl/114522 mentions this issue: vendor/cmd/go/internal/vgo: disable password prompt and SSH connection pooling

@pwaller
Copy link
Contributor

pwaller commented May 25, 2018

@t94j0: Out of interest, how are you running strace? If you don't run with -f, you won't have the full picture because by default strace doesn't follow forks, which means you can be missing a substantial amount of execution just within the Go code, since Go uses threads.

@t94j0
Copy link
Author

t94j0 commented May 25, 2018

@pwaller I didn't run with the -f option, and didn't know that option existed. When using -f, strace shows it trying pulling the repositories.

It makes sense now. Thanks!

@golang golang locked and limited conversation to collaborators May 25, 2019
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

4 participants