Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A serious bug in execution – where to debug?
- X-seq: zsh-workers 44612
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: A serious bug in execution – where to debug?
- Date: Tue, 30 Jul 2019 23:54:38 +0200
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=g2ctI6YbIGmqMR+OKnC99fhamW2vBM5ilYTevdOBIuY=; b=ULotat9BzMkb9wR2kSf1qE3HG5o/d8ngQtTiDhZnWlaG6ZZ/4SLfEkRTiYhZC9lo4d T5wnaQhkj7WNIBj1zX9mKAoK1JfjYrO1uegM4264cCp2IQTFhdnAqiiv1S+f53UEM4dT WltYuPeXJcb9hIJ4zLNxiYq9IfrrzhWiaZhLsJbYf0LVYPiSyv41v+TPYgL/THfR2Wuh CC/9lWseC89OZ6ks6TRVmgXBlah4Kbgm2wKHzDq/oMBKJzciwhIy/Rhm3a8LUu0oUfO7 1hSsjog7smmpLk3umy2SqlbpaTF89fTEIXeQvDV89uCzS/XAiHaaLe/23HfcBYK7NIDC y3Gw==
- In-reply-to: <CAN=4vMo2-w8qEdsgWwZ5C3WE+ZRmBa-c2BxjpZ7NWpvNq_J2tQ@mail.gmail.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>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCKrg_PnZ6jKLoAwR8XQnswT-Bs2TJA7oefhd_gRtHKUQ@mail.gmail.com> <CAH+w=7ZEukuvaOiBymgJ1nR1TbriEMSxx9L8-=hojxQoKOaRUw@mail.gmail.com> <CAKc7PVCbP5inrfFW3xiphBN5uH3o3ayVRnzzEbybfkp-Y5Fubw@mail.gmail.com> <CAN=4vMqkjK5hPxhhXYwp=4Sj49VfyZgEH06tK0vggnHyddbrsA@mail.gmail.com> <CAKc7PVC6vxkHRvRSQzPGxgOXLOMc-LyJaqA5DmsLXQ5tU8y3Hw@mail.gmail.com> <CAN=4vMo2-w8qEdsgWwZ5C3WE+ZRmBa-c2BxjpZ7NWpvNq_J2tQ@mail.gmail.com>
On Tue, 30 Jul 2019 at 23:45, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Tue, Jul 30, 2019 at 11:38 PM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > On Tue, 30 Jul 2019 at 23:02, Roman Perepelitsa
> > <roman.perepelitsa@xxxxxxxxx> wrote:
> > >> On Tue, 30 Jul 2019 at 20:28, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > >> > If you change the [[ ... ]] && ... to an if/then, does the behavior change?
> > >> > If you add a "return" or "return $?" at the end of the function, does it change?
> > >>
> > >> a) yes, the problem cancels with if-then
> > >> b) no, adding one of the return's doesn't change the behavior
> > >
> > > I think Bart solved it. Do you have `emulate -L zsh` in your `zle` function?
> >
> > No, but adding it helps. Any emulation (sh, ksh) does. Aah, so this is
> > the errreturn option set within your plugin! and the if-then was
> > setting the return code to 0. A very interesting situation, having
> > your code called in foreign context, to know what options to defend
> > from.
>
> You should call `emulate -L zsh` from every functions that can be
> called by any code other than yours. It's almost impossible to write
I avoided localoptions for performance – it consumes some time, as it
(probably, but the performance effect is confirmed) allocates a new
table of options and fills it with defaults. So I've decided to write
an option-transparent code. But turns out that this might be hard in
case of such options as errreturn. I'll think about whether to replace
inline conditions with if-then or to do emulate -L.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author