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

Re: Zsh parser infinite loop in chuck from utils.c on malformed input

On Wed, 10 May 2017 09:20:47 -0500
Eduardo Bustamante <dualbus@xxxxxxxxx> wrote:
> On Wed, May 10, 2017 at 1:43 AM, Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:
> [...]
> > This probably should have been a parse error because the { } are not
> > balanced, but I'm guessing the parser returns a complete expression
> > when it hits EOF.  Anyway, parameter expansion is one of the few things
> > that happens in noexec, and those %%%% in the flags list mean to treat
> > all that garbage as a prompt ... so I suspect it's not actually in an
> > *infinite* loop, just one that is going to repeat 3333333333333333333
> > times.
> I see. Is there a particular reason parameter expansion is performed
> when noexec is on, and is there a way to disable expansions too?

The problem is NO_EXEC is all things to all people; in the case of a
shell there isn't really "just" a syntax check, because it's too
flexible.  The result of a parameter expansion can in some cases have
a significant effect on what you're doing, in particular if the command
to execute is part of it.  Being able to parse a parameter substitution
is itself quite an important check; and there's no fundamental
difference in the code between looking through the parameter
substitution and changing the arguments based on what you find.  The
name NO_EXEC, rather than, say, SYNTAX_CHECK, is significant.

Adding an additional mode that does even less is certainly possible, but
not necessarily of very wide applicability.


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