Re: nofork leaves tmp files behind on errexit and ${foo?bar}
Bart Schaefer <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAH+w=7Ygtf6FGUAnBenvq=yKhy58XC+xk+u=uQ=QDYNnyLDaqQ@mail.gmail.com> |
On Sun, May 3, 2026 at 7:55 PM Mikael Magnusson <[email protected]> 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.