]> Kevux Git Server - rit/commit
t5564: use a short path for the SOCKS proxy socket
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 29 Apr 2026 08:22:54 +0000 (08:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Apr 2026 12:39:11 +0000 (21:39 +0900)
commitb33bea27a2fa5168b8881d73d6c9c6133b046b87
tree116a511f7e83551c7943d74663c188e9d224d086
parent94f057755b7941b321fd11fec1b2e3ca5313a4e0
t5564: use a short path for the SOCKS proxy socket

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)".

We cannot work around this using the chdir trick our own socket code
employs, because both sides of the connection are outside our control:
the socket is created by socks4-proxy.pl via Perl's IO::Socket::UNIX,
and the client side is libcurl.

Use `mktemp -d` to create a unique temporary directory with a short
path, and place the socket inside it. This avoids collisions between
concurrent test runs (e.g. `--stress`) and tmpdir-race vulnerabilities
that a static `/tmp` path would be susceptible to.

Helped-by: Jeff King <peff@peff.net>
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5564-http-proxy.sh