Skip to content

Commit 80fb18e

Browse files
committed
cmd/go: avoid ssh known_hosts prompts on test
TestScripts/mod_get_svn would stop with the following prompt if the real user didn't have vcs-test.golang.org in their known_hosts file: The authenticity of host 'vcs-test.golang.org (35.184.38.56)' can't be established. ECDSA key fingerprint is SHA256:[...] Are you sure you want to continue connecting (yes/no/[fingerprint])? This was bad because it relied on the user's real ssh known_hosts file. Worse even, if the user didn't expert or notice the prompt, it could hang a 'go test' run for quite a while. Work around that by forcing svn to not use ssh at all. Other potentially better approaches were tried, but none worked on svn 1.12.2 with openssh 8.0p1. Fixes #33883. Change-Id: I2f925fa892f2fa53c77d86b0034141162517ee69 Reviewed-on: https://go-review.googlesource.com/c/go/+/199142 Run-TryBot: Daniel Martí <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 11b3368 commit 80fb18e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cmd/go/testdata/script/mod_get_svn.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
[!net] skip
22
[!exec:svn] skip
33

4+
# 'go get' will fall back to svn+ssh once svn fails over protocols like https.
5+
# If vcs-test.golang.org isn't in the user's known_hosts file, this will result
6+
# in an ssh prompt, which will stop 'go test' entirely
7+
#
8+
# Unfortunately, there isn't a way to globally disable host checking for ssh,
9+
# without modifying the real system's or user's configs. Changing $HOME won't
10+
# affect ssh either, as it ignores the environment variable entirely.
11+
#
12+
# However, a useful trick is pointing SVN_SSH to a program that doesn't exist,
13+
# resulting in svn skipping ssh entirely. Alternatives like
14+
# SVN_SSH="ssh -o StrictHostKeyChecking=no" didn't avoid the prompt.
15+
env SVN_SSH="svn_do_not_use_ssh"
16+
417
env GO111MODULE=on
518
env GOPROXY=direct
619
env GOSUMDB=off

0 commit comments

Comments
 (0)