Skip Menu |

This queue is for tickets about the Text-Sequence CPAN distribution.

Report information
The Basics
Id: 111173
Status: resolved
Priority: 0/
Queue: Text-Sequence

People
Owner: Nobody in particular
Requestors: rt [...] illuminated.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.25
Fixed in: 0.26



Subject: Test failures on modern Perls
This module fails its tests on modern Perls (i.e. any since hash key ordering was made truly random in 5.18). The tests "members" and/or "members 2" will typically fail; I haven't noticed any other failures. I believe this is down to a lack of sorting of the keys of various hashes; the patch below patches the test failures, but there are a couple of other places in the same function where the keys of a hash might want sorting as well, but the (understandably) limited tests haven't stressed that code enough. I haven't looked at the code in enough detail to fully understand it, though. --- lib/Text/Sequence.pm~ 2004-07-06 17:33:55.000000000 +0100 +++ lib/Text/Sequence.pm 2016-01-13 21:50:04.233902678 +0000 @@ -194,7 +194,7 @@ } # Now the remaining elements (if any) all get swept into the # %d non-padded bucket. - my @members = ( map @{ $formats->{$_} }, keys %$formats ); + my @members = ( map @{ $formats->{$_} }, sort keys %$formats ); push @seqs, Text::Sequence->new($cand, @members) if @members; }
On 2016-01-13 16:56:33, SKINGTON wrote: Show quoted text
> This module fails its tests on modern Perls (i.e. any since hash key > ordering was made truly random in 5.18). The tests "members" and/or > "members 2" will typically fail; I haven't noticed any other failures. > > I believe this is down to a lack of sorting of the keys of various > hashes; the patch below patches the test failures, but there are a > couple of other places in the same function where the keys of a hash > might want sorting as well, but the (understandably) limited tests > haven't stressed that code enough. I haven't looked at the code in > enough detail to fully understand it, though. > > --- lib/Text/Sequence.pm~ 2004-07-06 17:33:55.000000000 +0100 > +++ lib/Text/Sequence.pm 2016-01-13 21:50:04.233902678 +0000 > @@ -194,7 +194,7 @@ > } > # Now the remaining elements (if any) all get swept into the > # %d non-padded bucket. > - my @members = ( map @{ $formats->{$_} }, keys %$formats ); > + my @members = ( map @{ $formats->{$_} }, sort keys %$formats > ); > push @seqs, Text::Sequence->new($cand, @members) if @members; > }
Yes, it's very likely caused by hash randomization. The pattern on http://matrix.cpantesters.org/?dist=Text-Sequence%200.25 looks familiar: random fails starting with perl 5.17.6 (the first perl with hash randomization).
Fixed in the most recent release.