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

Re: TMPDIR vs TMPPREFIX again



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}}" 


On Thu, Aug 13, 2026 at 11:17 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
On Thu, Aug 13, 2026 at 9:52 PM Daniel Colascione <dancol@xxxxxxxxxx> wrote:
>
> Might it be possible (as others have suggested over the years) to
> incorporate TMPDIR into TMPPREFIX so that zsh works properly when run in
> an environment with read-only /tmp but writable TMPDIR?

How would that work in practice?

% echo $TMPPREFIX
/tmp/zsh
% echo $TMPDIR

% TMPDIR=/foo/tmp
% echo $TMPPREFIX # do you expect this to be different now? what if
the user had set it manually? etc?

It is also really trivial to just set TMPPREFIX yourself to whatever
value you want, no?

--
Mikael Magnusson



--
Mark J. Reed <markjreed@xxxxxxxxx>


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