Re: [PATCH v4 12/12] t: detect errors outside of test cases
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Apr 18, 2026, 21:54 UTC
- Message-ID
- <aeP9stvssuTv0FD7@fruit.crustytoothpaste.net>
- In-Reply-To
- <20260418213043.GB9632@coredump.intra.peff.net>
On 2026-04-18 at 21:30:43, Jeff King wrote:
Show 10 quoted lines
> 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).
It does fail with 59c-43 under `make prove` or if you do `sh ./t1410*.sh --verbose`, assuming that `sh` points to `mksh`, but since the script has a `/bin/sh` shebang, you need to invoke it explicitly with the shell in question, or it will use the system `sh` (dash). (I made this mistake when reproducing the problem.)
Note that the test in question does not exit, but returns this (with `--verbose`):
---- Checking ref database: 100% (1/1), done. Checking object directories: 100% (256/256), done. not ok 7 - corrupt and check ----
and this:
---- Checking ref database: 100% (1/1), done. Checking object directories: 100% (256/256), done. not ok 8 - reflog expire --dry-run should not touch reflog ----
It does seem like this _is_ a bug in mksh, though, which I've reproduced with a test script, so I'll report it there.
-- brian m. carlson (they/them) Toronto, Ontario, CA