zsh-workers
 help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Fix a logic bug in _zle
Date: Tue, 1 Jun 2021 11:53:04 +0300	[thread overview]
Message-ID: <CAHLkEDu6Nbw9mFH7514kKXEPbe06ZbaT=qyW3B=QUthPX9A_Kw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YBq1UtKT_E8FTjySU2kQecxetzX8N4CW3JtL-UdGhvfA@mail.gmail.com>

On Tue, Jun 1, 2021 at 12:56 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Mon, May 31, 2021 at 10:49 AM Marlon Richert
> <marlon.richert@gmail.com> wrote:
> >
> > On Mon, May 31, 2021 at 8:08 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> > >
> > > For purposes of the commit log, we should be told what this means in
> > > terms of a behavior change.
> >
> > Is it good enough this way?
>
> Better, but you could have just said that in the email text rather
> than embed it in the patch file.

Ah, OK. I thought you meant I should include it in the patch itself.

> However, I can't figure out when $state[1] == widget-function is ever
> true.  Did you possibly mean widget-or-function ?  If not, can you
> give an example?

Sorry, typo. Yes, I meant widget-or-function. But actually, I realize
now that I made further mistakes in my explanation yesterday evening.
I'll try to explain better.

What happens in the unpatched _zle code is this:
* On line 54, `;&` causes the (widget*) case to always proceed to the
(function) case.
* On line 56, `[[ $state[1] != *function ]] ||` checks to see whether
the flow should actually continue from (widget*) to (function).
* However,
  * when `[[ $state[1] != *function ]]` is true,
  * then we correctly skip the _wanted call on lines 57-58,
  * but because the _wanted call is followed by `&& ret=0`
  * and because || and && have equal precedence and are left associative,
  * then we incorrectly do `ret=0`,

So, to correctly summarize the bug: When $state[1] == widget, _zle
always returns 0, instead of returning 0 for success and non-zero for
failure. The patch fixes this. If you could update the commit message
accordingly, that would be great.

Apologies for the confusion.


  reply	other threads:[~2021-06-01  8:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31  8:50 Marlon Richert
2021-05-31 17:08 ` Bart Schaefer
2021-05-31 17:48   ` Marlon Richert
2021-05-31 21:56     ` Bart Schaefer
2021-06-01  8:53       ` Marlon Richert [this message]
2021-07-18 22:31         ` Lawrence Velázquez

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='CAHLkEDu6Nbw9mFH7514kKXEPbe06ZbaT=qyW3B=QUthPX9A_Kw@mail.gmail.com' \
    --to=marlon.richert@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).