Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh 4.3.12: subshell in midnight commander: precmd: 15: bad file descriptor



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.



Messages sorted by: Reverse Date, Date, Thread, Author