[perl-libwhisker2] Perl 5.18 compatibility

Petr Pisar ppisar at fedoraproject.org
Tue Jul 23 06:19:12 UTC 2013


commit 5f6f3b1df236fa86c56e4f0850b790b46ecc4f11
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Jul 23 08:16:52 2013 +0200

    Perl 5.18 compatibility

 ...r2-2.5-Editing-iterated-hash-is-undefined.patch |   42 ++++++++++++++++++++
 perl-libwhisker2.spec                              |    4 ++
 2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/libwhisker2-2.5-Editing-iterated-hash-is-undefined.patch b/libwhisker2-2.5-Editing-iterated-hash-is-undefined.patch
new file mode 100644
index 0000000..d4ce84d
--- /dev/null
+++ b/libwhisker2-2.5-Editing-iterated-hash-is-undefined.patch
@@ -0,0 +1,42 @@
+From b22b4139d769b6f156350d179eaa54e49176b97f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Tue, 23 Jul 2013 08:07:46 +0200
+Subject: [PATCH] Editing iterated hash is undefined
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+utils_lowercase_keys test fails with Perl 5.18 randomly. Interpreter
+complains:
+
+Use of each() on hash after insertion without resetting hash iterator
+results in undefined behavior, Perl interpreter: 0x23b8010 at
+../LW2.pm line 5890.
+
+This patch replaces each with safe keys.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ src/utils.pl | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/utils.pl b/src/utils.pl
+index f08f0fb..08ce2bd 100644
+--- a/src/utils.pl
++++ b/src/utils.pl
+@@ -174,10 +174,10 @@ sub utils_lowercase_keys {
+     return if ( !( defined $href && ref($href) ) );
+ 
+     my $count = 0;
+-    while ( my ( $key, $val ) = each %$href ) {
++    foreach my $key ( keys %$href ) {
+         if ( $key =~ tr/A-Z// ) {
+             $count++;
+-            delete $$href{$key};
++            my $val = delete $$href{$key};
+             $$href{ lc($key) } = $val;
+         }
+     }
+-- 
+1.8.1.4
+
diff --git a/perl-libwhisker2.spec b/perl-libwhisker2.spec
index 596d3a3..d111b16 100644
--- a/perl-libwhisker2.spec
+++ b/perl-libwhisker2.spec
@@ -13,6 +13,8 @@ Source0:        http://downloads.sourceforge.net/whisker/%{real_name}-%{version}
 Patch0:         %{real_name}-2.4-vendorlib.patch
 #include libwhisker1 compatibility bridge
 Patch1:         %{real_name}-2.4-lw1bridge.patch
+# Perl 5.18 compatibility
+Patch2:         %{real_name}-2.5-Editing-iterated-hash-is-undefined.patch
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl(Config)
@@ -55,6 +57,7 @@ Examples how to use LW(2) Perl module.
 %setup -qn %{real_name}-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 mv compat/{lw,LW}.pm
 # Fix EOLs
 for F in CHANGES KNOWNBUGS LICENSE README docs/* scripts/*; do
@@ -102,6 +105,7 @@ perl ./test.pl
 %changelog
 * Mon Jul 22 2013 Petr Pisar <ppisar at redhat.com> - 2.5-9
 - Perl 5.18 rebuild
+- Perl 5.18 compatibility
 
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.5-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild


More information about the scm-commits mailing list