From 7c1200745bec3034c98d6e44bd5f620849dbe2ba Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 15 Sep 2021 13:24:52 -0400 Subject: t1400: avoid SIGPIPE race condition on fifo t1400.190 sometimes fails or even hangs because of the way it uses fifos. Our goal is to interactively read and write lines from update-ref, so we have two fifos, in and out. We open a descriptor connected to "in" and redirect output to that, so that update-ref does not see EOF as it would if we opened and closed it for each "echo" call. But we don't do the same for the output. This leads to a race where our "read response Signed-off-by: Junio C Hamano --- t/t1400-update-ref.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 1e754e258f..0d4f73acaa 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -1603,11 +1603,13 @@ test_expect_success PIPE 'transaction flushes status updates' ' (git update-ref --stdin out &) && exec 9>in && + exec 8&-" && + test_when_finished "exec 8<&-" && echo "start" >&9 && echo "start: ok" >expected && - read line actual && test_cmp expected actual && @@ -1615,7 +1617,7 @@ test_expect_success PIPE 'transaction flushes status updates' ' echo prepare >&9 && echo "prepare: ok" >expected && - read line actual && test_cmp expected actual && @@ -1625,7 +1627,7 @@ test_expect_success PIPE 'transaction flushes status updates' ' echo commit >&9 && echo "commit: ok" >expected && - read line actual && test_cmp expected actual ' -- cgit v1.2.3