Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: nofork leaves tmp files behind on errexit and ${foo?bar}



On Sun, May 3, 2026 at 7:55 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> I noticed this because the test suite does this, and my /tmp had a ton
> of zshdo8sar files.

Interesting.  If I run each of the tests separately with
  make check TESTNUM=...
then no /tmp/zsh*(.) file is left behind, but every test leaves
/tmp/zsh.ztst.<->

If I run the entire test suite, then I get two /tmp/zsh*(.) but no
/tmp/zsh.ztst.<->

So there's something fishy going on with either options, or with the
tests cleaning up after themselves.

> the test that explicitly exits rather than depend on errexit does not
> leave the tmpfile behind, which makes me think this can possibly be
> fixed?

Unfortunately it's not simple.  "exit" calls bin_exit() which notices
that we're not at the top level and sets exit_pending without actually
exiting.  ERR_EXIT on the other hand calls realexit() straight from
the depths of exec.c, there's no opportunity to catch it.

There might be a way to unlink the file in advance, but that means
making several larger changes.




Messages sorted by: Reverse Date, Date, Thread, Author