From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
Eric Cook <llua@gmx.com>,
zsh-users@zsh.org
Subject: Re: Bug/regression: tt(RANDOM) seed not updating when $RANDOM is used in a pipe
Date: Thu, 29 Jun 2023 20:15:57 +0200 [thread overview]
Message-ID: <CAN=4vMoMnDFhgH7nZAUGg27g0tieFGEaAhLx1DGi70xqHoroKA@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3RpaLsaJzjuFbS35FNqPSsM8Km657dBp_vCNZdHNvf33w@mail.gmail.com>
On Thu, Jun 29, 2023 at 7:53 PM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> On 6/29/23, Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
> > On Thu, Jun 29, 2023 at 7:43 AM Bart Schaefer <schaefer@brasslantern.com>
> > wrote:
> >>
> >> On Wed, Jun 28, 2023 at 7:46 PM Eric Cook <llua@gmx.com> 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
>
> Yes, you can?
Of course!
I can also confirm that the two test cases I posted above behave
differently in zsh 5.4.2 and 5.9. In all these cases 5.9 behaves as I
would expect, and the behavior of 5.4.2 is surprising to me.
Roman.
next prev parent reply other threads:[~2023-06-29 18:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 20:10 Jon Oster
2023-06-29 2:46 ` Eric Cook
2023-06-29 5:42 ` Bart Schaefer
2023-06-29 14:41 ` Ray Andrews
2023-06-29 14:56 ` Roman Perepelitsa
2023-06-29 17:53 ` Mikael Magnusson
2023-06-29 18:15 ` Roman Perepelitsa [this message]
2023-06-29 23:41 ` Bart Schaefer
2023-07-02 7:17 ` Mikael Magnusson
2023-07-02 7:29 ` Roman Perepelitsa
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='CAN=4vMoMnDFhgH7nZAUGg27g0tieFGEaAhLx1DGi70xqHoroKA@mail.gmail.com' \
--to=roman.perepelitsa@gmail.com \
--cc=llua@gmx.com \
--cc=mikachu@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@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).