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

Re: PATCH: Crash bug on garbage input (previously reported to Debian)



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.



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