zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Timothee Cour <timothee.cour2@gmail.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: implementation of <() (creating a temp fifo) ?
Date: Sun, 12 Feb 2017 10:17:17 -0800	[thread overview]
Message-ID: <170212101717.ZM1441@torch.brasslantern.com> (raw)
In-Reply-To: <CAM4j=kPjFCCWRJTL8Sw3Y4OAe__i6k=YXL40M-awwwR79ZCVBg@mail.gmail.com>

On Feb 12,  4:32am, Timothee Cour wrote:
}
} Could someone kindly point me source code showing how zsh implements <()
} (temporary named pipe creation)? (ideally a url)
} 
} * my workaround is to use tempnam but docs says it's not recommended (
} http://man7.org/linux/man-pages/man3/tempnam.3.html)

There doesn't seem to be any better option for a temporary named pipe.
mkfifo is relatively safe because there's no way to cause it to re-use
an existing fifo, so as long as you're confident that the directory
where the fifo is placed cannot itself be spoofed, using tempnam is OK.

Note that the default build mode for zsh is to instead use /dev/fd/ or
the equivalent to get a handle to the stdin or stdout of the process,
and not use a named pipe at all.

Also since any process can connect to a named pipe once it exists, be
sure you're passing appropriately restrictive file modes to mkfifo.

To answer your direct question:

https://sourceforge.net/p/zsh/code/ci/master/tree/Src/exec.c
   search for "namedpipe"

https://sourceforge.net/p/zsh/code/ci/master/tree/Src/utils.c
   search for "gettempname"


  reply	other threads:[~2017-02-12 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-12 12:32 Timothee Cour
2017-02-12 18:17 ` Bart Schaefer [this message]
2017-02-13  2:30   ` Timothee Cour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170212101717.ZM1441@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=timothee.cour2@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).