develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #117963] old hash behaviour test fails, op/each.t ../ext/Devel-Peek/t/Peek.t

Thread Previous | Thread Next
From:
demerphq
Date:
May 12, 2013 09:31
Subject:
Re: [perl #117963] old hash behaviour test fails, op/each.t ../ext/Devel-Peek/t/Peek.t
Message ID:
CANgJU+W=gDQp6QUebbLhAZYgBkHqQOA4vTAkgr58Ge1W=zv0sw@mail.gmail.com
On 11 May 2013 21:23, bulk88 <perlbug-followup@perl.org> wrote:
> # New Ticket Created by  bulk88
> # Please include the string:  [perl #117963]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117963 >
>
>
>
> This is a bug report for perl from bulk88@hotmail.com,
> generated with the help of perlbug 1.39 running under perl 5.18.0.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
>
> Turning on pre 5.18 has behaviour with a modified hv_func.h as such
> ______________________________________________________________
> /* hash a key
>  *--------------------------------------------------------------------------------------
>  * The "hash seed" feature was added in Perl 5.8.1 to perturb the results
>  * to avoid "algorithmic complexity attacks".
>  *
>  * If USE_HASH_SEED is defined, hash randomisation is done by default
>  * If USE_HASH_SEED_EXPLICIT is defined, hash randomisation is done
>  * only if the environment variable PERL_HASH_SEED is set.
>  * (see also perl.c:perl_parse() and S_init_tls_and_interp() and
> util.c:get_hash_seed())
>  */
>
> #ifndef PERL_SEEN_HV_FUNC_H /* compile once */
> #define PERL_SEEN_HV_FUNC_H
>
> #define PERL_HASH_FUNC_ONE_AT_A_TIME_OLD
> #undef USE_HASH_SEED
> #undef USE_HASH_SEED_EXPLICIT
> ______________________________________________________________
>
> is causing the following unusual test failures on my machine. 32 bit
> Windows XP.

This is non-standard build mode, so some test failures are expected,
at least until the Configure infrastructure learns about the new
defines, or i find time to learn more about the Configure structure
:-)

> ______________________________________________________________
> C:\p518src\perl-05f5908\t>..\perl.exe -I..\lib harness op/each.t
> op/each.t .. # Failed test 58 - each() after insert produces warnings at
> op/each
> .t line 282
> op/each.t .. Failed 1/59 subtests
>
> Test Summary Report
> -------------------
> op/each.t (Wstat: 0 Tests: 59 Failed: 1)
>   Failed test:  58
> Files=1, Tests=59,  1 wallclock secs ( 0.01 usr +  0.01 sys =  0.03 CPU)
> Result: FAIL

Given the build options you provided I don't expect this to fail, but
it doesnt entirely surprise me that it does. We initialize the
PL_hash_rand_bits var from the hash seed, so disabling hash seed
randomization might cause PL_hash_rand_bits to stay 0 or something.
Feel free to propose a patch to get_hash_seed().

> C:\p518src\perl-05f5908\t>..\perl.exe -I..\lib harness
> ../ext/Devel-Peek/t/Peek.t
> ../ext/Devel-Peek/t/Peek.t .. 1/?
> #   Failed test 'ENAME on a stash'
> #   at t/Peek.t line 80.
> #                   'SV = IV(0xa9e030) at 0xa9e034
> #   REFCNT = 1
> #   FLAGS = (ROK)
> #   RV = 0xa65db4
> #   SV = PVHV(0x8f07d4) at 0xa65db4
> #     REFCNT = 2
> #     FLAGS = (OOK,SHAREKEYS)
> #     ARRAY = 0xa93c4c
> #     KEYS = 0
> #     FILL = 0
> #     MAX = 7
> #     RITER = -1
> #     EITER = 0x0
> #
> #     NAME = "RWOM"
> #     ENAME = "RWOM"
> # '
> #     doesn't match '(?^ms:\A(?:ALLOCATED at .*?
> # )?SV = IV\(0x[[:xdigit:]]+\) at 0x[[:xdigit:]]+
> #   REFCNT = 1
> #   FLAGS = \(ROK\)
> #   RV = 0x[[:xdigit:]]+
> # (?:  ALLOCATED at .*?
> # )?  SV = PVHV\(0x[[:xdigit:]]+\) at 0x[[:xdigit:]]+
> #     REFCNT = 2
> #     FLAGS = \(OOK,SHAREKEYS\)
> #     ARRAY = 0x[[:xdigit:]]+
> #     KEYS = 0
> #     FILL = 0
> #     MAX = 7
> #     RITER = -1
> #     EITER = 0x0
> #     RAND = 0x[[:xdigit:]]+
> #     NAME = "RWOM"
> #     ENAME = "RWOM"
> # \Z)'


Again, im not sure why your build options lead to this output (have
you missed some?). But these are basically because the devel peek code
thinks the hash iterator randomization is compiled out. I didnt have
time to figure out how to make the tests pass in the time I had, and
this is an experimental build mode, feel free to provide patches.
Basically what is happening is that the code to show the RAND and
LASTRAND fields of a hash iterator is conditional, but the tests dont
know that. Ideally this should be driven from %Configure data. That
aside however the "compile out" seems to have omitted a newline, so
there is a gap in the dump. :-(

I will do my best to look into this, but as it is an experimental
build mode I cant say when I'll get to it, and I invite patches to fix
the problems. Ill do my best to provide guidance if its needed.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


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