Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: time doesn't work on builtins
- X-seq: zsh-workers 53066
- From: "Jun. T" <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Bug: time doesn't work on builtins
- Date: Fri, 6 Sep 2024 02:29:01 +0900
- Archived-at: <https://zsh.org/workers/53066>
- In-reply-to: <20C9A9EE-49A5-4A58-AA00-136A5D221331@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>
> 2024/09/04 23:32, I wrote:
>
> % x=0; time for ((i=1; i<=10000; ++i)); do ((x+=i)); done; echo $x
> 0
>
> The for loop is not executed, and the time statistics is not output.
The reason that the for loop is skipped may be the following:
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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author