Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: [for consideration] TMPSUFFIX
- X-seq: zsh-workers 39441
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: [for consideration] TMPSUFFIX
- Date: Mon, 26 Sep 2016 07:25:46 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=5P2HV4Z/8258Aijur48lVWCGCMY=; b=t4zM7K x8ZOsfjg8mkN91gFawoT3yJG/W41fbZK1HTxOLaxhh+wLXJVL/78BYuapGE33zgj 4XOYxrxQFMoyt4oJPbTR+kP/mCShgNjtgmEZr7UPDtbRQE0TyKQoOFEULnqq+22P GfZxl2CS6wztsDo5rzJJlf0Z/wtzd/gVNUnag=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=5P2HV4Z/8258Aijur48lVWCGCMY=; b=rMBpm +gia9fSRzwCAxl+W7b+k+Y4CETD+eoQVSFr5c/6Uhfpdi1KcdCjEV2aDrdRQXLCV B5P7C4sghkJH9C8o0z51Qs+8L77pWceMHVt+AibgNnikC1ouvz0rz7pvkrhs1bvo 3tuSCJfOr+U8caHClMfFApi8z1kraBKn6xeiok=
- In-reply-to: <160925155112.ZM23899@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160925155112.ZM23899@torch.brasslantern.com>
Bart Schaefer wrote on Sun, Sep 25, 2016 at 15:51:12 -0700:
> The addfilelist() is done whether or not we successfully opened the file,
> because (a) it was that way before and (b) the name is returned either
> way, so the caller might try to create the file itself. However, it
> seems a bit odd that the failure of open() is mostly ignored?
This looks like a race condition: if another process creates the
filename that mktemp() returned before the open(O_EXCL) call [which will
therefore fail], zsh will remove that filename even though zsh didn't
create it. [This could trigger through a deliberate attack or through
a race condition between two zsh instances calling =(:) concurrently.]
I don't get "the caller will create the file". The =(:) syntax promises
to expand to an existing filename with a defined content. How is it
helpful to return a filename, which may or may not exist and certainly
doesn't contain the output of 'cmd'? It seems to me erroring out would
be better. (The caller can call getoutputfile() again if he wishes.)
The patch creates two hard links to the file but only removes one of
them.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author