From: Mark Mitchell Date: Sun, 15 May 2005 22:56:59 +0000 (+0000) Subject: * lib/compat.exp (compat-execute): Do not use regsub unsafely. X-Git-Tag: releases/gcc-3.4.4~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47cfee270b9146dc53072837d5887e89bae67d2a;p=thirdparty%2Fgcc.git * lib/compat.exp (compat-execute): Do not use regsub unsafely. From-SVN: r99752 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50d8ba796d9b..b59b39a41053 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-05-15 Mark Mitchell + + * lib/compat.exp (compat-execute): Do not use regsub unsafely. + 2005-05-11 Ben Elliston * gcc.dg/debug/pr16676.c: Remove for now. diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp index 0a7cfec0b0ea..95852da2363b 100644 --- a/gcc/testsuite/lib/compat.exp +++ b/gcc/testsuite/lib/compat.exp @@ -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