Front page | perl.perl5.porters |
Postings from December 2012
Re: [perl #116090] Bleadperl breaks GFUJI/Text-Xslate-1.6001.tar.gz
Thread Previous
From:
demerphq
Date:
December 14, 2012 20:46
Subject:
Re: [perl #116090] Bleadperl breaks GFUJI/Text-Xslate-1.6001.tar.gz
Message ID:
CANgJU+UnU8yyD2tVzSCeRn7BhVV_tsaewjYNNSkKgYxzKRoeJA@mail.gmail.com
On 14 December 2012 21:13, demerphq <demerphq@gmail.com> wrote:
> On 14 December 2012 21:07, demerphq <demerphq@gmail.com> wrote:
>> On 14 December 2012 14:16, Dave Mitchell <davem@iabyn.com> wrote:
>>> On Thu, Dec 13, 2012 at 11:09:40PM -0800, Andreas J. Koenig via RT wrote:
>>>> I have no bisect for this one because the test result is random:
>>>> sometimes OK, sometimes SEGV. I saw it the first time happen with
>>>> v5.17.6-281-g01f4497. The test script that triggered it was
>>>> t/010_internals/100_threads.t. I just ran the test with v5.17.6 a
>>>> hundred times without crash, so I suppose the problem stems from some
>>>> commit after that.
>>>
>>> Given that its crashing while freeing a hash, perhaps the randomness of
>>> the crash is related to the new hash randomisation. In which case you
>>> could run it with the env var PERL_HASH_SEED_DEBUG=1, then when it
>>> crashes, note the hash seed that was displayed at start up:
>>>
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0xd460791e
>>>
>>> and then use that seed for the bisect:
>>>
>>> PERL_HASH_SEED=d460791e ./perl ...
>>>
>>>
>>> Although Yves, I've just noticed that this seems to be a bit buggy:
>>
>> Actually no. The output here is as expected. Although maybe this hasnt
>> been properly documented. See the delta for 5.17.6 for the
>> documentation I did do. Ill try to improve the docs.
>>
>> But basically the seed is populated from the left, and omitted bits
>> default to 0. This was done to make it easier to handle to arbitrary
>> seed sizes. IOW, it isnt a number, its a string in hex. Consider that
>> Siphash uses two 64 bit seeds, and other hash functions could have an
>> arbitrary number of bits in their seeds. I have played around with
>> hash functions that use very large "seeds".
>>
>>
>>> $ PERL_HASH_SEED=1 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>>>
>>> $ PERL_HASH_SEED=0x1 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x00000000
>>
>> Perhaps we should warn that we encountered an unexpected non-hex digit
>> in this case.
>>
>>> $ PERL_HASH_SEED=f PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0xf0000000
>>>
>>> $ PERL_HASH_SEED=100 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>>>
>>> $ PERL_HASH_SEED=10000 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>>>
>>> $ PERL_HASH_SEED=1000000 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>>>
>>> $ PERL_HASH_SEED=10000000 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>>>
>>> $ PERL_HASH_SEED=100000000 PERL_HASH_SEED_DEBUG=1 p -e 1
>>> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x10000000
>
> So:
>
> $ PERL_HASH_SEED_DEBUG=1 ./perl -e1
> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x442be56b
> $ PERL_HASH_SEED_DEBUG=1 PERL_HASH_SEED=442be56b ./perl -e1
> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x442be56b
>
> These are IMO undesirable
>
> $ PERL_HASH_SEED_DEBUG=1 PERL_HASH_SEED=0x442be56b ./perl -e1
> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x00000000
>
> $ PERL_HASH_SEED_DEBUG=1 PERL_HASH_SEED=442fnorble ./perl -e1
> HASH_FUNCTION = ONE_AT_A_TIME HASH_SEED = 0x442f0000
>
> So I will fix them.
Pushed:
commit 73cf895c2db29127e4f9a6ba1daed44c3400021d
Author: Yves Orton <demerphq@gmail.com>
Date: Fri Dec 14 21:44:07 2012 +0100
warn if PERL_HASH_SEED contains an unexpected character
diff --git a/util.c b/util.c
index e42dd01..fea95b9 100644
--- a/util.c
+++ b/util.c
@@ -5668,6 +5668,8 @@ Perl_get_hash_seed(pTHX_ unsigned char *seed_buffer)
{
while (isSPACE(*s))
s++;
+ if (s[0] == '0' && s[1] == 'x')
+ s += 2;
while (isXDIGIT(*s) && seed_buffer < end) {
*seed_buffer = READ_XDIGIT(s) << 4;
@@ -5676,6 +5678,11 @@ Perl_get_hash_seed(pTHX_ unsigned char *seed_buffer)
}
seed_buffer++;
}
+ while (isSPACE(*s))
+ s++;
+ if (*s && !isXDIGIT(*s)) {
+ warn_nocontext("perl: Non hex character in
'$ENV{PERL_HASH_SEED}', seed only partially set\n");
+ }
/* should we check for unparsed crap? */
}
else
--
perl -Mre=debug -e "/just|another|perl|hacker/"
Thread Previous