develooper Front page | perl.perl5.changes | Postings from August 2022

[Perl/perl5] 653273: Add a new env var PERL_RAND_SEED

From:
Yves Orton via perl5-changes
Date:
August 6, 2022 18:20
Subject:
[Perl/perl5] 653273: Add a new env var PERL_RAND_SEED
Message ID:
Perl/perl5/push/refs/heads/yves/consistent_srand/eb2ce5-653273@github.com
  Branch: refs/heads/yves/consistent_srand
  Home:   https://github.com/Perl/perl5
  Commit: 65327386d19b8f3a80f035e85230e0e7a6f3a54f
      https://github.com/Perl/perl5/commit/65327386d19b8f3a80f035e85230e0e7a6f3a54f
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-08-06 (Sat, 06 Aug 2022)

  Changed paths:
    M INSTALL
    M MANIFEST
    M dist/threads/lib/threads.pm
    M dist/threads/t/thread.t
    M dist/threads/threads.xs
    M embedvar.h
    M handy.h
    M hv.c
    M intrpvar.h
    M perl.c
    M perl.h
    M pod/perldelta.pod
    M pod/perlfunc.pod
    M pod/perlrun.pod
    M pp.c
    M pp_sys.c
    M sv.c
    M t/op/srand.t
    A t/run/runenv_randseed.t

  Log Message:
  -----------
  Add a new env var PERL_RAND_SEED

This env var can be used to trigger a repeatable run of a script which
calls C<srand()> with no arguments, either explicitly or implicitly
via use of C<rand()> prior to calling srand(). This is implemented in
such a way that calling C<srand()> with no arguments in forks or
subthreads (again explicitly or implicitly) will receive their own seed
but the seeds they receive will be repeatable.

This is intended for debugging and perl development performance testing,
and for running the test suite consistently. It is documented that the
exact seeds used to initialize the random state are unspecified, and
that they may change between releases or even builds. The only guarantee
provided is that the same perl executable will produce the same results
twice all other things being equal. In practice and in core testing we
do expect consistency, but adding the tightest set of restrictions on use
seemed sensible.

The env var is ignored when perl is run setuid or setgid similarly to
the C<PERL_INTERNAL_RAND_SEED> env var.





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About