Skip to content

Integration tests fail in local setup #7888

Closed
@guillep2k

Description

@guillep2k

Apparently #7855 introduces a regresion. Unfortunately those changes broke my ability to perform the integration tests on my server (plain old Linux, no drone). I start the tests and they run smoothly for a while with the follwing command:

TAGS="pam bindata sqlite sqlite_unlock_notify" make clean generate build test-sqlite 

After some time the tests stop for ssh to asks me to add localhost to the list of known hosts. The expected behaviour is to ignore such information and proceed without asking, but it fails to do so (and the rest of what's supposed to) because its command line is garbled (extracted from /proc/{pid}/cmdline):

argv[0] = ssh
argv[1] = -o
argv[2] = UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "IdentitiesOnly=yes" -i "/tmp/key-file169898395/my-testing-key
argv[3] = -p
argv[4] = 2203
argv[5] = --
argv[6] = git@localhost.git-lfs-authenticate user2/repo-tmp-18.git upload

argv[2] wrongly contains several parameters in the same position. What I expected was the ssh command to be launched like:

argv[0] = ssh
argv[1] = -o
argv[2] = UserKnownHostsFile=/dev/null
argv[3] = -o
argv[4] = StrictHostKeyChecking=no
argv[5] = -o
argv[6] = IdentitiesOnly=yes
argv[7] = -i
argv[8] = /tmp/key-file169898395/my-testing-key
argv[9] = -p
argv[10] = 2203
argv[11] = --
argv[12] = git@localhost.git-lfs-authenticate user2/repo-tmp-18.git upload

The parent process, which is /bin/git-lfs pre-push origin ssh://git@localhost:2203/user2/repo-tmp-18.git, has the following environment variable:

GIT_SSH_COMMAND=ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "IdentitiesOnly=yes" -i "/tmp/key-file010133453/my-testing-key"

(Also took form /proc/{pid}/environ).

Somehow the quotes get garbled when passed down from parser to parser. I've temporarily fixed this in my enviroment by removing the quotes:

diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go
index 9190d4bb4..5b7da085e 100644
--- a/integrations/git_helper_for_declarative_test.go
+++ b/integrations/git_helper_for_declarative_test.go
@@ -38,7 +38,7 @@ func withKeyFile(t *testing.T, keyname string, callback func(string)) {

        //Setup ssh wrapper
        os.Setenv("GIT_SSH_COMMAND",
-               "ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\"")
+               "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i "+keyFile)
        os.Setenv("GIT_SSH_VARIANT", "ssh")

        callback(keyFile)

Changing the double quotes " into singe ones ' produces wrong results as well.

Basically, I've reverted the effect of this PR. I don't know whether it's a problem in my environment, and it has an easy (local) fix, but I figured I'd let you guys know anyway.

$ ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017 
$ git version
git version 2.22.0
$ bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
$ uname -a
Linux SREP 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(CentOS 7)
$ go version
go version go1.12.6 linux/amd64

I've also tried with zsh, to no avail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions