develooper Front page | perl.perl5.porters | Postings from October 2012

Re: Eliminating the "rehash" mechanism for 5.18

Thread Previous | Thread Next
From:
Peter Rabbitson
Date:
October 29, 2012 11:32
Subject:
Re: Eliminating the "rehash" mechanism for 5.18
Message ID:
20121029183155.GA4693@rabbit.us
On Mon, Oct 29, 2012 at 06:55:21PM +0100, demerphq wrote:
> I propose that in 5.18 we should finally take the plunge and switch to
> a fully randomized hash seed and eliminate the rehash mechanism.  I
> have patches which do this ready, and for  the cpan/ modules involved
> I have pushed patches upstream to get the hash order dependencies
> removed.
> 
> Besides the advantages of avoiding the costs of the rehash mechanism
> this change will smoke out any hash order dependency bugs in the
> modules on CPAN, and in our own code. (I found at least two unrelated
> bugs in code in core due to hash randomization.) It will also prepare
> the ground for people to choose alternative hash algorithms for Perl
> to use, or to make it possible to use specialized hash algorithms in
> certain contexts such as 64 bit builds.
> 
> The downside however will be that it almost certainly will make lots
> of lazily written code to fail. But IMO the cost is worth it.
> 

+1. I have been looking at achieving this *somehow* for a while now, at 
least to run on smokers. I even wrote some code with the help of [Tux], 
but never brought it to the list, as it seemed to kludgy. It never 
occured to me to take the approach you present - simple quick and 
elegant.

As a data point - perl 5.8.1 is the only perl which actually behaves the 
way you propose (5.8.0 didn't randomize, and 5.8.2 got the rehash bit 
added). Since all my CPAN code supports 5.8.1, I had the ability of 
running my tests with a random seed. My experience wrt how many silly 
errors this catches mirrors yours.

So yes please!

Cheers

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