Re: input: Fix here-document redirection with vi/emacs on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 30, 2017 at 01:33:29AM +0200, Harald van Dijk wrote:
> On 27/06/17 16:29, Zando Fardones wrote:
> > Hello,
> > 
> > I think I've found a bug when using the here-document redirection in
> > an interactive shell. What basically happens is that you can't see the
> > command output if you set the "vi" or "emacs" options.
> 
> That's not quite what happens: the here-document contents got lost, so 
> there is no command output to see. Nice find.
> 
> The problem is that getprompt() is implicitly called by el_gets(). This 
> messes with the memory used by the parser to store the here-document's 
> contents. In the non-emacs/vi case, the prompt is explicitly written by 
> setprompt(), which wraps the getprompt() call in a 
> pushstackmark()/popstackmark() pair to restore the state so that parsing 
> can continue. But when getprompt() is called by el_gets(), it knows 
> nothing about this.
> 
> The whole call to el_gets() can be surrounded by another 
> pushstackmark()/popstackmark() pair to solve the problem, as attached.

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux