A test runner that could not create a scratch file
One denied mktemp stopped every commit. Toggle the two
conditions to see where the failure lands.
Why TMPDIR is not the workaround
$ TMPDIR=/unwritable mktemp
/var/folders/7v/.../T/tmp.iGOVlVqii5 <-- TMPDIR ignored
$ TMPDIR=/unwritable mktemp "$TMPDIR/x.XXXXXX"
mktemp: mkstemp failed: Operation not permitted <-- honoured
macOS mktemp with no TEMPLATE ignores TMPDIR
entirely. That is why setting it looks like a fix and proves nothing, and
why the template is the actual repair rather than a style preference.
The part that is almost funny
Two of the tests this runner executes were written to catch a denied
mktemp silently zeroing a count. Both used a bare
mktemp -d themselves, so both died of the condition they
exist to detect. They pass in CI, whose temp dir works, and fail in
exactly the environment the bug lives in.
Order of preference:
TMPDIR, then /tmp, then a
gitignored tests/.tmp/ beside the runner. A named failure if all
three are unusable, never a silent one.