Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Weird hash order behaviour on several RedHat releases.

by pboin (Deacon)
on Mar 16, 2006 at 16:44 UTC ( #537203=note: print w/replies, xml ) Need Help??


in reply to Re^2: Weird hash order behaviour on several RedHat releases.
in thread Weird hash order behaviour on several RedHat releases.

I just wonder if Red Hat didn't turn the randomization off on purpose in the name of compatibility to make sure that older applications didn't break when keys started to come back randomly. I have no doc that says that's the case, that just seems reasonable to me. Here's the option to do it:

From perlrun:

The default behaviour is to randomise unless the PERL_HASH_SEED is set. If Perl has been compiled with -DUSE_HASH_SEED_EXPLICIT, the default behaviour is not to randomise unless the PERL_HASH_SEED is set.
  • Comment on Re^3: Weird hash order behaviour on several RedHat releases.

Replies are listed 'Best First'.
Re^4: Weird hash order behaviour on several RedHat releases.
by wazoox (Prior) on Mar 16, 2006 at 17:04 UTC
    Actually I've checked output for perl -V :
    $ perl -V | grep SEED PERL_HASH_SEED="-1"
    But setting the PERL_HASH_SEED env variable has no effect at all. Using this script :
    #!/usr/bin/perl use strict; use warnings; use Hash::Util qw(hash_seed); my %t=qw( a A b B c C d D e E f F ); print hash_seed() . "\n"; print join( '', %t) ."\n";
    I change the PERL_HASH_SEED, the hash_seed differs from run to run, but the hash order remains the same:
    $ for i in -1 0 1 42 garbage; do export PERL_HASH_SEED=$i; for j in 1 +2 3; do perl test.pl; done; done 3657515954 eEcCaAbBdDfF 3070542819 eEcCaAbBdDfF 185686570 eEcCaAbBdDfF 0 eEcCaAbBdDfF 0 eEcCaAbBdDfF 0 eEcCaAbBdDfF 1 eEcCaAbBdDfF 1 eEcCaAbBdDfF 1 eEcCaAbBdDfF 42 eEcCaAbBdDfF 42 eEcCaAbBdDfF 42 eEcCaAbBdDfF 3381895560 eEcCaAbBdDfF 2632524130 eEcCaAbBdDfF 1729561246 eEcCaAbBdDfF
    The hash seed has no effect, that sucks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://537203]
help
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2021-07-26 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?