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

Re: [PATCH2] Re: avoid closed stdin() in zle widgets



Stephane Chazelas wrote on Mon, 12 Jun 2017 07:05 +0100:
> 2017-06-12 00:15:20 -0400, Eric Cook:
> [...]
> > > in zle widgets, stdin currently appears to be closed. That's
> > > generally not a good idea to close fds 0, 1, 2 as many commands
> > > are confused when the files they open suddenly become their
> > > stdin/stdout/stderr because the first free fd is 0/1/2.
> [...]
> > It is documented to work like that in zshzle
> [...]
> 
> Well spotted. Thanks. (I also left a diff by mistake for an
> unrelated issue discussed earlier on. Sorry about that).
> 
> New patch:
> 
> diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
> index b65e3be..bd0252f 100644
> --- a/Doc/Zsh/zle.yo
> +++ b/Doc/Zsh/zle.yo
> @@ -750,12 +750,12 @@ sect(User-Defined Widgets)

Incompatible changes should be mentioned in NEWS or README.

I'm not convinced that the change should be made.  Devil's advocate
argues that this is a bug in dircolors(1), so (a) as an immediate
workaround, people with a buggy dircolors(1) command should redirect
stdin from /dev/null when invoking it, (b) those people should fix their
dircolors(1) command to not assume fd 0 is open.

Daniel



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