tag 708592 patch
thanks

On Sat, May 18, 2013 at 08:21:13AM +0300, Damyan Ivanov wrote:
> Control: tag -1 - unreproducible
> Control: retitle -1 libb-perlreq-perl: soometimes FTBFS with perl 5.18: 
> hashing updates

> > On Fri, 17 May 2013 00:06:43 +0100, Dominic Hargreaves wrote:
> > > This package FTBFS with perl 5.18 from experimental (in a clean sbuild
> > > session):

> I've done the same several times, and some times it builds ok, some 
> times it fails. Here are a couple of failures
> 
> #   Failed test at t/01-B-PerlReq.t line 48.
> #          got: 'perl(Data/Dumper.pm)'
> #     expected: ''
> # Looks like you failed 1 test of 78.

It's running this under the hood:

  $ perl -Iblib/arch -Iblib/lib perl.req /usr/share/perl/5.18/Exporter.pm
  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.
  /usr/share/perl/5.18/Exporter.pm syntax OK
  perl(Exporter/Heavy.pm)

which indeed occasionally fails to report the Heavy.pm dependency.

The warning message is pretty clear, and the attached patch seems to help.
-- 
Niko Tyni   nt...@debian.org
>From 428c3feac1e9c39f966cc66c36cc3881d202177c Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@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

Reply via email to