git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 12/12] t: detect errors outside of test cases

From
Jeff King <peff@peff.net>
Date
Apr 19, 2026, 02:10 UTC
Message-ID
<20260419021027.GA1079904@coredump.intra.peff.net>
In-Reply-To
<aeP9stvssuTv0FD7@fruit.crustytoothpaste.net>
On Sat, Apr 18, 2026 at 09:54:58PM +0000, brian m. carlson wrote:
Show 10 quoted lines
> > 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.)

Doh. The problem was none of that, but that I was using Patrick's version of the patch that only turns on "set -e" for bash.

So yeah, after actually enabling "set -e" I do see the failure.
> 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.

I looked up your report in Debian's system. I think you're right that the eval is the problem. The smallest reproduction I came up with is:

  $ dash -ec 'eval "false; true" && echo ok'
  ok
  $ mksh -ec 'eval "false; true" && echo ok'
  [no output]

So it respects "-e" within the eval, which is wrong, and then doubly weird that "-e" bails from the eval but not the whole script.

-Peff
Previous: brian m. carlson
Message 23 of 23 in “t: detect errors outside of test cases”
  1. 00/12 t: detect errors outside of test casesPatrick Steinhardt, Apr 17, 2026
  2. 01/12 t: prepare `test_match_signal ()` calls for `set -e`Patrick Steinhardt, Apr 17, 2026
  3. 02/12 t: prepare `test_must_fail ()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  4. 03/12 t: prepare `stop_git_daemon ()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  5. 04/12 t: prepare `git config --unset` calls for `set -e`Patrick Steinhardt, Apr 17, 2026
  6. 05/12 t: prepare conditional test execution for `set -e`Patrick Steinhardt, Apr 17, 2026
  7. 06/12 t: prepare execution of potentially failing commands for `set -e`Patrick Steinhardt, Apr 17, 2026
  8. 07/12 t: prepare `test_when_finished ()`/`test_atexit()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  9. 08/12 t0008: silence error in subshell when using `grep -v`Patrick Steinhardt, Apr 17, 2026
  10. 09/12 t1301: don't fail in case setfacl(1) doesn't exist or failsPatrick Steinhardt, Apr 17, 2026
  11. 10/12 t6002: fix use of `expr` with `set -e`Patrick Steinhardt, Apr 17, 2026
  12. 11/12 t9902: fix use of `read` with `set -e`Patrick Steinhardt, Apr 17, 2026
  13. 12/12 t: detect errors outside of test casesPatrick Steinhardt, Apr 17, 2026
  14. Jeff KingApr 18, 2026
  15. Ben KnobleApr 18, 2026
  16. Jeff KingApr 18, 2026
  17. Junio C HamanoApr 18, 2026
  18. Jeff KingApr 18, 2026
  19. Patrick SteinhardtApr 20, 2026
  20. brian m. carlsonApr 18, 2026
  21. Jeff KingApr 18, 2026
  22. brian m. carlsonApr 18, 2026
  23. Jeff KingApr 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.