From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10976 invoked by alias); 18 Jul 2011 14:45:58 -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: 29554 Received: (qmail 6544 invoked from network); 18 Jul 2011 14:45:56 -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: <110718074551.ZM13628@torch.brasslantern.com> Date: Mon, 18 Jul 2011 07:45:51 -0700 In-reply-to: Comments: In reply to Pavel Reznicek "Re: Zsh 4.3.12: subshell in midnight commander: precmd: 15: bad file descriptor" (Jul 18, 12:04pm) References: <20110718100718.56865117@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org 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, 12:04pm, Pavel Reznicek wrote: } } >> precmd: 15: bad file descriptor } >> } >> the precmd command defined in there is: } >> } >> precmd(){ pwd>&%d;kill -STOP $$ } Hmm. I was thinking that the error had to be coming from somewhere only indirectly related to this because >&15 would be a parse error, but in fact zsh accepts multi-digit descriptor numbers on the right side of >& (but not on the left side, which bash does and ksh does not). So MC is explicitly sprintf'ing a descriptor that it created into that pwd. Thus this may be revealing: torch% exec {stderr}>&2 torch% print $stderr 11 torch% Src/zsh -f torch% precmd() { pwd>&11 } precmd: 11: bad file descriptor torch% Now here's 4.3.9 (I don't have .10 handy): macadamia% exec {stderr}>&2 macadamia% print $stderr 11 macadamia% zsh -f macadamia% precmd() { pwd>&11 } /Users/schaefer macadamia% Now here's 4.3.12-dev-1 started from 4.3.9: macadamia% exec {stderr}>&2 macadamia% print $stderr 11 macadamia% Src/zsh -f macadamia% precmd() { pwd>&11 } /Users/schaefer/Documents/zsh macadamia% So it's the calling shell rather than the called shell that is closing a descriptor that it shouldn't.