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

[Perl/perl5] 36c846: t/op/each.t - Deal with env vars PERL_HASH_SEEDor...

From:
Yves Orton via perl5-changes
Date:
August 6, 2022 13:05
Subject:
[Perl/perl5] 36c846: t/op/each.t - Deal with env vars PERL_HASH_SEEDor...
Message ID:
Perl/perl5/push/refs/heads/yves/consistent_srand/000000-eb2ce5@github.com
  Branch: refs/heads/yves/consistent_srand
  Home:   https://github.com/Perl/perl5
  Commit: 36c8464d404b0ecb5796cda58c723a3c135a488d
      https://github.com/Perl/perl5/commit/36c8464d404b0ecb5796cda58c723a3c135a488d
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-08-06 (Sat, 06 Aug 2022)

  Changed paths:
    M t/op/each.t

  Log Message:
  -----------
  t/op/each.t - Deal with env vars PERL_HASH_SEED or PERL_PERTURB_KEYS being set

This was the only test that fails if PERL_HASH_SEED=0 is in the env.
With this change this test will be run without any hash seed overrides
so it can test what it is intended to. This test will continue to fail
in certain build modes (fixed hash seed with no hash randomization
at all) and we should enhance this change in the future to skip the test
entirely when appropriate.


  Commit: d5effd9003cb757be119ecd9bcae6905347abd12
      https://github.com/Perl/perl5/commit/d5effd9003cb757be119ecd9bcae6905347abd12
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-08-06 (Sat, 06 Aug 2022)

  Changed paths:
    M MANIFEST
    A dist/threads/t/version.t

  Log Message:
  -----------
  dist/threads - add a test to check that the pod version matches code

It should fail. A follow up patch will correct the fail.


  Commit: d85f6fcadc274772a060ca9b0acee8a6b20e8e9f
      https://github.com/Perl/perl5/commit/d85f6fcadc274772a060ca9b0acee8a6b20e8e9f
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-08-06 (Sat, 06 Aug 2022)

  Changed paths:
    M handy.h
    M hv.c

  Log Message:
  -----------
  hv.c/handy.h - move logic from hv.c to handy.h

These mathematical/RNG functions are handy for various
internal uses, so expose them in a way they can be reused.

These are Marsaglia RNG "permutation" XORSHIFT triplets, from the famous
article he wrote on fast random number generation. By modern standards
they are only mediocre as far as RNGs go, but they still aren't bad. But
they are very fast, and have a few useful properties which can be handy
in places where we want a cheap source of pseudo random bits, or where
we want to get a random(ish) sequence of positive integers.

This will be used in a follow up patch.


  Commit: eb2ce5047b5c3d8efd1836e5a3123bb73486b1e2
      https://github.com/Perl/perl5/commit/eb2ce5047b5c3d8efd1836e5a3123bb73486b1e2
  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 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.


Compare: https://github.com/Perl/perl5/compare/36c8464d404b%5E...eb2ce5047b5c



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