Skip to content

Commit 42b4225

Browse files
gitsterdscho
authored andcommitted
t5512.40 sometimes dies by SIGPIPE
The last test in t5512 we recently added seems to be flaky. Running $ make && cd t && sh ./t5512-ls-remote.sh --stress shows that "git ls-remote foo::bar" exited with status 141, which means we got a SIGPIPE. This test piece was introduced by 9e89dcb (builtin/ls-remote: fall back to SHA1 outside of a repo, 2024-08-02) and is pretty much independent from all other tests in the script (it can even run standalone with everything before it removed). The transport-helper.c:get_helper() function tries to write to the helper. As we can see the helper script is very short and can exit even before it reads anything, when get_helper() tries to give the first command, "capabilities", the helper may already be gone. A trivial fix, presented here, is to make sure that the helper reads the first command it is given, as what it writes later is a response to that command. I however would wonder if the interactions with the helper initiated by get_helper() should be done on a non-blocking I/O (we do check the return value from our write(2) system calls, do we?). Backported-from: e1e0d30 (t5512.40 sometimes dies by SIGPIPE, 2024-09-13) Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cba7e0d commit 42b4225

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/t5512-ls-remote.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ test_expect_success 'v0 clients can handle multiple symrefs' '
405405
test_expect_success 'helper with refspec capability fails gracefully' '
406406
mkdir test-bin &&
407407
write_script test-bin/git-remote-foo <<-EOF &&
408+
read capabilities
408409
echo import
409410
echo refspec ${SQ}*:*${SQ}
410411
EOF

0 commit comments

Comments
 (0)