Re: TMPDIR vs TMPPREFIX again

"Mark J. Reed" <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAA=-s3znyMu3iNFsmF8WT69m5GL0uTSrUCCcby1rtnCD+HJb7g@mail.gmail.com>
Except by the time any system initialization file is executing, TMPPREFIX
has already been set by zsh itself.

Given the ubiquity of TMPDIR (it's used at least on BSD, Linux, and macOS)
it seems like Zsh should honor it if set. I mean, if it just used the C
library's `mkdtemp` instead of using a hard-coded path, it would get TMPDIR
support for free..

On Fri, Aug 14, 2026 at 10:48 AM Peter Stephenson <
[email protected]> wrote:

>  On 14/08/2026 15:28 BST Mark J. Reed <[email protected]> wrote:
> >
> >
> > How does TMPPREFIX get initialized? At least on my Mac, it's not set
> > in the environment before zsh starts - but TMPDIR is, set by the OS.
> > It seems like in that case zsh should initialize TMPPREFIX using
> > TMPDIR instead of /tmp. If I were writing the initialization as a ?>
> shell command I'd probably go with this:
> >
> >  : "${TMPPREFIX:=${TMPDIR:-/tmp}/zsh}}"
>
> The zsh source code doesn't treat TMPDIR as special at all, so this
> looks to me like something to go in an initialisation file, indeed
> it looks like it would make sense in a general system initialisation
> file.
>
> pws
>
>

-- 
Mark J. Reed <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.