Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: fd used for saving redirected fds leaked to child processes
- X-seq: zsh-workers 41541
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: fd used for saving redirected fds leaked to child processes
- Date: Sun, 13 Aug 2017 14:45:12 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=LphoVh/UWZaVQJF7uKbmr01lxB+ydnnr3/9Fa0GM5+I=; b=Dsn/6je7rNj8smdVflV/aoVH3aWpJR3elimHwPyd3GuDVG0Lsqb5WHF8l0c0qSF9Bf k6yjuvaNVy2BgHnksigz8wWggeVTXGUKqiRpeHjTGf00MCoFfq6NVUg6AlJab/TA+Ns4 C2i8+6Z7pltGrF9xOsmAr7lEJYr1ie/gjuOGne1fWfUyrFrY5sV9MbueDOp4UdRe63j3 XvSmjUXHe5Y7xR7JD1zOTXtT+SRsr90kaYQLzYNFUdmOHxsWrIYJRKiuCI92CGWeHXWJ PqW3KQkdABebgoyyRZyo9GxQqGKmMEkVH3G3U/jTqb6LEQmhHDoc5Gr0b+FSNbbdw1Pt t92Q==
- In-reply-to: <20170813194939.7a96bc4b@ntlworld.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: <20170813161207.GA6530@chaz.gmail.com> <20170813194939.7a96bc4b@ntlworld.com>
On Sun, Aug 13, 2017 at 11:49 AM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
>
> +/* FDs saved for possible restoring, not needed in a subshell
> + * where we will never need to restore them. Hence if we enter
> + * a subshell these will simply be closed unconditionally.
> + *
> + * A value >= 10 indicates a valid saved fd.
> + */
No objection to defensive programming, but would it not be a bug for
an fd < 10 to ever be assigned to a slot in saved_fds[] in the first
place?
It feels as though there's probably a reason that (int *save) is
passed around as a parameter to addfd() et al. rather than being a
global to begin with. Are you sure there aren't circumstances where
the same fd might get saved more than once at different levels of the
recursive execsomething() hierarchy, causing saved_fds[] to contain
incomplete information? I'm envisioning something like
{ { cmd1 ; cmd2 } > file2; cmd3 } > file1 &
Messages sorted by:
Reverse Date,
Date,
Thread,
Author