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

Re: Bug with continue?



On Tue, Mar 28, 2023 at 7:17 AM Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
>
> > On 28/03/2023 12:19 Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> > Replacing continue && with ! continue || has the same effect,
>
> Missed this one, thanks.
>
> pws
>
> diff --git a/Src/exec.c b/Src/exec.c
> index 3330bbce8..4328975b9 100644
> --- a/Src/exec.c
> +++ b/Src/exec.c
> @@ -1491,7 +1491,7 @@ execlist(Estate state, int dont_change_job, int exiting)
>                  * we find a sublist followed by ORNEXT.                   */
>                 if ((ret = ((WC_SUBLIST_FLAGS(code) & WC_SUBLIST_SIMPLE) ?
>                             execsimple(state) :
> -                           execpline(state, code, Z_SYNC, 0)))) {
> +                           execpline(state, code, Z_SYNC, 0))) || breaks) {
>                     state->pc = next;
>                     code = *state->pc++;
>                     next = state->pc + WC_SUBLIST_SKIP(code);
> @@ -1524,7 +1524,7 @@ execlist(Estate state, int dont_change_job, int exiting)
>                  * we find a sublist followed by ANDNEXT.              */
>                 if (!(ret = ((WC_SUBLIST_FLAGS(code) & WC_SUBLIST_SIMPLE) ?
>                              execsimple(state) :
> -                            execpline(state, code, Z_SYNC, 0)))) {
> +                            execpline(state, code, Z_SYNC, 0))) || breaks) {
>                     state->pc = next;
>                     code = *state->pc++;
>                     next = state->pc + WC_SUBLIST_SKIP(code);

FWIW I can confirm this fixes the issue both in my toy case, and the
real code that prompted me to report the issue.

Thanks.

-- 
Felipe Contreras




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