Skip to content

Commit b7fb219

Browse files
pks-tgitster
authored andcommitted
t7528: work around ETOOMANY in OpenSSH 10.1 and newer
In t7528 we spawn an SSH agent to verify that we can sign a commit via it. This test has started to fail on some machines: +++ ssh-agent unix_listener_tmp: path "/home/pks/Development/git/build/test-output/trash directory.t7528-signed-commit-ssh/.ssh/agent/s.UTulegefEg.agent.UrPHumMXPq" too long for Unix domain socket main: Couldn't prepare agent socket As it turns out this is caused by a change in OpenSSH 10.1 [1]: * ssh-agent(1), sshd(8): move agent listener sockets from /tmp to under ~/.ssh/agent for both ssh-agent(1) and forwarded sockets in sshd(8). Instead of creating the socket in "/tmp", OpenSSH now creates the socket in our home directory. And as the home directory gets modified to be located in our test output directory we end up with paths that are somewhat long. But Linux has a rather short limit of 108 characters for socket paths, and other systems have even lower limits, so it is very easy now to exceed the limit and run into the above error. Work around the issue by using `ssh-agent -T`, which instructs it to use the old behaviour and create the socket in "/tmp" again. This switch has only been introduced with 10.1 though, so for older versions we have to fall back to not using it. That's fine though, as older versions know to put the socket into "/tmp" already. An alternative approach would be to abbreviate the socket name itself so that we create it as e.g. "sshsock" in the trash directory. But taking the above example we'd still end up with a path that is 91 characters long. So we wouldn't really have a lot of headroom, and it is quite likely that some developers would see the issue on their machines. [1]: https://www.openssh.com/txt/release-10.1 Reported-by: Xi Ruoyao <[email protected]> Suggested-by: brian m. carlson <[email protected]> Helped-by: Jeff King <[email protected]> Helped-by: Lauri Tirkkonen <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 81f86aa commit b7fb219

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t7528-signed-commit-ssh.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test_expect_success GPGSSH 'create signed commits' '
8282
test_expect_success GPGSSH 'sign commits using literal public keys with ssh-agent' '
8383
test_when_finished "test_unconfig commit.gpgsign" &&
8484
test_config gpg.format ssh &&
85-
eval $(ssh-agent) &&
85+
eval $(ssh-agent -T || ssh-agent) &&
8686
test_when_finished "kill ${SSH_AGENT_PID}" &&
8787
test_when_finished "test_unconfig user.signingkey" &&
8888
mkdir tmpdir &&

0 commit comments

Comments
 (0)