Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug/regression: tt(RANDOM) seed not updating when $RANDOM is used in a pipe
- X-seq: zsh-users 29095
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Eric Cook <llua@xxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: Bug/regression: tt(RANDOM) seed not updating when $RANDOM is used in a pipe
- Date: Thu, 29 Jun 2023 16:56:01 +0200
- Archived-at: <https://zsh.org/users/29095>
- In-reply-to: <CAH+w=7YEgHWBroyBYOg5t7QcLpxsCmUU2f_04XPt2+sy+ayj2g@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <25FF68CF-F93D-4745-84D1-A97A5ECCA348@gmail.com> <36f09056-0f1a-1b8a-dcf8-0ab222857ea2@gmx.com> <CAH+w=7YEgHWBroyBYOg5t7QcLpxsCmUU2f_04XPt2+sy+ayj2g@mail.gmail.com>
On Thu, Jun 29, 2023 at 7:43 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Jun 28, 2023 at 7:46 PM Eric Cook <llua@xxxxxxx> wrote:
> >
> > On 6/28/23 16:10, Jon Oster wrote:
> > > In 5.8.1, $RANDOM seems not to update its state when the command $RANDOM
> > > was used in is piped somewhere. For example:
> > >
> > > Is this considered a bug? Or is it intended behaviour?
> > >
> > > [1] https://sourceforge.net/p/zsh/code/ci/faf0035e532cde45528806e7a05ad28a0ab7c0fb/
> >
> > The LHS of the pipe should be a subshell, so the behavior is intentional.
>
> This was, however, an unanticipated side-effect of the referenced
> commit. It changed behavior (that, before, did not conform to the
> documentation) without that fact being called out in any of our files
> that serve as release notes.
>
> It opens the question of whether anything else that previously was
> "pre-fork" might have changed behavior at that point.
Perhaps things of this sort?
% echo ${foo::=bar} | cat
% zmodload zsh/system; echo $sysparams[pid] | cat
I cannot reproduce the 5.4.2 behavior reported by Jon, so I cannot
verify whether the identified commit affects these test cases.
% docker run --rm zshusers/zsh:5.4.2 zsh -c 'repeat 2 echo $RANDOM | cat'
15988
9706
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author