Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] replacement for mktemp and mkstemp code in Src/utils.c
- X-seq: zsh-workers 44240
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: Clinton Bunch <cdb_zshl@xxxxxxxxxxx>
- Subject: Re: [PATCH] replacement for mktemp and mkstemp code in Src/utils.c
- Date: Sat, 20 Apr 2019 23:57:28 -0500
- Cc: Mikael Magnusson <mikachu@xxxxxxxxx>, zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iEeCkm/ndeUsAmcpoEn710HFc5dNmWqag2VCE5Y8dVg=; b=nu6Z0Mx7xiVybpEWwS7oPNb/qYb/voIDeisVLNpeV6IFlmVhMBQ4S90N6xM0ogrY8I K/Qk1ghPzEAbdu7hWv5eNS946s1ZUrMqxRuryjlvUH6Xx84lv9o9QFf1ThMbjK8wcWL0 CnmcP19OBqscGeTZS8S4iMAiw2wlkuNm4ULWsH9TzgHDZBuYB1UiBCRI9Sis8Xn+VfEM gEKCfRXpWunpvzLTh2/Ee4c8yKJ4nRngST74XRY+EKvYhrbeOGWWSizODounE+41xgEp ytfH99b+8Z0QAAfQen4eotBv79eyzBNB4r+tmufh4OcOGEPEjmSy3aCgTbPauZsiRgNO OMzA==
- In-reply-to: <5315c85d-abda-fdb5-271f-22a7805eea27@zentaur.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Clinton Bunch <cdb_zshl@xxxxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <b72ceb70-aa91-4230-98fe-1ba5cdf0bb46@zentaur.org> <20190420043349.GA52075@CptOrmolo.darkstar> <CAHYJk3ST9=VenXRmJ795TFccvYzvd2PhrtM0YajdNCxi=EPzEA@mail.gmail.com> <5315c85d-abda-fdb5-271f-22a7805eea27@zentaur.org>
On Sat, Apr 20, 2019 at 01:52:24PM -0500, Clinton Bunch wrote:
> Mikael Magnusson wrote:
> > On 4/20/19, Matthew Martin <phy1729@xxxxxxxxx> wrote:
> > > On Fri, Apr 19, 2019 at 02:54:47PM -0500, Clinton Bunch wrote:
> > > > This provides an alternate implementation for generating and opening temp
> > > > file names. I considered only using this implementation on known bad
> > > > systems, but I have no way of knowing all of them (or testing for them in
> > > > configure). I see no reason to expect system implementations of mktemp
> > > > or
> > > > mkstemp to be significantly faster than mine unless written in assembly
> > > > (which seems unlikely).
> > > I would strongly prefer using the implementation only on known bad
> > > systems (or prodding the relevant vendors to fix their system). I don't
> > > think speed should be the main consideration here; rather the primary
> > > concern should be security. While your patch is certainly better than
> > > using the native mktemp on at least one system, it would be worse than
> > > the native mktemp on say FreeBSD which uses arc4random_uniform which
> > > does not require a user provided seed nor does it have modulo bias.
> We still face the problem of determining which systems have broken
> implementations. I know of one, that doesn't mean there aren't others.
> My implementation could easily be modified to use arc4random_uniform on
> those system on which it is available if that's the primary objection. I'd
> have used /dev/urandom (at least as a seed) if it were available everywhere.
Whichever system has the predictable temp file names, it is a bug in
that system not zsh. While zsh can paper over the bug, it would be
preferable to fix the broken implementation in that system's libc so
that all mk(s)temp calls are fixed not just the ones zsh would make.
Including a better alternative for that system is an okay interim
solution, but the ultimate goal should be to delete that code when
the system's implementation is fixed.
A bug in one system is not a reason to change behavior in a separate
system. Having all systems use the alternate code results in zsh missing
out on any bug fixes or later enhancements in those systems.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author