diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep the error of a request that dies mid capture
The commit and diff pages collect each file's body before printing it,
and a die in git while one was collected wrote the error page into that
body, which was never sent, so the visitor got a page cut off mid table.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0303-robustness.sh | 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 29 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 5cc7507..1963a2e 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -369,6 +369,35 @@ test_expect_success 'a history with a missing parent renders up to the gap' ' grep "^Status: 500" tmp ' +# The commit page collects each file's diff body before printing it, so a +# die while one is collected has to reach the page rather than the body. +test_expect_success 'a corrupt blob in a collected diff answers the error' ' + git init -q corrupt && + ( + cd corrupt && + test_seq 2000 >f && + git add f && + git commit -q -m one && + test_seq 2000 | sed "s/^5/X/" >f && + git commit -q -a -m two && + blob=$(git rev-parse HEAD:f) && + obj=.git/objects/$(echo $blob | cut -c1-2)/$(echo $blob | cut -c3-) && + size=$(wc -c <$obj) && + chmod u+w $obj && + test_copy_bytes $((size / 2)) <$obj >half && + mv half $obj + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=corrupt" && + echo "repo.path=$PWD/corrupt/.git" + } >corruptrc && + CGIT_CONFIG="$PWD/corruptrc" QUERY_STRING="url=corrupt/commit/" cgit >tmp 2>err && + grep "is corrupt" err && + grep "Unable to complete the request" tmp +' + test_expect_success 'a filter pipeline sees the default SIGPIPE disposition' ' cat >pipe.sh <<-\EOF && #!/bin/sh |
