Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [Bug] comparisson operator `[[` not working as expected



On 6/20/22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mon, Jun 20, 2022 at 11:33 AM Paulo Diovani <paulo@xxxxxxxxxxx> 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@xxxxxxxxxxx>
>
>         * 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;

Isn't this now just a very funny way to spell
  curmaxjob = oldmaxjob;
?

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author