Change 13145 by gsar@rake on 2001/11/21 00:14:29

        another compatibility tweak to change#12559: avoid quoting
        arguments that already have quotes; add test case

Affected files ...

.... //depot/maint-5.6/perl/t/op/system_tests#2 edit
.... //depot/maint-5.6/perl/win32/win32.c#30 edit

Differences ...

==== //depot/maint-5.6/perl/t/op/system_tests#2 (text) ====
Index: perl/t/op/system_tests
--- perl/t/op/system_tests.~1~  Tue Nov 20 17:30:06 2001
+++ perl/t/op/system_tests      Tue Nov 20 17:30:06 2001
@@ -1,5 +1,6 @@
 #!perl
 
+use Config;
 use Cwd;
 use strict;
 
@@ -80,6 +81,7 @@
   ["\ta b c ", " "],
   ["", "\ta b c ", "abc"],
   [" ", "\ta b c ", "abc"],
+  ['" "', 'a" "b" "c', "abc"],
 );
 
 print "1.." . (@commands * @av * 2) . "\n";
@@ -89,21 +91,29 @@
        my @cmds = defined($cmds) ? (ref($cmds) ? @$cmds : $cmds) : ();
        my @args = defined($args) ? (ref($args) ? @$args : $args) : ();
        print "######## [@cmds]\n";
-       print "<", join('><', $cmds[$#cmds], @args), ">\n";
+       print "<", join('><',
+                       $cmds[$#cmds],
+                       map { my $x = $_; $x =~ s/"//g; $x } @args),
+             ">\n";
        if (system(@cmds,@args) != 0) {
            print "Failed, status($?)\n";
-#          print "Running again in debug mode\n";
-#          $^D = 1; # -Dp
-#          system(@cmds,@args);
+           if ($Config{ccflags} =~ /\bDDEBUGGING\b/) {
+               print "Running again in debug mode\n";
+               $^D = 1; # -Dp
+               system(@cmds,@args);
+           }
        }
        $^D = 0;
-       my $cmdstr = join " ", map { /\s|^$/ ? qq["$_"] : $_ } @cmds, @args;
+       my $cmdstr = join " ", map { /\s|^$/ && !/\"/
+                                   ? qq["$_"] : $_ } @cmds, @args;
        print "######## '$cmdstr'\n";
        if (system($cmdstr) != 0) {
            print "Failed, status($?)\n";
-#          print "Running again in debug mode\n";
-#          $^D = 1; # -Dp
-#          system($cmdstr);
+           if ($Config{ccflags} =~ /\bDDEBUGGING\b/) {
+               print "Running again in debug mode\n";
+               $^D = 1; # -Dp
+               system($cmdstr);
+           }
        }
        $^D = 0;
     }

==== //depot/maint-5.6/perl/win32/win32.c#30 (text) ====
Index: perl/win32/win32.c
--- perl/win32/win32.c.~1~      Tue Nov 20 17:30:06 2001
+++ perl/win32/win32.c  Tue Nov 20 17:30:06 2001
@@ -3151,23 +3151,25 @@
            if (!curlen) {
                do_quote = 1;
            }
+           else if (quote_next) {
+               /* see if it really is multiple arguments pretending to
+                * be one and force a set of quotes around it */
+               if (*find_next_space(arg))
+                   do_quote = 1;
+           }
            else if (!(arg[0] == '"' && curlen > 1 && arg[curlen-1] == '"')) {
                STRLEN i = 0;
                while (i < curlen) {
                    if (isSPACE(arg[i])) {
                        do_quote = 1;
+                   }
+                   else if (arg[i] == '"') {
+                       do_quote = 0;
                        break;
                    }
                    i++;
                }
            }
-           else if (quote_next) {
-               /* ok, we know the argument already has quotes; see if it
-                * really is multiple arguments pretending to be one and
-                * force a set of quotes around it */
-               if (*find_next_space(arg))
-                   do_quote = 1;
-           }
        }
 
        if (do_quote)
@@ -3194,7 +3196,7 @@
                    extra_quotes = TRUE;
                }
                else {
-                   /* single argument, force quoting if unquoted */
+                   /* single argument, force quoting if it has spaces */
                    quote_next = TRUE;
                }
            }
End of Patch.

Reply via email to