From 86a532d40c2fbfb5881fe19d12b565cf607c0cb0 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 16:34:54 -1000 Subject: Make the early-exit filter meet a closed pipe The email filter was handed a few bytes, which usually sit in the pipe before the filter has even exited, so a cgit that died of SIGPIPE passed most runs. A source filter handed more than a pipe holds has to see the write fail. --- tests/t0303-robustness.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index b189334..9ae0347 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -258,14 +258,17 @@ test_expect_success 'a filter that cannot run answers one error page' ' # The filter may exit before or after cgit writes to it, so the page either # completes or ends where the write failed. Either way cgit answers once and -# exits cleanly rather than dying of SIGPIPE. +# exits cleanly rather than dying of SIGPIPE. The file outgrows the pipe, so +# the write has to block and then fail however the two sides are scheduled. test_expect_success 'a filter that exits without reading does not end cgit' ' - { - echo "email-filter=exec:true" && - cat robrc - } >truerc && - cgit_rc truerc "url=rob/log/" >tmp && - test $(grep -c "^Status:" tmp) = 1 + mkrepo repos/quit 1 && + test_seq 20000 >repos/quit/big.txt && + git -C repos/quit add big.txt && + git -C repos/quit commit -q -m big && + cgitrc_repo quitrc quit source-filter=exec:true && + cgit_rc quitrc "url=quit/tree/big.txt" >tmp 2>err && + test $(grep -c "^Status:" tmp) = 1 && + test_grep "
blob: " tmp ' test_expect_success 'a commit encoding header is read without its newline' ' -- cgit 2.12.1