Change 30102 by [EMAIL PROTECTED] on 2007/02/02 22:11:03

        Integrate:
        [ 29616]
        Fix RT #6006: Regexp replaces using large replacement variables fail
        some of the time (i.e. when the substitution contains something
        like ${10}). Patch derived from a patch by Hugo van der Sanden;
        added also a second test (Yves Orton already added a TODO test
        for this.)
        
        [ 29617]
        A better fix for RT #6006: revert change 29616, which was bogus,
        and add OP_SCOPE to the list of "dangerous" ops that might appear
        on the right side of s///.
        However, this fix does not work under taint mode, and op/subst.t
        has -T.
        
        [ 29618]
        Remove -T from op/subst.t, and add a new test file, substT.t,
        to run the s/// tests under taint mode; mark the test for
        RT #6006 as TODO, but only with -T.
        
        [ 29619]
        Fix #6006 for taint mode too.

Affected files ...

... //depot/maint-5.8/perl/MANIFEST#302 integrate
... //depot/maint-5.8/perl/op.c#194 edit
... //depot/maint-5.8/perl/t/op/subst.t#13 integrate
... //depot/maint-5.8/perl/t/op/substT.t#1 branch

Differences ...

==== //depot/maint-5.8/perl/MANIFEST#302 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#301~30097~    2007-02-02 12:40:18.000000000 -0800
+++ perl/MANIFEST       2007-02-02 14:11:03.000000000 -0800
@@ -2869,6 +2869,7 @@
 t/op/subst_amp.t               See if $&-related substitution works
 t/op/substr.t                  See if substr works
 t/op/subst.t                   See if substitution works
+t/op/substT.t                  See if substitution works with -T
 t/op/subst_wamp.t              See if substitution works with $& present
 t/op/sub.t                     See if subroutines work
 t/op/sysio.t                   See if sysread and syswrite work

==== //depot/maint-5.8/perl/op.c#194 (text) ====
Index: perl/op.c
--- perl/op.c#193~30075~        2007-01-29 15:16:13.000000000 -0800
+++ perl/op.c   2007-02-02 14:11:03.000000000 -0800
@@ -2920,7 +2920,9 @@
        else {
            OP *lastop = NULL;
            for (curop = LINKLIST(repl); curop!=repl; curop = LINKLIST(curop)) {
-               if (PL_opargs[curop->op_type] & OA_DANGEROUS) {
+               if (curop->op_type == OP_SCOPE
+                       || curop->op_type == OP_LEAVE
+                       || (PL_opargs[curop->op_type] & OA_DANGEROUS)) {
 #ifdef USE_5005THREADS
                    if (curop->op_type == OP_THREADSV) {
                        repl_has_vars = 1;
@@ -2947,7 +2949,8 @@
                    else if (curop->op_type == OP_PADSV ||
                             curop->op_type == OP_PADAV ||
                             curop->op_type == OP_PADHV ||
-                            curop->op_type == OP_PADANY) {
+                            curop->op_type == OP_PADANY)
+                   {
                        repl_has_vars = 1;
                    }
                    else if (curop->op_type == OP_PUSHRE)

==== //depot/maint-5.8/perl/t/op/subst.t#13 (xtext) ====
Index: perl/t/op/subst.t
--- perl/t/op/subst.t#12~30100~ 2007-02-02 13:52:26.000000000 -0800
+++ perl/t/op/subst.t   2007-02-02 14:11:03.000000000 -0800
@@ -1,4 +1,4 @@
-#!./perl -wT
+#!./perl -w
 
 BEGIN {
     chdir 't' if -d 't';
@@ -7,7 +7,7 @@
 }
 
 require './test.pl';
-plan( tests => 134 );
+plan( tests => 135 );
 
 $x = 'foo';
 $_ = "x";
@@ -562,13 +562,14 @@
     ($c = "\x20\x00\x30\x01\x40\x1A\x50\x1F\x60") =~ s/[\x00-\x1f]//g;
     is($c, "\x20\x30\x40\x50\x60", "s/[\\x00-\\x1f]//g");
 }
-TODO:{
-    local $TODO = "RT#6006 needs resolution";
-    $TODO=$TODO;
+{
     $_ = "xy";
     no warnings 'uninitialized';
     /(((((((((x)))))))))(z)/;  # clear $10
     s/(((((((((x)))))))))(y)/${10}/;
     is($_,"y","RT#6006: \$_ eq '$_'");
+    $_ = "xr";
+    s/(((((((((x)))))))))(r)/fooba${10}/;
+    is($_,"foobar","RT#6006: \$_ eq '$_'");
 }
 

==== //depot/maint-5.8/perl/t/op/substT.t#1 (text) ====
Index: perl/t/op/substT.t
--- /dev/null   2007-01-16 11:55:45.526841103 -0800
+++ perl/t/op/substT.t  2007-02-02 14:11:03.000000000 -0800
@@ -0,0 +1,9 @@
+#!perl -wT
+
+for $file ('op/subst.t', 't/op/subst.t', ':op:subst.t') {
+  if (-r $file) {
+    do ($^O eq 'MacOS' ? $file : "./$file");
+    exit;
+  }
+}
+die "Cannot find op/subst.t or t/op/subst.t\n";
End of Patch.

Reply via email to