From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4498 invoked by alias); 18 Jul 2011 16:26:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29560 Received: (qmail 21997 invoked from network); 18 Jul 2011 16:26:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110718092619.ZM14148@torch.brasslantern.com> Date: Mon, 18 Jul 2011 09:26:18 -0700 In-reply-to: <20110718170124.20d6cae4@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Zsh 4.3.12: subshell in midnight commander: precmd: 15: bad file descriptor" (Jul 18, 5:01pm) References: <20110718100718.56865117@pwslap01u.europe.root.pri> <110718074551.ZM13628@torch.brasslantern.com> <20110718162435.4c6598e8@pwslap01u.europe.root.pri> <110718085234.ZM13898@torch.brasslantern.com> <20110718170124.20d6cae4@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Subject: Re: Zsh 4.3.12: subshell in midnight commander: precmd: 15: bad file descriptor MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jul 18, 5:01pm, Peter Stephenson wrote: } Subject: Re: Zsh 4.3.12: subshell in midnight commander: precmd: 15: bad } } On Mon, 18 Jul 2011 08:52:34 -0700 } Bart Schaefer wrote: } > Hrm. So why does it work when starting 4.3.12 from 4.3.9? How is 11 } > getting to be <= max_zsh_fd inside 4.3.12 that case, whereas it is not } > when the outer shell is 4.3.12? } } See what lsof says. I suspect 4.3.9 is leaving open its SHTTY, since } setting FD_CLOEXEC on that is one of the changes I noted. That would be } fd 12, so 11 is * 2978 else if (fn->fd1 > max_zsh_fd) } > 2979 bad = 3; } } Hmm... that's saying we're closing an fd with {foo}>&- syntax that } we don't know about in the first place. Do we just try to close it and } report an error closing an unknown fd if that fails? Hrm. Right now it says zsh: file descriptor 11 out of range, not closed Strictly speaking there should be some way to close an arbitrary file descriptor. If the shell "knows about" all open descriptors that's not an issue here ... By the way, unrelated oddness: Redirections are allowed to appear at the start of a command like this: 2>&- true but {foo}>&- true is a parse error. --