Fix handling attribute specification on our variables

This commit is contained in:
Petr Písař 2017-08-09 14:39:31 +02:00
parent f5d76e71ba
commit 2d9a38d99f
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,62 @@
From 6091bd4ca4a4a4c9b6f8cadddb53c19b96748a04 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 19 Jun 2017 14:59:53 +1000
Subject: [PATCH] (perl #131597) ensure the GV slot is filled for our [%$@]foo:
attr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
op.c | 6 +++---
t/op/attrs.t | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/op.c b/op.c
index 1a2101c..c6b5ec7 100644
--- a/op.c
+++ b/op.c
@@ -3826,9 +3826,9 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
PL_parser->in_my = FALSE;
PL_parser->in_my_stash = NULL;
apply_attrs(GvSTASH(gv),
- (type == OP_RV2SV ? GvSV(gv) :
- type == OP_RV2AV ? MUTABLE_SV(GvAV(gv)) :
- type == OP_RV2HV ? MUTABLE_SV(GvHV(gv)) : MUTABLE_SV(gv)),
+ (type == OP_RV2SV ? GvSVn(gv) :
+ type == OP_RV2AV ? MUTABLE_SV(GvAVn(gv)) :
+ type == OP_RV2HV ? MUTABLE_SV(GvHVn(gv)) : MUTABLE_SV(gv)),
attrs);
}
o->op_private |= OPpOUR_INTRO;
diff --git a/t/op/attrs.t b/t/op/attrs.t
index 2514270..649525c 100644
--- a/t/op/attrs.t
+++ b/t/op/attrs.t
@@ -489,4 +489,22 @@ EOP
is($out, '', 'RT #3605: $a ? my $var : my $othervar is perfectly valid syntax');
}
+fresh_perl_is('sub dummy {} our $dummy : Dummy', <<EOS, {},
+Invalid SCALAR attribute: Dummy at - line 1.
+BEGIN failed--compilation aborted at - line 1.
+EOS
+ "attribute on our scalar with sub of same name");
+
+fresh_perl_is('sub dummy {} our @dummy : Dummy', <<EOS, {},
+Invalid ARRAY attribute: Dummy at - line 1.
+BEGIN failed--compilation aborted at - line 1.
+EOS
+ "attribute on our array with sub of same name");
+
+fresh_perl_is('sub dummy {} our %dummy : Dummy', <<EOS, {},
+Invalid HASH attribute: Dummy at - line 1.
+BEGIN failed--compilation aborted at - line 1.
+EOS
+ "attribute on our hash with sub of same name");
+
done_testing();
--
2.9.4

View File

@ -208,6 +208,10 @@ Patch51: perl-5.27.1-perl-131679-Fix-our-sub-foo-bar-message.patch
# not yet accepted by upstream
Patch52: perl-5.26.0-perl-131588-be-a-little-more-careful-in-arybase-_tie.patch
# Fix handling attribute specification on our variables, RT#131597,
# in upstream adter 5.27.1
Patch53: perl-5.27.1-perl-131597-ensure-the-GV-slot-is-filled-for-our-foo.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2790,6 +2794,7 @@ Perl extension for Version Objects
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch200 -p1
%patch201 -p1
@ -2827,6 +2832,7 @@ perl -x patchlevel.h \
'Fedora Patch50: Fix select called with a repeated magical variable (RT#131645)' \
'Fedora Patch51: Fix error message for "our sub foo::bar" (RT#131679)' \
'Fedora Patch52: Fix executing arybase::_tie_it() in Safe compartement (RT#131588)' \
'Fedora Patch53: Fix handling attribute specification on our variables (RT#131597)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -5120,6 +5126,7 @@ popd
- Fix select called with a repeated magical variable (RT#131645)
- Fix error message for "our sub foo::bar" (RT#131679)
- Fix executing arybase::_tie_it() in Safe compartement (RT#131588)
- Fix handling attribute specification on our variables (RT#131597)
* Sat Jul 29 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4:5.26.0-397
- Enable separate debuginfo back