Re: [PATCH v4 12/12] t: detect errors outside of test cases
- From
Jeff King <peff@peff.net>
- Date
- Apr 18, 2026, 21:30 UTC
- Message-ID
- <20260418213043.GB9632@coredump.intra.peff.net>
- In-Reply-To
- <aePY1x9uO39p6WDI@fruit.crustytoothpaste.net>
On Sat, Apr 18, 2026 at 07:17:43PM +0000, brian m. carlson wrote:
> Having said that, I actually think that mksh may be right in at least > one case. For instance, this diff seems required for mksh to pass t1410 > and I believe this is actually the right thing to do:
I think mksh is wrong here, if it is flagging this fsck call.
Show 13 quoted lines
> diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
> index ce71f9a30a..f289fc11e9 100755
> --- a/t/t1410-reflog.sh
> +++ b/t/t1410-reflog.sh
> @@ -23,7 +23,7 @@ check_have () {
> }
>
> check_fsck () {
> - git fsck --full >fsck.output
> + git fsck --full >fsck.output || true
> case "$1" in
> '')
> test_must_be_empty fsck.output ;;If check_fsck() were run by itself then yes, this would be a problem. But it is always run inside a test snippet, and there "set -e" should always be suppressed because test_expect_success does:
if test_run_ "$test_body"
So we are inside a conditional, and the usual global "set -e" suppression should happen. It sounds like it is not happening in your version of mksh, but I was unable to get t1410 to fail at all using mksh 59c-43 (from Debian unstable) or 59c-41 (from stable).
And it is a good thing that this "if" suppression is here, or else tests who fail the final component of the &&-chain would cause the shell to exit. The simplest case is just:
test_expect_success 'bad' 'false'
If "set -e" were in effect, then the whole script would bail upon seeing that "false".
-Peff