develooper Front page | perl.perl5.changes | Postings from April 2008

Change 33732: Integrate:

From:
Nicholas Clark
Date:
April 22, 2008 13:00
Subject:
Change 33732: Integrate:
Change 33732 by nicholas@mouse-mill on 2008/04/22 19:53:49

	Integrate:
	[ 33668]
	Subject: [PATCH] Double magic with '\&$x'
	From: "Vincent Pit" <perl@profvince.com>
	Date: Tue, 1 Apr 2008 10:48:17 +0200 (CEST)
	Message-ID: <34395.147.210.17.175.1207039697.squirrel@147.210.17.175>
	
	[ 33669]
	Fix C portability nit found by Jerry D. Hedden.
	
	[ 33685]
	Revert change #26334, which was introducing too many bugs
	
	[ 33686]
	Add a regression test for bug #52658 (fixed by change #33685)
	based on code by Wolf-Dietrich Moeller

Affected files ...

... //depot/maint-5.10/perl/pp_ctl.c#9 integrate
... //depot/maint-5.10/perl/sv.c#10 integrate
... //depot/maint-5.10/perl/t/op/pat.t#6 integrate

Differences ...

==== //depot/maint-5.10/perl/pp_ctl.c#9 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#8~33599~	2008-03-29 08:41:22.000000000 -0700
+++ perl/pp_ctl.c	2008-04-22 12:53:49.000000000 -0700
@@ -218,7 +218,6 @@
 	if (!(cx->sb_rxtainted & 2) && SvTAINTED(TOPs))
 	    cx->sb_rxtainted |= 2;
 	sv_catsv(dstr, POPs);
-	FREETMPS; /* Prevent excess tmp stack */
 
 	/* Are we done */
 	if (CxONCE(cx) || !CALLREGEXEC(rx, s, cx->sb_strend, orig,

==== //depot/maint-5.10/perl/sv.c#10 (text) ====
Index: perl/sv.c
--- perl/sv.c#9~33614~	2008-03-31 09:59:07.000000000 -0700
+++ perl/sv.c	2008-04-22 12:53:49.000000000 -0700
@@ -7546,9 +7546,9 @@
 	goto fix_gv;
 
     default:
-	SvGETMAGIC(sv);
 	if (SvROK(sv)) {
 	    SV * const *sp = &sv;	/* Used in tryAMAGICunDEREF macro. */
+	    SvGETMAGIC(sv);
 	    tryAMAGICunDEREF(to_cv);
 
 	    sv = SvRV(sv);
@@ -7563,10 +7563,12 @@
 	    else
 		Perl_croak(aTHX_ "Not a subroutine reference");
 	}
-	else if (isGV(sv))
+	else if (isGV(sv)) {
+	    SvGETMAGIC(sv);
 	    gv = (GV*)sv;
+	}
 	else
-	    gv = gv_fetchsv(sv, lref, SVt_PVCV);
+	    gv = gv_fetchsv(sv, lref, SVt_PVCV); /* Calls get magic */
 	*gvp = gv;
 	if (!gv) {
 	    *st = NULL;

==== //depot/maint-5.10/perl/t/op/pat.t#6 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#5~33628~	2008-04-02 09:51:24.000000000 -0700
+++ perl/t/op/pat.t	2008-04-22 12:53:49.000000000 -0700
@@ -4543,6 +4543,14 @@
     iseq("@plus","bla blubb",'$+ inside of (?{}) works as expected');
 }
 
+# test for bug #52658
+{
+    my $reg = '../xxx/';
+    my @te = ($reg =~ m{^(/?(?:\.\./)*)}, $reg =~ s/(x)/'b'/eg > 1 ? '##' : '++');
+    #print "with bug:     (0)=$te[0]  (1)=$te[1]  reg=$reg\n";
+    iseq($reg, '../bbb/');
+    iseq($te[0], '../');
+}
 
 
 
@@ -4604,6 +4612,6 @@
 iseq(0+$::test,$::TestCount,"Got the right number of tests!");
 # Don't forget to update this!
 BEGIN {
-    $::TestCount = 4018;
+    $::TestCount = 4020;
     print "1..$::TestCount\n";
 }
End of Patch.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About