[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000121.005] System command starting with environment[PATCH for tests]



At 22:58 +0100 2000-01-23, Dominic Dunlop wrote:
>--- perl5.005_03/doio.c-as_received	Sat Mar 27 17:57:24 1999
>+++ perl5.005_03/doio.c	Sat Jan 22 18:10:15 2000
>@@ -1069,7 +1069,7 @@ do_exec(char *cmd)
>      if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4]))
>  	goto doshell;
>
>-    for (s = cmd; *s && isALPHA(*s); s++) ;	/* catch VAR=val gizmo */
>+    for (s = cmd; *s && isALNUM(*s); s++) ;	/* catch VAR=val gizmo */
>      if (*s == '=')
>  	goto doshell;

Here's the corresponding test.  Again, against 5.005_03, but also 
applies against 5.005_63 with an offset of 9 lines.

--- perl5.005_03/t/op/exec.t-as_received	Fri Aug  7 01:02:14 1998
+++ perl5.005_03/t/op/exec.t	Mon Jan 24 10:08:32 2000
@@ -11,7 +11,7 @@
      exit(0);
  }

-print "1..8\n";
+print "1..10\n";

  if ($^O ne 'os2') {
    print "not ok 1\n" if system "echo ok \\1";	# shell interpreted
@@ -32,4 +32,11 @@

  unless (exec "lskdjfalksdjfdjfkls") {print "ok 7\n";} else {print 
"not ok 7\n";}

-exec "echo","ok","8";
+# make sure shell is used if shell variable assignment seen
+print "not ok 8\n" if system "s_1=bfzky echo ok 8";
+
+# apparent assignment after command name should not pull in shell
+# (test assumes there's no executable called "set" around)
+print "not " unless system "set s_1=bfzky"; print "ok 9\n";
+
+exec "echo","ok","10";

-- 
Dominic Dunlop


References to:
Ilya Zakharevich <ilya@math.ohio-state.edu>
Dominic Dunlop <domo@computer.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]