zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Paulo Diovani <paulo@diovani.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [Bug] comparisson operator `[[` not working as expected
Date: Mon, 20 Jun 2022 13:30:57 -0700	[thread overview]
Message-ID: <CAH+w=7YnmfM3g6j9TB6NXHcFE7yTSY3-UG8wKg1OicwSgj3VZw@mail.gmail.com> (raw)
In-Reply-To: <CABdM12-XmzJNFECJto8hR0YROQOuq71p20Hb9jVAx6YNyF2RDg@mail.gmail.com>

On Mon, Jun 20, 2022 at 11:33 AM Paulo Diovani <paulo@diovani.com> wrote:
>
> In version 5.9 the [[ ]] operator is behaving unexpectedly for the following case:

Yep, this is a bug, introduced when a different crashing bug was
fixed.  It's an off-by-one error skipping the first job in the table.

The relevant ChangeLog entry for the crash bug is

2022-03-30  Peter Stephenson  <p.stephenson@samsung.com>

        * 49906 (Bart), 49911: Doc/Zsh/builtins.yo,
        Doc/Zsh/mod_parameter.yo, Src/exec.c, Src/jobs.c,
        Test/W03jobparameters.ztst: Fix querying jobs in subshell.

diff --git a/Src/jobs.c b/Src/jobs.c
index e0e453ed8..25ceb81c4 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2402,7 +2402,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
            int curmaxjob, ignorejob;
            if (unset(MONITOR) && oldmaxjob) {
                jobptr = oldjobtab;
-               curmaxjob = oldmaxjob ? oldmaxjob - 1 : 0;
+               curmaxjob = oldmaxjob ? oldmaxjob : 0;
                ignorejob = 0;
            } else {
                jobptr = jobtab;


  parent reply	other threads:[~2022-06-20 20:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 18:32 Paulo Diovani
2022-06-20 19:54 ` Stephane Chazelas
2022-06-20 20:07   ` Paulo Diovani
2022-06-20 20:30 ` Bart Schaefer [this message]
2022-06-21  0:47   ` Mikael Magnusson
2022-06-21  3:42     ` 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='CAH+w=7YnmfM3g6j9TB6NXHcFE7yTSY3-UG8wKg1OicwSgj3VZw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=paulo@diovani.com \
    --cc=zsh-workers@zsh.org \
    --subject='Re: [Bug] comparisson operator `[[` not working as expected' \
    /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

Code repositories for project(s) associated with this 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).