In search_and_load_file in once place 'file join' is used to
concatenate a directory and a filename, while elsewhere in the
function the concatenate is hard coded as a string "$dir/$initfile",
assuming that '/' is used to join components.

Presumably this is fine for all the targets dejagnu supports, but its
probably better to stick to one approach or the other.

This patch makes use of 'file join' for building paths.

ChangeLog:

        * runtest.exp (search_and_load_file): Join the directory and
        filename once using 'file join'.
---
 ChangeLog   |  5 +++++
 runtest.exp | 13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/runtest.exp b/runtest.exp
index bea8f29..c4dd207 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -328,18 +328,19 @@ proc search_and_load_file { type filelist dirlist } {
 
     foreach dir $dirlist {
        foreach initfile $filelist {
-           verbose "Looking for $type $dir/$initfile" 2
-           if {[file exists [file join $dir $initfile]]} {
+           set filename [file join $dir $initfile]
+           verbose "Looking for $type $filename" 2
+           if {[file exists $filename]} {
                set found 1
                set error ""
                if { $type ne "library file" } {
-                   send_user "Using $dir/$initfile as $type.\n"
+                   send_user "Using $filename as $type.\n"
                } else {
-                   verbose "Loading $dir/$initfile"
+                   verbose "Loading $filename"
                }
-               if {[catch "uplevel #0 source $dir/$initfile" error] == 1} {
+               if {[catch "uplevel #0 source $filename" error] == 1} {
                    global errorInfo
-                   send_error "ERROR: tcl error sourcing $type 
$dir/$initfile.\n$error\n"
+                   send_error "ERROR: tcl error sourcing $type 
$filename.\n$error\n"
                    if {[info exists errorInfo]} {
                        send_error "$errorInfo\n"
                    }
-- 
2.14.5


_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
https://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to