zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH:  Crash bug on garbage input (previously reported to Debian)
Date: Mon, 16 Feb 2015 11:39:23 -0800	[thread overview]
Message-ID: <150216113923.ZM5698@torch.brasslantern.com> (raw)
In-Reply-To: <20150216170413.054623af@pwslap01u.europe.root.pri>

On Feb 16,  5:04pm, Peter Stephenson wrote:
}
} I've add the "parse test from hell" where the first line looks like an
} arithmetic substitution but it actually turns out to be a case statement
} with unbalanced parentheses that needs the new parsing behaviour.

There's an interesting bit of this which I don't think is actually a
change in behavior but which might be worth noting.

Interactive shell:

torch% print $((case foo in
mathsubst> 

If you send-break (ctrl+c) at this point, the input is entirely discarded
and can't be recalled with up-line-or-history.  Incidentally, it would
probably be possible for the mathsubst parser to reject "case foo in"
as impossible syntax a lot sooner, because if you simply close with "))"
at that point you get

zsh: bad math expression: operator expected at `foo in'

but anyway:

torch% print $((case foo in
mathsubst> bar)
cmdsubst subsh case> 

If you send-break at THIS point, the incomplete input ends up in the
history and is recallable.  Also, if you begin with "{" or "(" so that
the PS2 level includes "subsh" or "cursh" then the input is recallable. 

Another tidbit:  Older versions of the shell would only have cmdsubst>
as the second PS2 prompt, so this is nice.


  reply	other threads:[~2015-02-16 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-14 18:25 Bart Schaefer
2015-02-14 21:42 ` Peter Stephenson
2015-02-15 19:26   ` Bart Schaefer
2015-02-16 12:57     ` Peter Stephenson
2015-02-16 17:04       ` Peter Stephenson
2015-02-16 19:39         ` Bart Schaefer [this message]
2015-02-17 12:57           ` Peter Stephenson
2015-02-17 17:13             ` Bart Schaefer
2015-02-17  9:02         ` Mikael Magnusson
2015-02-17  9:39           ` Peter Stephenson

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=150216113923.ZM5698@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).