Blob Blame History Raw
From 428c3feac1e9c39f966cc66c36cc3881d202177c Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sat, 18 May 2013 09:41:47 +0300
Subject: [PATCH] Fix non-deterministic failures on newer perls

The hash randomization changes in the Perl 5.17 series
made perl.req to occasionally fail to report the dependencies.

Improved diagnostics report

 Use of each() on hash after insertion without resetting hash
 iterator results in undefined behavior, Perl interpreter: 0x9e7010 at
 /home/niko/tmp/libb-perlreq-perl-0.82/blib/lib/B/Walker.pm line 122.

so use keys() instead of each(), as suggested by perldiag.pod.
---
 lib/B/Walker.pm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/B/Walker.pm b/lib/B/Walker.pm
index b71f204..f626043 100644
--- a/lib/B/Walker.pm
+++ b/lib/B/Walker.pm
@@ -119,7 +119,7 @@ sub walk_gv ($) {
 sub walk_stash ($$);
 sub walk_stash ($$) { # similar to B::walksymtable
 	my ($symref, $prefix) = @_;
-	while (my ($sym) = each %$symref) {
+	for my $sym (keys %$symref) {
 		no strict 'refs';
 		my $fullname = "*main::". $prefix . $sym;
 		if ($sym =~ /::\z/) {
-- 
1.7.10.4