]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* lib/compat.exp (compat-execute): Do not use regsub unsafely.
authorMark Mitchell <mark@codesourcery.com>
Sun, 15 May 2005 22:56:59 +0000 (22:56 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 15 May 2005 22:56:59 +0000 (22:56 +0000)
From-SVN: r99752

gcc/testsuite/ChangeLog
gcc/testsuite/lib/compat.exp

index 50d8ba796d9b411a909d949a68180385539eedbe..b59b39a4105354e00fe7c1a3adb9f58381817c7c 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * lib/compat.exp (compat-execute): Do not use regsub unsafely.
+
 2005-05-11  Ben Elliston  <bje@au.ibm.com>
 
        * gcc.dg/debug/pr16676.c: Remove for now.
index 0a7cfec0b0ead946d5824c421f230abb1d19cae2..95852da2363bfd5281c5103ca8f6ec6221ba2f33 100644 (file)
@@ -233,7 +233,14 @@ proc compat-execute { src1 sid use_alt } {
     regsub "sid" "sid_y_alt.o" $sid obj3_alt
 
     # Get the base name of this test, for use in messages.
-    regsub "^$srcdir/?" $src1 "" testcase
+    set testcase "$src1"
+    # Remove the $srcdir and $tmpdir prefixes from $src1.  (It would
+    # be possible to use "regsub" here, if we were careful to escape
+    # all regular expression characters in $srcdir and $tmpdir, but
+    # that would be more complicated that this approach.) 
+    if {[string first "$srcdir/" "$src1"] == 0} {
+       set testcase [string range "$src1" [string length "$srcdir/"] end]
+    }
     regsub "_main.*" $testcase "" testcase
     # Set up the base name of executable files so they'll be unique.
     regsub -all "\[./\]" $testcase "-" execbase