Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: TMPDIR vs TMPPREFIX again
- X-seq: zsh-users 30742
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "Mark J. Reed" <markjreed@xxxxxxxxx>
- Cc: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, zsh <zsh-users@xxxxxxx>
- Subject: Re: TMPDIR vs TMPPREFIX again
- Date: Fri, 14 Aug 2026 18:38:15 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=icPH3vf0SUI0awnWzHW4Kh13PPRASG+c+5nzG691lfs=; fh=v5clBQTlKnJiGoM3EfUGlnoBXczFEoVHe7FUrS9JJXY=; b=EVIee8In2QO2RuOZBqS4k4hK1vSNobsJBP1oze1V9yBuclLuAeik/Iif+tgXbV1vT0 bfyA2KbIbtS+M/sOdiwtxSX/8pCiE1zXt1y23VMZ+qvIGnrlc79dec5OeBNuTXemMUl3 V0NbAN3SbvdjggGos5cUMUDHhRzqZdDZZm9EVikm1dikEVN3oDTeWwd+bBlFNFN+2tVU avSAqBc8rERFU3r2Re4CCHoTtOWgHBkucl32vcxPdrSghcQIi088ff84tXmbbZiJUQYv t4yRXtW1ycY5ViY5xlt+qKC+6pWGc870Q6IOKMPXay8Pt/XH8Qu2SkQmzT46k51/vJE9 ZFbQ==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1786757906; cv=none; d=google.com; s=arc-20260327; b=AE4NAzaRkF3YNy/uxd5xQ1oJ9SC09cF6e0mb07FQtV+eOX2BWK212b5fWS2O5Bn95h aVr8tEBFCQWqRg4Xfs2HCG7MeqKgDO5nXiqAMyg4sJgLK6kUYc+90IRn+u0ApFKvrXwe VUp4f3w4hc10g3Ty5XfavDfb+HVKg61Bff1VESmWOguvKLWcvndNgIlhf9ztoh5xMDkd zzF+dPvmjRyUQuRPHE4oQKW9NAlb4oGpRcwAgigwd7sAkijU+V6IwS2nXEcg1heUTX5B C5uuoU4S3rpD2xBQ3phaW43NaSNEfY66xXrDJh9Eznj/x5gtCfK4UX28HJxYUwAeviwI XWVg==
- Archived-at: <https://zsh.org/users/30742>
- In-reply-to: <CAA=-s3znyMu3iNFsmF8WT69m5GL0uTSrUCCcby1rtnCD+HJb7g@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <87tsox3jbu.fsf@dancol.org> <CAHYJk3S=gwOYELc-rAr=91sKnX=k__Dx=kQu-KmdEM1v0UALLw@mail.gmail.com> <CAA=-s3wJBEmUpWm9jC=gx5kbLnHBL+rUoygy+V7hNB-mRt6o2Q@mail.gmail.com> <1996878155.131147.1786718892530@mail.virginmedia.com> <CAA=-s3znyMu3iNFsmF8WT69m5GL0uTSrUCCcby1rtnCD+HJb7g@mail.gmail.com>
On Fri, Aug 14, 2026 at 8:32 AM Mark J. Reed <markjreed@xxxxxxxxx> wrote:
>
> Except by the time any system initialization file is executing, TMPPREFIX has already been set by zsh itself.
That's not really an argument, system initialization doesn't have to
use Mikael's set-it-if-unset formula, e.g. it could
TMPPREFIX=$TMPDIR/${(M)TMPPREFIX%/zsh}
or even
[[ $TMPPREFIX = $TMPDIR* ]] || TMPPREFIX=...
That aside ...
> Given the ubiquity of TMPDIR (it's used at least on BSD, Linux, and macOS) it seems like Zsh should honor it if set.
It does seem plausible to use environment TMPDIR to initialize
TMPPREFIX, but does it raise vulnerability concerns? (I guess no more
so than importing TMPPREFIX itself?)
> 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..
That's not quite right; mkdtemp would have to be called like
(pseudo-code) mkdtemp(sprintf("%sXXXXXX",getenv("TMPDIR"))) -- it
doesn't automatically incorporate it.
Also mkdtemp creates a directory with a unique name, whereas TMPPREFIX
is (currently) a prefix of unique file name within a fixed directory.
Perhaps the latter "guarantee" might be used somewhere.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author