Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bad effect of error in zle-line-pre-redraw
- X-seq: zsh-workers 39927
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Bad effect of error in zle-line-pre-redraw
- Date: Sat, 12 Nov 2016 18:54:55 +0100
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=l8Hdgw5DB75hSQYZtG6rITMZSm6C2wJlA/BmxFtBHmM=; b=b21xhlaRbWoorQKtPcPLIhy+kML0C1VwVCgYNtyH9UXko9yjDbAliR5nzfyx8vLtgK iprINLo3Cg9Cp5y5fLuZWSw1v8NacbbAKpmQEDXh6IrS8n8lmgflu2NFD2u9TZEI+oha XD1HmhgNjRAkak3LL9wtFHkRqmbLUxFCDQfKz6A6sf2LaNjLPK6VyqA/xqGb1rHmwXVT EspWiUoNgSnKyTJtPx5LOmDT4zaECPHX5Ha6FT7gb/C4AsVhOvieDjxmo0hFZYdkbNj/ CwpxHzfm4wSgwErFGxUnUXVOW4B1/y0hOn6ULqeOHGBb0FQiYrlSuEM9664eysejExNW Q7bA==
- In-reply-to: <161112090315.ZM1146@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <161112090315.ZM1146@torch.brasslantern.com>
On Sat, Nov 12, 2016 at 6:03 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author