Skip to content

Commit 902537c

Browse files
committed
t5564: use a short path for the SOCKS proxy socket
The SOCKS proxy test introduced in 0ca365c (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)". 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 (b7fb219, t7528: work around ETOOMANY in OpenSSH 10.1 and newer, 2025-10-23). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Assisted-by: Claude Opus 4.6
1 parent 8d6525b commit 902537c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

t/t5564-http-proxy.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ start_socks() {
5050

5151
# The %30 tests that the correct amount of percent-encoding is applied to the
5252
# proxy string passed to curl.
53+
# Use a short path for the socket to avoid exceeding the 108-character
54+
# Unix domain socket limit when the trash directory path is long.
55+
SOCKS_SOCK="${TMPDIR:-/tmp}/git-test-socks-%30.sock"
56+
5357
test_lazy_prereq SOCKS_PROXY '
5458
test_have_prereq PERL &&
55-
start_socks "$TRASH_DIRECTORY/%30.sock"
59+
start_socks "$SOCKS_SOCK"
5660
'
5761

5862
test_atexit '
5963
test ! -e "$TRASH_DIRECTORY/socks.pid" ||
6064
kill "$(cat "$TRASH_DIRECTORY/socks.pid")"
65+
rm -f "$SOCKS_SOCK"
6166
'
6267

6368
# The below tests morally ought to be gated on a prerequisite that Git is
@@ -70,7 +75,8 @@ old_libcurl_error() {
7075

7176
test_expect_success SOCKS_PROXY 'clone via Unix socket' '
7277
test_when_finished "rm -rf clone" &&
73-
test_config_global http.proxy "socks4://localhost$PWD/%2530.sock" && {
78+
socks_proxy_url="socks4://localhost$(echo "$SOCKS_SOCK" | sed "s/%/%25/g")" &&
79+
test_config_global http.proxy "$socks_proxy_url" && {
7480
{
7581
GIT_TRACE_CURL=$PWD/trace \
7682
GIT_TRACE_CURL_COMPONENTS=socks \

0 commit comments

Comments
 (0)