pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/perl5



Module Name:    pkgsrc
Committed By:   wiz
Date:           Fri Dec 12 08:11:40 UTC 2025

Modified Files:
        pkgsrc/lang/perl5: Makefile distinfo
Added Files:
        pkgsrc/lang/perl5/patches: patch-op.c patch-t_op_for-many.t

Log Message:
perl5: fix segfault using upstream commit

>From James Cook in PR 59831.

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 pkgsrc/lang/perl5/Makefile
cvs rdiff -u -r1.194 -r1.195 pkgsrc/lang/perl5/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/perl5/patches/patch-op.c \
    pkgsrc/lang/perl5/patches/patch-t_op_for-many.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/perl5/Makefile
diff -u pkgsrc/lang/perl5/Makefile:1.289 pkgsrc/lang/perl5/Makefile:1.290
--- pkgsrc/lang/perl5/Makefile:1.289    Fri Jul  4 08:41:44 2025
+++ pkgsrc/lang/perl5/Makefile  Fri Dec 12 08:11:40 2025
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.289 2025/07/04 08:41:44 wiz Exp $
+# $NetBSD: Makefile,v 1.290 2025/12/12 08:11:40 wiz Exp $
 
 .include "license.mk"
 .include "Makefile.common"
 
+PKGREVISION=   1
 COMMENT=       Practical Extraction and Report Language
 
 CONFLICTS+=    perl-base-[0-9]* perl-thread-[0-9]*

Index: pkgsrc/lang/perl5/distinfo
diff -u pkgsrc/lang/perl5/distinfo:1.194 pkgsrc/lang/perl5/distinfo:1.195
--- pkgsrc/lang/perl5/distinfo:1.194    Fri Jul  4 08:58:56 2025
+++ pkgsrc/lang/perl5/distinfo  Fri Dec 12 08:11:40 2025
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.194 2025/07/04 08:58:56 wiz Exp $
+$NetBSD: distinfo,v 1.195 2025/12/12 08:11:40 wiz Exp $
 
 BLAKE2s (perl-5.42.0.tar.xz) = 0afd0ca2a31a2445d7232c451312717a72ceb208c4e2c39016a2d9924bde7601
 SHA512 (perl-5.42.0.tar.xz) = b10f74d1245a879ae51d3ad93ad519a148df126ec865715474c801548ccfc3f542ef3bbb1f59568cea2ec77302d428dc772aba605357d7faf13eb6a351917275
@@ -13,3 +13,5 @@ SHA1 (patch-hints_linux.sh) = 4baa8f8069
 SHA1 (patch-hints_netbsd.sh) = cb498170c18f1f429eed9be245cd1df24c7ad628
 SHA1 (patch-hints_solaris__2.sh) = 83b20650435ea3b62314af6059f3d82c3dd6b0a2
 SHA1 (patch-installperl) = b129d64cc17b898b44fe6282b8b1df36e342d0ef
+SHA1 (patch-op.c) = 54ceab552d73583a0cc4a1e48839c866084f012f
+SHA1 (patch-t_op_for-many.t) = 9bd20c6b967960e82de1ce61a529cdcbb27e2243

Added files:

Index: pkgsrc/lang/perl5/patches/patch-op.c
diff -u /dev/null pkgsrc/lang/perl5/patches/patch-op.c:1.1
--- /dev/null   Fri Dec 12 08:11:40 2025
+++ pkgsrc/lang/perl5/patches/patch-op.c        Fri Dec 12 08:11:40 2025
@@ -0,0 +1,52 @@
+$NetBSD: patch-op.c,v 1.1 2025/12/12 08:11:40 wiz Exp $
+
+Fix a segfault when compiling a 2-var for loop over builtin::indexed.
+
+This is upstream git commit 96673a4bb36, with the following commit
+message:
+ 
+ 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.
+
+diff d83bd2549fce92d161cd621b02e1f3c83162a718 96673a4bb36a973a9a4c5cd0e5727a799789a32c
+--- op.c.orig  2025-06-24 15:23:21.000000000 +0000
++++ op.c
+@@ -9665,7 +9665,7 @@ S_op_is_cv_xsub(pTHX_ OP *o, XSUBADDR_t 
+         }
+ 
+         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 
+ 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);
+ }
+ 
Index: pkgsrc/lang/perl5/patches/patch-t_op_for-many.t
diff -u /dev/null pkgsrc/lang/perl5/patches/patch-t_op_for-many.t:1.1
--- /dev/null   Fri Dec 12 08:11:40 2025
+++ pkgsrc/lang/perl5/patches/patch-t_op_for-many.t     Fri Dec 12 08:11:40 2025
@@ -0,0 +1,39 @@
+$NetBSD: patch-t_op_for-many.t,v 1.1 2025/12/12 08:11:40 wiz Exp $
+
+Fix a segfault when compiling a 2-var for loop over builtin::indexed.
+
+This is upstream git commit 96673a4bb36, with the following commit
+message:
+
+ 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.
+
+--- t/op/for-many.t.orig       2024-05-07 01:08:47.000000000 +0000
++++ t/op/for-many.t
+@@ -498,4 +498,17 @@ is($continue, 'xx', 'continue reached tw
+     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();



Home | Main Index | Thread Index | Old Index