zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Bad effect of error in zle-line-pre-redraw
Date: Sat, 12 Nov 2016 18:54:55 +0100	[thread overview]
Message-ID: <CAHYJk3Q0JruaPKGiAouYr+SeUyn3v3a4SFxXoJX01a9JXb_Sog@mail.gmail.com> (raw)
In-Reply-To: <161112090315.ZM1146@torch.brasslantern.com>

On Sat, Nov 12, 2016 at 6:03 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> If you happen to introduce an error into zle-line-pre-redraw,
> your shell is pretty badly wrecked -- ZLE resets itself after every
> character typed.  Stupid minimal example:
>
> torch% zle-line-pre-redraw() { : ${bad_subscript[missing-bracket} }
> torch% zle -N zle-line-pre-redraw
> torch% e
> zle-line-pre-redraw: invalid subscript
> torch% e
> torch% c
> zle-line-pre-redraw: invalid subscript
> torch% c
> torch% h
> zle-line-pre-redraw: invalid subscript
> torch% h
> torch% o
> zle-line-pre-redraw: invalid subscript
> torch% o
> torch%
>
> Why the missing bracket isn't a syntax error at parse time rather
> than an evaluation error at run time is left as an exercise; e.g. ksh
> complains when defining the function.
>
> Other hook functions (zle-history-line-set, etc.) don't have this side-
> effect.

% foo() { : ${bad_subscript[missing-bracket} }
% zle -N self-insert foo
{5514|18:54:05|~}%
foo: invalid subscript
{5514|18:54:05|~}%
{5514|18:54:05|~}%
foo: invalid subscript
{5514|18:54:05|~}%
{5514|18:54:05|~}%

There are many many more ways to break a shell session, surely.

-- 
Mikael Magnusson


  reply	other threads:[~2016-11-12 17:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 17:03 Bart Schaefer
2016-11-12 17:54 ` Mikael Magnusson [this message]
2016-11-12 20:41   ` Bart Schaefer
2016-11-13 14:45     ` Mikael Magnusson
2016-11-13 18:55       ` Bart Schaefer
2016-11-14 11:15         ` Mikael Magnusson
2016-11-13 19:16     ` [PATCH] Widget fallbacks (Re: Bad effect of error in zle-line-pre-redraw) Bart Schaefer

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=CAHYJk3Q0JruaPKGiAouYr+SeUyn3v3a4SFxXoJX01a9JXb_Sog@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=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).