* lib/compat.exp (compat-execute): Do not use regsub unsafely.

From-SVN: r99747
This commit is contained in:
Mark Mitchell 2005-05-15 22:31:35 +00:00 committed by Mark Mitchell
parent 3b523c85c1
commit 5595de0fa4
2 changed files with 15 additions and 2 deletions

View 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-15 Jerry DeLisle <jvdelisle@verizon.net>
PR fortran/17432

View File

@ -279,8 +279,17 @@ 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
regsub "^$tmpdir/?" $testcase "tmpdir-" 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]
}
if {[string first "$tmpdir/" "$src1"] == 0} {
set testcase [string range "$src1" [string length "$tmpdir/"] end]
}
regsub "_main.*" $testcase "" testcase
# Set up the base name of executable files so they'll be unique.
regsub -all "\[./\]" $testcase "-" execbase