git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lauri Tirkkonen <lauri@hacktheplanet.fi>
To: Jeff King <peff@peff.net>
Cc: Collin Funk <collin.funk1@gmail.com>,
	Xi Ruoyao <xry111@xry111.site>,
	git@vger.kernel.org
Subject: Re: t7528-signed-commit-ssh.sh fails due to ssh-agent fails to start with ENAMETOOLONG
Date: Fri, 17 Oct 2025 18:52:49 +0900	[thread overview]
Message-ID: <aPIR8fB4w5Jkeiq2@mail.hacktheplanet.fi> (raw)
In-Reply-To: <20251017070912.GA4068463@coredump.intra.peff.net>

Hi Jeff,

On Fri, Oct 17 2025 03:09:12 -0400, Jeff King wrote:
> But looking at this test, there's something even more funky going on.
> Our $HOME will always have a space in it, because no matter where you
> set the root, we will create "trash directory.t7582..." to work in. But
> AFAICT, ssh-agent does not quote the path in its output. So for example:
> 
>   d='/tmp/has spaces'
>   mkdir "$d"
>   HOME=$d ssh-agent
> 
> will produce:
> 
>   SSH_AUTH_SOCK=/tmp/has spaces/.ssh/agent/s.IcPuGe26YY.agent.6PtD3uhM4O; export SSH_AUTH_SOCK;
> 
> which is nonsense to eval. And indeed, the "working" version of this
> test (without a really long root path) produces:
> 
>   ./t7528-signed-commit-ssh.sh: 1: eval: directory.t7528-signed-commit-ssh/.ssh/agent/s.IcPuGe26YY.agent.sOzoazWiDc: not found
> 
> I expected that would cause ssh-add to fail, since our SSH_AUTH_SOCK
> would point to truncated garbage, and we can't talk to the agent. But it
> doesn't even do that. The extra space turns that line from a variable
> assignment into a one-shot variable attached to a command that fails to
> run. And so we're left with the original SSH_AUTH_SOCK from the
> environment, the one in my real $HOME outside of the trash directory.
> Yikes!
> 
> If I unset SSH_AUTH_SOCK in my environment, then the test consistently
> fails. But I'm somewhat amazed that nobody has complained about this
> before. Surely somebody somewhere (especially CI!) is running t7528
> without SSH_AUTH_SOCK set in the environment. Which makes wonder if I'm
> missing something.

I believe the issue surfaced only now because prior to OpenSSH 10.1,
ssh-agent would put its socket in /tmp by default, not under $HOME. See
https://www.openssh.com/txt/release-10.1

We saw this failure in CI on Alpine Linux and worked around by adding -T
to the ssh-agent invocation in this test, but I suppose that won't work
for earlier releases of OpenSSH.
https://gitlab.alpinelinux.org/alpine/aports/-/commit/81a159c8a371c871c1cd0f212881a757160632fb

-- 
Lauri Tirkkonen | lotheac @ IRCnet

  reply	other threads:[~2025-10-17  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  1:52 t7528-signed-commit-ssh.sh fails due to ssh-agent fails to start with ENAMETOOLONG Xi Ruoyao
2025-10-17  2:06 ` Collin Funk
2025-10-17  7:09   ` Jeff King
2025-10-17  9:52     ` Lauri Tirkkonen [this message]
2025-10-17 10:54       ` Jeff King
2025-10-17 19:31         ` brian m. carlson
2025-10-18  9:56           ` Jeff King
2025-10-17 17:42     ` Junio C Hamano
2025-10-18  9:51       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aPIR8fB4w5Jkeiq2@mail.hacktheplanet.fi \
    --to=lauri@hacktheplanet.fi \
    --cc=collin.funk1@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).