From: Jeff King <peff@peff.net>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] t5564: use a short path for the SOCKS proxy socket
Date: Mon, 27 Apr 2026 22:33:50 -0400 [thread overview]
Message-ID: <20260428023350.GB660154@coredump.intra.peff.net> (raw)
In-Reply-To: <pull.2100.git.1777299669889.gitgitgadget@gmail.com>
On Mon, Apr 27, 2026 at 02:21:09PM +0000, Johannes Schindelin via GitGitGadget wrote:
> The SOCKS proxy test introduced in 0ca365c2ed4 (http: do not ignore
> proxy path, 2024-08-02) creates a Unix domain socket in
> `$TRASH_DIRECTORY`. When the trash directory path is long (e.g.
> when running from a deeply nested worktree), the socket path can
> exceed the 108-character limit for `struct sockaddr_un.sun_path` on
> Linux, causing the test to fail with "Path length ... is longer
> than maximum supported length (108)".
OK. We try to work around this with a chdir in our own socket code, but
I guess we're not using it here:
1. The socket is created by our socks4-proxy.pl script, which just
feeds it to perl's IO::Socket::UNIX. And it looks like it
recognizes the long path and complains. We could fix that, but...
2. The reading side is implemented by libcurl, not by us. And it seems
to similarly detect and complain. We _could_ work around that with
a chdir, but it would be quite nasty, as we'd have to do it before
every curl call. So that's probably off the table.
And so we are stuck with either using a relative path, or a known-small
one.
> Move the socket to `$TMPDIR` (defaulting to `/tmp`) where the path
> is short, following the same approach used in t7528 for the SSH
> agent socket in b7fb2194b96 (t7528: work around ETOOMANY in OpenSSH
> 10.1 and newer, 2025-10-23).
OK, there we went with the known-small solution, since openssh made it
easy to do so. I think that is OK here, but...
> # The %30 tests that the correct amount of percent-encoding is applied to the
> # proxy string passed to curl.
> +# Use a short path for the socket to avoid exceeding the 108-character
> +# Unix domain socket limit when the trash directory path is long.
> +SOCKS_SOCK="${TMPDIR:-/tmp}/git-test-socks-%30.sock"
This is a static path in /tmp, so:
1. Multiple instances of the test suite will stomp on each other
(e.g., a --stress run).
2. It creates a tmpdir-race vulnerability if an attacker links that
path to something precious writeable by the user running the tests.
I think it would be sufficient to use mktemp to get a unique name. We
don't want a file, of course, so we perhaps need "mktemp -d" to get a
temp directory, and then we can use whatever short name we like inside
it.
> test_lazy_prereq SOCKS_PROXY '
> test_have_prereq PERL &&
> - start_socks "$TRASH_DIRECTORY/%30.sock"
> + start_socks "$SOCKS_SOCK"
> '
>
> test_atexit '
> test ! -e "$TRASH_DIRECTORY/socks.pid" ||
> kill "$(cat "$TRASH_DIRECTORY/socks.pid")"
> + rm -f "$SOCKS_SOCK"
> '
And the rest of your path can remain as-is, since SOCKS_SOCK will have
the unique name in it.
-Peff
next prev parent reply other threads:[~2026-04-28 2:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 14:21 [PATCH] t5564: use a short path for the SOCKS proxy socket Johannes Schindelin via GitGitGadget
2026-04-28 2:33 ` Jeff King [this message]
2026-04-29 8:22 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2026-05-01 6:47 ` 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=20260428023350.GB660154@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
/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