zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: Bug: time doesn't work on builtins
Date: Thu, 5 Sep 2024 16:37:11 -0700	[thread overview]
Message-ID: <CAH+w=7Y3c-3s-vwhdAb=v1v3V-a0ME_Mb4FdVFhwjopDmkKf3A@mail.gmail.com> (raw)
In-Reply-To: <E09184A8-24FC-44E6-B387-3817736D198E@kba.biglobe.ne.jp>

On Thu, Sep 5, 2024 at 10:29 AM Jun. T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> When exectime() calls execpline(,slcode=*state->pc++,) (exec.c:5280),
> slcode is WC_SUBLIST with WC_SUBLIST_SIMPLE flag, and 'code' (the next
> word code) obtained by (exec.c:1677)
>     wordcode code = *state->pc++;
> is just a line number, not WC_PIPE (see parse.c:757). Then the for
> loop is skipped by (lines 1680,81)
>     if (wc_code(code) != WC_PIPE)
>         return lastval = (slflags & WC_SUBLIST_NOT) != 0;

Is this enough?  All existing tests still pass, but I wonder if
there's another way to get there.

diff --git a/Src/exec.c b/Src/exec.c
index 00278ac50..057999844 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1677,7 +1677,7 @@ execpline(Estate state, wordcode slcode, int how, int last
1)
     wordcode code = *state->pc++;
     static int lastwj, lpforked;

-    if (wc_code(code) != WC_PIPE)
+    if (wc_code(code) != WC_PIPE && !(how & Z_TIMED))
        return lastval = (slflags & WC_SUBLIST_NOT) != 0;
     else if (slflags & WC_SUBLIST_NOT)
        last1 = 0;


  reply	other threads:[~2024-09-05 23:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 13:15 Mark J. Reed
2024-08-15 18:52 ` Bart Schaefer
2024-08-15 22:08   ` Mark J. Reed
2024-08-16 19:20     ` Bart Schaefer
2024-09-04  0:27       ` Bart Schaefer
2024-09-04 14:32         ` Jun. T
2024-09-05 17:29           ` Jun. T
2024-09-05 23:37             ` Bart Schaefer [this message]
2024-09-06  9:41               ` Jun T
2024-09-06  0:10           ` Bart Schaefer
2024-09-06  9:52             ` Jun T
2024-09-06 19:13               ` Bart Schaefer
2024-09-14  2:10                 ` PATCH: " Bart Schaefer
2024-09-20  7:46                   ` Oliver Kiddle
2024-09-22  0:59                     ` 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=7Y3c-3s-vwhdAb=v1v3V-a0ME_Mb4FdVFhwjopDmkKf3A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --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).