Subject: | Improper modification of hash during each() traversal in t/basic.t |
t/basic.t contains a subroutine called _normalize() which uses faulty
logic to lowercase the keys in a hash that is being traversed with
each().
This has never been legal, but due to implementation issues probably
worked out such that the tests never failed.
Changes coming in Perl 5.18 mean that this will fail regularly.
Attached patch fixes the problem.
This is a Perl 5.18 blocker ticket, so I am marking it as important.
Subject: | 0001-Fix-code-which-modifies-a-hash-while-each-ing-over-i.patch |
From 4cb7d89cba3a097922a81b30f3f5e481160e34b4 Mon Sep 17 00:00:00 2001
From: Yves Orton <demerphq@gmail.com>
Date: Tue, 19 Feb 2013 12:12:34 +0100
Subject: [PATCH 1/2] Fix code which modifies a hash while each()ing over it
It has never been correct to modify a hash during traversal by each().
In older perls this was unlikely to break the tests. In newer perls
it is relatively likely, and in 5.18 it will be almost certain.
This includes a version bump. Needs to be merged upstream.
---
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm | 2 +-
cpan/ExtUtils-MakeMaker/t/basic.t | 6 +-----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
index fbe854b..5bdd517 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
@@ -18,7 +18,7 @@ our @Overridable;
my @Prepend_parent;
my %Recognized_Att_Keys;
-our $VERSION = '6.64_01';
+our $VERSION = '6.64_02';
$VERSION = eval $VERSION;
# Emulate something resembling CVS $Revision$
diff --git a/cpan/ExtUtils-MakeMaker/t/basic.t b/cpan/ExtUtils-MakeMaker/t/basic.t
index fb374c0..cd53c65 100644
--- a/cpan/ExtUtils-MakeMaker/t/basic.t
+++ b/cpan/ExtUtils-MakeMaker/t/basic.t
@@ -411,9 +411,5 @@ close SAVERR;
sub _normalize {
my $hash = shift;
-
- while(my($k,$v) = each %$hash) {
- delete $hash->{$k};
- $hash->{lc $k} = $v;
- }
+ %$hash= map { lc($_) => $hash->{$_} } keys %$hash;
}
--
1.7.5.4