Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: time doesn't work on builtins
- X-seq: zsh-workers 53067
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "Jun. T" <takimoto-j@xxxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: Bug: time doesn't work on builtins
- Date: Thu, 5 Sep 2024 16:37:11 -0700
- Archived-at: <https://zsh.org/workers/53067>
- In-reply-to: <E09184A8-24FC-44E6-B387-3817736D198E@kba.biglobe.ne.jp>
- List-id: <zsh-workers.zsh.org>
- References: <CAA=-s3w0wsH7xkS58JS0AbGdOoihYxq+cKEpVomFU_f1_w-ynQ@mail.gmail.com> <CAH+w=7a3BuQnPMa5YEy8n8ZNSNNoYNKLL9Aki5iCSPKbTyn5eQ@mail.gmail.com> <CAA=-s3z3YMho0a4A3H4h3o75oY1fR36w2zz83zQKjyPi3mSTpQ@mail.gmail.com> <CAH+w=7ZZ3frU9OjpkOmHzvL6Ws0YQPE=_JK+izmRR+gEcvSsDg@mail.gmail.com> <CAH+w=7ZpU-QCFAfPYvBFQvUnfekV35c3B_j7eoWvo8MokJ0Ncw@mail.gmail.com> <20C9A9EE-49A5-4A58-AA00-136A5D221331@kba.biglobe.ne.jp> <E09184A8-24FC-44E6-B387-3817736D198E@kba.biglobe.ne.jp>
On Thu, Sep 5, 2024 at 10:29 AM Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> 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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author