summaryrefslogtreecommitdiff
path: root/dev-lang/perl/files
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-11-22 18:00:50 +0000
committerSam James <sam@gentoo.org>2025-11-22 18:01:32 +0000
commitc8c277e982d6f33af441d09c5cacb88d931bdace (patch)
treec36a1d6fdd34e44e9f27de717e5332e0edfe874d /dev-lang/perl/files
parent71fc6791c36a3873c9c1177c47e549fe3b89c148 (diff)
downloadgentoo-c8c277e982d6f33af441d09c5cacb88d931bdace.tar.gz
gentoo-c8c277e982d6f33af441d09c5cacb88d931bdace.tar.bz2
gentoo-c8c277e982d6f33af441d09c5cacb88d931bdace.zip
dev-lang/perl: backport various fixes to 5.42.0
5.42.1 doesn't seem to be imminent, so backport fixes queued upstream. Bug: https://bugs.gentoo.org/964245 Closes: https://bugs.gentoo.org/964379 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-lang/perl/files')
-rw-r--r--dev-lang/perl/files/5.42.0/0001-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch83
-rw-r--r--dev-lang/perl/files/5.42.0/0002-class.c-gracefully-handle-reader-writer-after-strict.patch87
-rw-r--r--dev-lang/perl/files/5.42.0/0003-use-5.41-affects-current-line-source-encoding.patch52
-rw-r--r--dev-lang/perl/files/5.42.0/0004-Turn-off-POSIX-2008-locales-on-AIX.patch33
4 files changed, 255 insertions, 0 deletions
diff --git a/dev-lang/perl/files/5.42.0/0001-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch b/dev-lang/perl/files/5.42.0/0001-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch
new file mode 100644
index 000000000000..873a6e498728
--- /dev/null
+++ b/dev-lang/perl/files/5.42.0/0001-newFOROP-fix-crash-when-optimizing-2-var-for-over-bu.patch
@@ -0,0 +1,83 @@
+From 7dbc795b44eb54d41e1c6b30d8796525d65d52b5 Mon Sep 17 00:00:00 2001
+Message-ID: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+From: Lukas Mai <lukasmai.403@gmail.com>
+Date: Fri, 11 Jul 2025 09:07:00 +0200
+Subject: [PATCH 1/4] newFOROP: fix crash when optimizing 2-var for over
+ builtin::indexed
+
+OP_ENTERSUB isn't necessarily a LISTOP, apparently, so we can't just
+grab its op_last. Instead, copy/paste logic from elsewhere in op.c to
+find the cvop.
+
+Also, avoid crashing on "fake" pad entries that represent lexical subs
+from outer scopes by climbing up the scope chain until we reach a real
+pad entry.
+
+Fixes #23405.
+
+(cherry picked from commit 96673a4bb36a973a9a4c5cd0e5727a799789a32c)
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ op.c | 14 +++++++++++---
+ t/op/for-many.t | 13 +++++++++++++
+ 2 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/op.c b/op.c
+index f616532c49..3c316ea8b4 100644
+--- a/op.c
++++ b/op.c
+@@ -9665,7 +9665,7 @@ S_op_is_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
+ }
+
+ case OP_PADCV:
+- cv = (CV *)PAD_SVl(o->op_targ);
++ cv = find_lexical_cv(o->op_targ);
+ assert(cv && SvTYPE(cv) == SVt_PVCV);
+ break;
+
+@@ -9683,10 +9683,18 @@ S_op_is_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
+ static bool
+ S_op_is_call_to_cv_xsub(pTHX_ OP *o, XSUBADDR_t xsub)
+ {
+- if(o->op_type != OP_ENTERSUB)
++ if (o->op_type != OP_ENTERSUB)
+ return false;
+
+- OP *cvop = cLISTOPx(cUNOPo->op_first)->op_last;
++ /* entersub may be a UNOP, not a LISTOP, so we can't just use op_last */
++ OP *aop = cUNOPo->op_first;
++ if (!OpHAS_SIBLING(aop)) {
++ aop = cUNOPx(aop)->op_first;
++ }
++ aop = OpSIBLING(aop);
++ OP *cvop;
++ for (cvop = aop; OpHAS_SIBLING(cvop); cvop = OpSIBLING(cvop)) ;
++
+ return op_is_cv_xsub(cvop, xsub);
+ }
+
+diff --git a/t/op/for-many.t b/t/op/for-many.t
+index 2f6790aee7..035d1da07e 100644
+--- a/t/op/for-many.t
++++ b/t/op/for-many.t
+@@ -498,4 +498,17 @@ is($continue, 'xx', 'continue reached twice');
+ is("@have", "Pointy end Up Flamey end Down", 'for my ($one, $two)');
+ }
+
++# GH #23405 - segfaults when compiling 2-var for loops
++{
++ my $dummy = sub {};
++ for my ($x, $y) (main->$dummy) {}
++ pass '2-var for does not crash on method calls';
++
++ my sub dummy {}
++ sub {
++ for my ($x, $y) (dummy) {}
++ }->();
++ pass '2-var for does not crash on lexical sub calls';
++}
++
+ done_testing();
+--
+2.52.0
+
diff --git a/dev-lang/perl/files/5.42.0/0002-class.c-gracefully-handle-reader-writer-after-strict.patch b/dev-lang/perl/files/5.42.0/0002-class.c-gracefully-handle-reader-writer-after-strict.patch
new file mode 100644
index 000000000000..5932329b7ee9
--- /dev/null
+++ b/dev-lang/perl/files/5.42.0/0002-class.c-gracefully-handle-reader-writer-after-strict.patch
@@ -0,0 +1,87 @@
+From 7ec9aea1c525aee1e1a638f943c4374945ea5b17 Mon Sep 17 00:00:00 2001
+Message-ID: <7ec9aea1c525aee1e1a638f943c4374945ea5b17.1763833678.git.sam@gentoo.org>
+In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+From: Lukas Mai <lukasmai.403@gmail.com>
+Date: Wed, 30 Jul 2025 23:09:54 +0200
+Subject: [PATCH 2/4] class.c: gracefully handle reader/writer after 'strict'
+ error
+
+Fixes #23511.
+
+(cherry picked from commit 4e22a3d0e5f933b38e3fa1b98c904fe224001b63)
+---
+ MANIFEST | 1 +
+ class.c | 6 ++++--
+ t/class/gh23511.t | 23 +++++++++++++++++++++++
+ 3 files changed, 28 insertions(+), 2 deletions(-)
+ create mode 100644 t/class/gh23511.t
+
+diff --git a/MANIFEST b/MANIFEST
+index f530320dcc..d8c7b04816 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -5997,6 +5997,7 @@ t/class/construct.t See if class constructors work
+ t/class/destruct.t See if class destruction works
+ t/class/field.t See if class field declarations work
+ t/class/gh22169.t Test defining a class that previously failed to define
++t/class/gh23511.t Test defining a reader after a strict 'vars' violation
+ t/class/inherit.t See if class inheritance works
+ t/class/method.t See if class method declarations work
+ t/class/phasers.t See if class phaser blocks work
+diff --git a/class.c b/class.c
+index d6d801928d..a91656d469 100644
+--- a/class.c
++++ b/class.c
+@@ -1140,7 +1140,8 @@ apply_field_attribute_reader(pTHX_ PADNAME *pn, SV *value)
+ OP *nameop = newSVOP(OP_CONST, 0, value);
+
+ CV *cv = newATTRSUB(floor_ix, nameop, NULL, NULL, ops);
+- CvIsMETHOD_on(cv);
++ if (cv)
++ CvIsMETHOD_on(cv);
+ }
+
+ /* If '@_' is called "snail", then elements of it can be called "slugs"; i.e.
+@@ -1238,7 +1239,8 @@ apply_field_attribute_writer(pTHX_ PADNAME *pn, SV *value)
+ OP *nameop = newSVOP(OP_CONST, 0, value);
+
+ CV *cv = newATTRSUB(floor_ix, nameop, NULL, NULL, ops);
+- CvIsMETHOD_on(cv);
++ if (cv)
++ CvIsMETHOD_on(cv);
+ }
+
+ static struct {
+diff --git a/t/class/gh23511.t b/t/class/gh23511.t
+new file mode 100644
+index 0000000000..ae66269003
+--- /dev/null
++++ b/t/class/gh23511.t
+@@ -0,0 +1,23 @@
++#!./perl
++
++BEGIN {
++ chdir 't' if -d 't';
++ require './test.pl';
++ set_up_inc('../lib');
++}
++
++use v5.36;
++use feature 'class';
++no warnings 'experimental::class';
++
++# this used to segfault: GH #23511
++eval <<'CLASS';
++class MyTest {
++ $id = 6;
++ field $f1 :reader;
++ field $f2 :writer;
++}
++CLASS
++like $@, qr/^Global symbol "\$id" requires explicit package name /, "we get the expected 'undeclared variable' error";
++
++done_testing;
+--
+2.52.0
+
diff --git a/dev-lang/perl/files/5.42.0/0003-use-5.41-affects-current-line-source-encoding.patch b/dev-lang/perl/files/5.42.0/0003-use-5.41-affects-current-line-source-encoding.patch
new file mode 100644
index 000000000000..bfec7d86a213
--- /dev/null
+++ b/dev-lang/perl/files/5.42.0/0003-use-5.41-affects-current-line-source-encoding.patch
@@ -0,0 +1,52 @@
+From 0e0b91d4881226a5532f166662a27ba58f4f718b Mon Sep 17 00:00:00 2001
+Message-ID: <0e0b91d4881226a5532f166662a27ba58f4f718b.1763833678.git.sam@gentoo.org>
+In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+From: Yitzchak Scott-Thoennes <sthoenna@gmail.com>
+Date: Fri, 31 Oct 2025 05:05:33 -0600
+Subject: [PATCH 3/4] 'use 5.41' affects current line source::encoding
+
+Previously it didn't take effect until subsequent lines
+
+Fixes #23881
+
+(cherry picked from commit 5d62050d173f59a343236c6259b5c821d58268d2)
+---
+ lib/source/source_encoding.t | 7 ++++++-
+ op.c | 1 +
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/lib/source/source_encoding.t b/lib/source/source_encoding.t
+index a08489637e..a11b1ca45b 100644
+--- a/lib/source/source_encoding.t
++++ b/lib/source/source_encoding.t
+@@ -44,8 +44,13 @@ if (fresh_perl_like(<<~'EOT',
+ EOT
+ "",
+ { }, "source encoding can be turned off");
++ fresh_perl_like(<<~'EOT',
++ use v5.41.0; my $var = "ΒΆ";
++ EOT
++ qr/Use of non-ASCII character 0x[[:xdigit:]]{2} illegal/,
++ { }, ">= 'use statement affects rest of current line'");
+ }
+-else { # Above test depends on the previous one; if that failed, use this
++else { # Above tests depend on the previous one; if that failed, use this
+ # alternate one
+ fresh_perl_is(<<~'EOT',
+ use source::encoding 'ascii';
+diff --git a/op.c b/op.c
+index 3c316ea8b4..f51eeb3945 100644
+--- a/op.c
++++ b/op.c
+@@ -8341,6 +8341,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
+ else {
+ PL_hints &= ~HINT_ASCII_ENCODING;
+ }
++ notify_parser_that_encoding_changed();
+
+ PL_prevailing_version = shortver;
+ }
+--
+2.52.0
+
diff --git a/dev-lang/perl/files/5.42.0/0004-Turn-off-POSIX-2008-locales-on-AIX.patch b/dev-lang/perl/files/5.42.0/0004-Turn-off-POSIX-2008-locales-on-AIX.patch
new file mode 100644
index 000000000000..59eb6c80321b
--- /dev/null
+++ b/dev-lang/perl/files/5.42.0/0004-Turn-off-POSIX-2008-locales-on-AIX.patch
@@ -0,0 +1,33 @@
+From 8c90537ed9c2dcac79bac7b3f9b457f1ad3abfa3 Mon Sep 17 00:00:00 2001
+Message-ID: <8c90537ed9c2dcac79bac7b3f9b457f1ad3abfa3.1763833678.git.sam@gentoo.org>
+In-Reply-To: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+References: <7dbc795b44eb54d41e1c6b30d8796525d65d52b5.1763833678.git.sam@gentoo.org>
+From: Karl Williamson <khw@cpan.org>
+Date: Thu, 9 Oct 2025 17:27:31 -0600
+Subject: [PATCH 4/4] Turn off POSIX 2008 locales on AIX
+
+Fixes #23825
+
+From the discussion in that ticket, it appears that the problem is the
+OS.
+
+(cherry picked from commit 1f9d9f8d5ef1241dab5c762f1d6569567377cf87)
+---
+ hints/aix.sh | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/hints/aix.sh b/hints/aix.sh
+index 279365c85b..3e54e450fb 100644
+--- a/hints/aix.sh
++++ b/hints/aix.sh
+@@ -700,4 +700,7 @@ case "$osvers" in
+ ;;
+ esac
+
++# GH #23825
++d_duplocale='undef'
++
+ # EOF
+--
+2.52.0
+