zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Eduardo Bustamante <dualbus@gmail.com>, zsh-workers@zsh.org
Cc: Eduardo Bustamante <dualbus@gmail.com>
Subject: Re: Zsh parser infinite loop in chuck from utils.c on malformed input
Date: Wed, 10 May 2017 15:45:55 +0100	[thread overview]
Message-ID: <20170510154555.2a07d67b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAOSMAuvi6kjmwhJ65H3NkX1DefVVvZYs-kULDaX2sYEtSTqBfw@mail.gmail.com>

On Wed, 10 May 2017 09:20:47 -0500
Eduardo Bustamante <dualbus@gmail.com> wrote:
> On Wed, May 10, 2017 at 1:43 AM, Bart Schaefer
> <schaefer@brasslantern.com> 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.

pws


  reply	other threads:[~2017-05-10 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 14:00 Eduardo Bustamante
2017-05-08 14:17 ` Eduardo Bustamante
2017-05-10  6:43 ` Bart Schaefer
2017-05-10 14:20   ` Eduardo Bustamante
2017-05-10 14:45     ` Peter Stephenson [this message]
2017-05-10 14:57       ` Eduardo Bustamante

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510154555.2a07d67b@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=dualbus@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).