Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] zsh/random module [UPDATED]



2022-11-24 16:39:07 -0600, Clinton Bunch:
[...]
> If we move SRANDOM into zsh core, we'll need to define the behavior if
> urandom is not found.
[...]

Since that would be for bash compatibility, we can do the same
as they do there.

From what I can tell, if getrandom(), called with GRND_NONBLOCK
is not supported or fails (including with EAGAIN), it falls back
to arc4random if supported or with the same pseudo-generator as
$RANDOM if not (though seeded in each subshell with the time of
the day with µs precision and also looping until the value is
different from the previous one (!? is that a guarantee also
given by getrandom()?)).

On GNU/Linux, since bash's "configure" doesn't look for
arc4random() in libbsd, you get the same pseudo-generator as
$RANDOM as fallback (zsh's configure has the same problem
AFAICT; note that libbsd is used by xorg server, iproute2 at
least, so is likely to be present and pre-loaded on most
GNU/Linux systems).

-- 
Stephane




Messages sorted by: Reverse Date, Date, Thread, Author