New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bleadperl v5.23.6-97-g6146d9e breaks EXODIST/Test-Stream-1.302026.tar.gz #15143
Comments
From @andkThis BBC once again comes to you from our one and only Slaven Rezić. bisect commit 6146d9e [perl #123788] update isa magic stash records when *ISA is deleted cpantesters http://matrix.cpantesters.org/?dist=Test-Stream%201.302026;os=linux;reports=1#sl=4,1 Note that I cannot reproduce the case by just running 'perl perl -V Summary of my perl5 (revision 5 version 23 subversion 8) configuration: Characteristics of this binary (from libperl): -- |
From @andkSorry, I forgot the stack trace: Program terminated with signal SIGSEGV, Segmentation fault. -- |
From @tonycozOn Fri Jan 22 14:57:39 2016, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
This is indirectly caused by a different bug in perl. When you do: *Foo::ISA = somearrayref no isaelem magic is set on the array, the code I added then tries to remove that magic from an SV that can't have it, which asserts or crashes when somearrayref is no longer an @ISA. It also means that assignments to the elements of that @ISA don't update the method cache, so: *My::Parent::foo = sub { "foo" }; outputs "foo" twice. The attached patches should fix both issues. Tony |
From @tonycoz0001-perl-127351-TODO-tests-for-arrayref-assigned-to-Foo-.patchFrom e0f90649013c4521f51ec6d830b6f2315b2b753b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 26 Jan 2016 15:22:46 +1100
Subject: [perl #127351] TODO tests for arrayref assigned to *Foo::ISA issues
---
t/mro/basic.t | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/t/mro/basic.t b/t/mro/basic.t
index d5663f4..7aca00f 100644
--- a/t/mro/basic.t
+++ b/t/mro/basic.t
@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings;
-plan(tests => 64);
+plan(tests => 66);
require mro;
@@ -433,3 +433,37 @@ delete $Bar::{ISA};
print "ok\n";
PROG
}
+
+{
+ # [perl #127351]
+ local $::TODO = "assignment to *Foo::ISA doesn't magicalize elements";
+ # *Foo::ISA = \@some_array
+ # didn't magicalize the elements of @some_array, causing two
+ # problems:
+
+ # a) assignment to those elements didn't update the cache
+
+ fresh_perl_is(<<'PROG', "foo\nother", {}, "magical *ISA = arrayref elements");
+*My::Parent::foo = sub { "foo" };
+*My::OtherParent::foo = sub { "other" };
+my $x = [ "My::Parent" ];
+*Fake::ISA = $x;
+print Fake->foo, "\n";
+$x->[0] = "My::OtherParent";
+print Fake->foo, "\n";
+PROG
+
+ # b) code that attemptted to remove the magic when @some_array
+ # was no longer an @ISA asserted/crashed
+
+ fresh_perl_is(<<'PROG', "foo", {}, "unmagicalize *ISA elements");
+{
+ local *My::Parent::foo = sub { "foo" };
+ my $x = [ "My::Parent" ];
+ *Fake::ISA = $x;
+ print Fake->foo, "\n";
+ my $s = \%Fake::;
+ delete $s->{ISA};
+}
+PROG
+}
--
2.1.4
|
From @tonycoz0002-perl-127351-add-isaelem-magic-on-Foo-ISA-arrayref.patchFrom f350f96ef8a6504e66c542cdccdd9445c81073c3 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 26 Jan 2016 15:53:34 +1100
Subject: [perl #127351] add isaelem magic on *Foo::ISA = arrayref
---
sv.c | 9 +++++++++
t/mro/basic.t | 1 -
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/sv.c b/sv.c
index e3e5af4..ad2208e 100644
--- a/sv.c
+++ b/sv.c
@@ -4184,9 +4184,18 @@ Perl_gv_setref(pTHX_ SV *const dstr, SV *const sstr)
}
else
{
+ SSize_t i;
sv_magic(
sref, omg ? omg->mg_obj : dstr, PERL_MAGIC_isa, NULL, 0
);
+ for (i = 0; i <= AvFILL(sref); ++i) {
+ SV **elem = av_fetch ((AV*)sref, i, 0);
+ if (elem) {
+ sv_magic(
+ *elem, sref, PERL_MAGIC_isaelem, NULL, i
+ );
+ }
+ }
mg = mg_find(sref, PERL_MAGIC_isa);
}
/* Since the *ISA assignment could have affected more than
diff --git a/t/mro/basic.t b/t/mro/basic.t
index 7aca00f..7195c4b 100644
--- a/t/mro/basic.t
+++ b/t/mro/basic.t
@@ -436,7 +436,6 @@ PROG
{
# [perl #127351]
- local $::TODO = "assignment to *Foo::ISA doesn't magicalize elements";
# *Foo::ISA = \@some_array
# didn't magicalize the elements of @some_array, causing two
# problems:
--
2.1.4
|
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127351 (status was 'resolved')
Searchable as RT127351$
The text was updated successfully, but these errors were encountered: