From 49bed79276574b0fd482dbc48f24b76e3890b229 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 18:36:28 -1000 Subject: Test an exec filter killed by a signal --- tests/t0201-filters.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index f84774f..d928dec 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -93,6 +93,21 @@ test_expect_success 'a content filter that exits non-zero still renders the page test_grep "
commit 5" tmp ' +# A filter killed by a signal leaves no exit status to go on, so the request +# ends there. The auth filter runs before any of the page is out, which lets +# the error page carry its own status. +test_expect_success 'a filter killed by a signal ends the request' ' + write_script killed-filter <<-\EOF && + cat >/dev/null + kill -9 $$ + EOF + cgitrc_repo killedrc foo "auth-filter=exec:$PWD/killed-filter" && + cgit_rc killedrc "url=foo/" >tmp 2>err && + test $(grep -c "^Status:" tmp) = 1 && + test_grep "^Status: 500" tmp && + test_grep -F "Subprocess $PWD/killed-filter exited abnormally" err +' + # A die inside a lua filter has to reach the visitor as an error page rather # than being fed back into the filter that just failed, and the reason goes to # the log. -- cgit 2.12.1