Skip Menu |
Report information
Id: 127351
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: andreas.koenig.7os6VVqR [at] franz.ak.mind.de
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)

Attachments
0001-perl-127351-TODO-tests-for-arrayref-assigned-to-Foo-.patch
0002-perl-127351-add-isaelem-magic-on-Foo-ISA-arrayref.patch



Subject: Bleadperl v5.23.6-97-g6146d9e breaks EXODIST/Test-Stream-1.302026.tar.gz
Date: Fri, 22 Jan 2016 23:57:09 +0100
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 4.1k
This BBC once again comes to you from our one and only Slaven Rezić. bisect ------ commit 6146d9e1c87d449f5c7e9c953a2e9051e32b1696 Author: Tony Cook <tony@develop-help.com> Date: Mon Jan 11 14:45:43 2016 +1100 [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 http://www.cpantesters.org/cpan/report/e4c17e90-c052-11e5-9614-62d90259f3db Note that I cannot reproduce the case by just running 'perl t/modules/Mock.t', only with 'make test'. perl -V ------- Summary of my perl5 (revision 5 version 23 subversion 8) configuration: Derived from: 2ff6ae51776ea7ad252ee15ca433f0390b3ab50b Platform: osname=linux, osvers=4.3.0-1-amd64, archname=x86_64-linux-thread-multi-ld uname='linux k83 4.3.0-1-amd64 #1 smp debian 4.3.3-2 (2015-12-17) x86_64 gnulinux ' config_args='-Dprefix=/home/sand/src/perl/repoperls/installed-perls/perl/v5.23.7-11-g2ff6ae5/109d -Dmyhostname=k83 -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Dlibswanted=cl pthread socket inet nsl gdbm dbm malloc dl ld sun m crypt sec util c cposix posix ucb BSD gdbm_compat -Duseithreads -Duselongdouble -DDEBUGGING=-g' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=define, uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2', optimize='-O2 -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='', gccversion='5.3.1 20160101', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8 alignbytes=16, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.21.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.21' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Locally applied patches: uncommitted-changes Devel::PatchPerl 1.38 Built under linux Compiled at Jan 21 2016 05:01:39 %ENV: PERL5LIB="" PERL5OPT="" PERL5_CPANPLUS_IS_RUNNING="30950" PERL5_CPAN_IS_RUNNING="30950" PERL_MM_USE_DEFAULT="1" @INC: /home/sand/src/perl/repoperls/installed-perls/perl/v5.23.7-11-g2ff6ae5/109d/lib/site_perl/5.23.8/x86_64-linux-thread-multi-ld /home/sand/src/perl/repoperls/installed-perls/perl/v5.23.7-11-g2ff6ae5/109d/lib/site_perl/5.23.8 /home/sand/src/perl/repoperls/installed-perls/perl/v5.23.7-11-g2ff6ae5/109d/lib/5.23.8/x86_64-linux-thread-multi-ld /home/sand/src/perl/repoperls/installed-perls/perl/v5.23.7-11-g2ff6ae5/109d/lib/5.23.8 . -- andreas
Date: Sat, 23 Jan 2016 00:14:07 +0100
Subject: [perl #127351] Bleadperl v5.23.6-97-g6146d9e breaks EXODIST/Test-Stream-1.302026.tar.gz
To: perlbug-followup [...] perl.org
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Download (untitled) / with headers
text/plain 2.1k
Sorry, I forgot the stack trace: Program terminated with signal SIGSEGV, Segmentation fault. #0 Perl_mg_free_type (my_perl=my_perl@entry=0x2657010, sv=0x35b4ac8, how=how@entry=105) at mg.c:595 595 if (mg->mg_type == how) { (gdb) bt #0 Perl_mg_free_type (my_perl=my_perl@entry=0x2657010, sv=0x35b4ac8, how=how@entry=105) at mg.c:595 #1 0x00000000004b3bf1 in S_hv_delete_common (hash=<optimized out>, d_flags=68, k_flags=<optimized out>, klen=3, key=<optimized out>, keysv=<optimized out>, hv=0x35bce20, my_perl=0x35a0fc0) at hv.c:1188 #2 Perl_hv_common (my_perl=my_perl@entry=0x2657010, hv=hv@entry=0x35adea8, keysv=<optimized out>, keysv@entry=0x309a280, key=<optimized out>, key@entry=0x0, klen=3, klen@entry=0, flags=<optimized out>, flags@entry=0, action=68, val=0x0, hash=<optimized out>) at hv.c:397 #3 0x00000000004c04b5 in Perl_pp_multideref (my_perl=0x2657010) at pp_hot.c:2536 #4 0x00000000004b7876 in Perl_runops_standard (my_perl=0x2657010) at run.c:41 #5 0x000000000043b7de in Perl_call_sv (my_perl=my_perl@entry=0x2657010, sv=sv@entry=0x3091c30, flags=flags@entry=45) at perl.c:2788 #6 0x00000000004c3993 in S_curse (my_perl=my_perl@entry=0x2657010, sv=sv@entry=0x35b46d8, check_refcnt=check_refcnt@entry=true) at sv.c:6784 #7 0x00000000004c43d0 in Perl_sv_clear (my_perl=my_perl@entry=0x2657010, orig_sv=orig_sv@entry=0x35b46d8) at sv.c:6415 #8 0x00000000004c468d in Perl_sv_free2 (my_perl=0x2657010, sv=0x35b46d8, rc=<optimized out>) at sv.c:6885 #9 0x00000000004f438f in Perl_leave_scope (my_perl=0x2657010, base=<optimized out>) at scope.c:1080 #10 0x00000000004f47a5 in Perl_pop_scope (my_perl=my_perl@entry=0x2657010) at scope.c:122 #11 0x00000000004be6b6 in Perl_pp_leavesub (my_perl=0x2657010) at pp_hot.c:3318 #12 0x00000000004b7876 in Perl_runops_standard (my_perl=0x2657010) at run.c:41 #13 0x0000000000442c85 in S_run_body (oldscope=<optimized out>, my_perl=<optimized out>) at perl.c:2459 #14 perl_run (my_perl=0x2657010) at perl.c:2387 #15 0x000000000041ccab in main (argc=2, argv=0x7ffed4fcaea8, env=0x7ffed4fcaec0) at perlmain.c:116 -- andreas
RT-Send-CC: perl5-porters [...] perl.org
On Fri Jan 22 14:57:39 2016, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote: Show quoted text
> This BBC once again comes to you from our one and only Slaven Rezić. > > bisect > ------ > commit 6146d9e1c87d449f5c7e9c953a2e9051e32b1696 > Author: Tony Cook <tony@develop-help.com> > Date: Mon Jan 11 14:45:43 2016 +1100 > > [perl #123788] update isa magic stash records when *ISA is deleted
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" }; *My::OtherParent::foo = sub { "other" }; my $x = [ "My::Parent" ]; *Fake::ISA = $x; print Fake->foo, "\n"; $x->[0] = "My::OtherParent"; print Fake->foo, "\n"; outputs "foo" twice. The attached patches should fix both issues. Tony
Subject: 0001-perl-127351-TODO-tests-for-arrayref-assigned-to-Foo-.patch
From 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
Subject: 0002-perl-127351-add-isaelem-magic-on-Foo-ISA-arrayref.patch
From 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
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 225b
On Mon Jan 25 21:09:52 2016, tonyc wrote: Show quoted text
> The attached patches should fix both issues.
Applied to blead as 23895cdc3161aed8a5516d7d1245ddc5b67ddc6b (with a spelling fix) and 8452c1a03e174c7b4f513b81f58ac142e290df36. Tony
Download (untitled) / with headers
text/plain 252b
Thank you for submitting this report. You have helped make Perl better. With the release of Perl 5.24.0 on May 9, 2016, this and 149 other issues have been resolved. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org