Skip Menu |

This queue is for tickets about the Module-Pluggable CPAN distribution.

Report information
The Basics
Id: 83440
Status: resolved
Priority: 0/
Queue: Module-Pluggable

People
Owner: Nobody in particular
Requestors: demerphq [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Hash order traversal dependency bug
Sorry to bug you again. In 5.18 we very likely will have new logic which will make the keyorder of hashes random. Each hash will have its own order, and indeed the order will change every modification to the hash. As such you need to sort the keys you return. Attached is a patch to fix this, which I have applied to yves/hv_h_split in perl.git. I have marked this ticket as important as it is effectively a blocker for 5.18. Ps: the other hash order dependency ticket I filed was reopened when I replied to let you know that your new release was merged to blead.
Subject: 0001-Ensure-that-Module-Pluggable-returns-plugins-in-a-pr.patch
From 8bc0996fa45db307e4267bd6c482933eff18deec Mon Sep 17 00:00:00 2001 From: Yves Orton <demerphq@gmail.com> Date: Tue, 19 Feb 2013 12:14:44 +0100 Subject: [PATCH] Ensure that Module::Pluggable returns plugins in a predictable order As of 5.18 hash traversal order will vary per-hash, and indeed more frequently. The likelihood this results in one of the tests in M::P failing becomes very high. In general the test expectations were fragile, but probably almost never failed. With hash traversal randomization they will fail regularly. --- cpan/Module-Pluggable/lib/Module/Pluggable.pm | 2 +- .../lib/Module/Pluggable/Object.pm | 4 ++-- cpan/Module-Pluggable/t/19can_ok_clobber.t | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cpan/Module-Pluggable/lib/Module/Pluggable.pm b/cpan/Module-Pluggable/lib/Module/Pluggable.pm index a723dbc..9e7962e 100644 --- a/cpan/Module-Pluggable/lib/Module/Pluggable.pm +++ b/cpan/Module-Pluggable/lib/Module/Pluggable.pm @@ -11,7 +11,7 @@ use if $] > 5.017, 'deprecate'; # Peter Gibbons: I wouldn't say I've been missing it, Bob! -$VERSION = '4.6'; # core release only! +$VERSION = '4.7'; $FORCE_SEARCH_ALL_PATHS = 0; sub import { diff --git a/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm b/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm index 3c198a7..b218362 100644 --- a/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm +++ b/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm @@ -83,7 +83,7 @@ sub plugins { if (defined $self->{'instantiate'}) { my $method = $self->{'instantiate'}; my @objs = (); - foreach my $package (keys %plugins) { + foreach my $package (sort keys %plugins) { next unless $package->can($method); my $obj = eval { $package->$method(@_) }; $self->{'on_instantiate_error'}->($package, $@) if $@; @@ -92,7 +92,7 @@ sub plugins { return @objs; } else { # no? just return the names - return keys %plugins; + return sort keys %plugins; } } diff --git a/cpan/Module-Pluggable/t/19can_ok_clobber.t b/cpan/Module-Pluggable/t/19can_ok_clobber.t index 07c598b..8b1466d 100644 --- a/cpan/Module-Pluggable/t/19can_ok_clobber.t +++ b/cpan/Module-Pluggable/t/19can_ok_clobber.t @@ -21,7 +21,7 @@ is_deeply( \@plugins_after, \@plugins, "plugins haven't been clobbered", -); +) or diag Dumper(\@plugins_after,\@plugins); can_ok ($foo, 'frobnitz'); @@ -30,7 +30,7 @@ is_deeply( \@plugins_after, \@plugins, "plugins haven't been clobbered", -) or diag Dumper ; +) or diag Dumper(\@plugins_after,\@plugins); -- 1.7.5.4
From: demerphq [...] gmail.com
On Tue Feb 19 06:34:48 2013, demerphq@gmail.com wrote: Show quoted text
> I have marked this ticket as important as it is effectively a blocker
for Show quoted text
> 5.18.
See also: https://rt.perl.org/rt3/Ticket/Display.html?id=116855
From: demerphq [...] gmail.com
On Tue Feb 19 06:34:48 2013, demerphq@gmail.com wrote: Show quoted text
> Sorry to bug you again. In 5.18 we very likely will have new logic
which Show quoted text
> will make the keyorder of hashes random. Each hash will have its own > order, and indeed the order will change every modification to the
hash. Show quoted text
> > As such you need to sort the keys you return. > > Attached is a patch to fix this, which I have applied to
yves/hv_h_split Show quoted text
> in perl.git. > > I have marked this ticket as important as it is effectively a blocker
for Show quoted text
> 5.18. > > Ps: the other hash order dependency ticket I filed was reopened when I > replied to let you know that your new release was merged to blead.
Seems like this causes a different test to fail. I am investigating. Expect a follow up patch. Yves
From: demerphq [...] gmail.com
On Tue Feb 19 07:19:46 2013, demerphq@gmail.com wrote: Show quoted text
> Seems like this causes a different test to fail. I am investigating. > Expect a follow up patch.
Attached. Sorry about that.
Subject: 0001-Ensure-that-Module-Pluggable-returns-plugins-in-a-pr.patch
From d81ddffabda9411311983bdbd69c4e7a029d8b45 Mon Sep 17 00:00:00 2001 From: Yves Orton <demerphq@gmail.com> Date: Tue, 19 Feb 2013 12:14:44 +0100 Subject: [PATCH] Ensure that Module::Pluggable returns plugins in a predictable order As of 5.18 hash traversal order will vary per-hash, and indeed more frequently. The likelihood this results in one of the tests in M::P failing becomes very high. In general the test expectations were fragile, but probably almost never failed. With hash traversal randomization they will fail regularly. Note the use a temporary array in part of this patch is because sort in scalar context is undefined. --- cpan/Module-Pluggable/lib/Module/Pluggable.pm | 2 +- .../lib/Module/Pluggable/Object.pm | 5 +++-- cpan/Module-Pluggable/t/19can_ok_clobber.t | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cpan/Module-Pluggable/lib/Module/Pluggable.pm b/cpan/Module-Pluggable/lib/Module/Pluggable.pm index a723dbc..9e7962e 100644 --- a/cpan/Module-Pluggable/lib/Module/Pluggable.pm +++ b/cpan/Module-Pluggable/lib/Module/Pluggable.pm @@ -11,7 +11,7 @@ use if $] > 5.017, 'deprecate'; # Peter Gibbons: I wouldn't say I've been missing it, Bob! -$VERSION = '4.6'; # core release only! +$VERSION = '4.7'; $FORCE_SEARCH_ALL_PATHS = 0; sub import { diff --git a/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm b/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm index 3c198a7..c9960d3 100644 --- a/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm +++ b/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm @@ -83,7 +83,7 @@ sub plugins { if (defined $self->{'instantiate'}) { my $method = $self->{'instantiate'}; my @objs = (); - foreach my $package (keys %plugins) { + foreach my $package (sort keys %plugins) { next unless $package->can($method); my $obj = eval { $package->$method(@_) }; $self->{'on_instantiate_error'}->($package, $@) if $@; @@ -92,7 +92,8 @@ sub plugins { return @objs; } else { # no? just return the names - return keys %plugins; + my @objs= sort keys %plugins; + return @objs; } } diff --git a/cpan/Module-Pluggable/t/19can_ok_clobber.t b/cpan/Module-Pluggable/t/19can_ok_clobber.t index 07c598b..8b1466d 100644 --- a/cpan/Module-Pluggable/t/19can_ok_clobber.t +++ b/cpan/Module-Pluggable/t/19can_ok_clobber.t @@ -21,7 +21,7 @@ is_deeply( \@plugins_after, \@plugins, "plugins haven't been clobbered", -); +) or diag Dumper(\@plugins_after,\@plugins); can_ok ($foo, 'frobnitz'); @@ -30,7 +30,7 @@ is_deeply( \@plugins_after, \@plugins, "plugins haven't been clobbered", -) or diag Dumper ; +) or diag Dumper(\@plugins_after,\@plugins); -- 1.7.5.4
Thanks ... I'll get a new version out soon.
Subject: Re: [rt.cpan.org #83440] Hash order traversal dependency bug
Date: Tue, 19 Feb 2013 18:17:35 +0100
To: bug-Module-Pluggable [...] rt.cpan.org
From: demerphq <demerphq [...] gmail.com>
On 19 February 2013 18:11, Simon Wistow via RT <bug-Module-Pluggable@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=83440 > > > Thanks ... I'll get a new version out soon.
Great, dont forget to reclose https://rt.cpan.org/Ticket/Display.html?id=80416 es (sorry about that, my bad) yv -- perl -Mre=debug -e "/just|another|perl|hacker/"
From: demerphq [...] gmail.com
On Tue Feb 19 12:11:04 2013, SIMONW wrote: Show quoted text
> Thanks ... I'll get a new version out soon. >
Sorry to bug you again, but I am waiting on you rolling a new release to get important patches merged to blead for 5.18. Please could you roll a new release ASAP. Thanks, Yves
Fixed ... sorry for the delay.