From 1f0dd90da64a1f35f24f0777c64d0beb3aaaa0f1 Mon Sep 17 00:00:00 2001 From: Roy Storey Date: Thu, 14 May 2020 22:36:24 +1200 Subject: [PATCH] Use absolute path to load tcl_ext_lib Fixes #344 --- modulecmd.tcl.in | 2 +- testsuite/modules.00-init/150-access-init.exp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in index 8f0e0b480..2c069a2bf 100644 --- a/modulecmd.tcl.in +++ b/modulecmd.tcl.in @@ -11085,7 +11085,7 @@ if {[catch { # Load extension library if enabled @libtclenvmodules@if {[file readable [getConf tcl_ext_lib]]} { @libtclenvmodules@ reportDebug "Load Tcl extension library ([getConf tcl_ext_lib])" - @libtclenvmodules@ load [getConf tcl_ext_lib] Envmodules + @libtclenvmodules@ load [file normalize [getConf tcl_ext_lib]] Envmodules @libtclenvmodules@ set g_tclextlib_loaded 1 @libtclenvmodules@} # use fallback procs if extension library is not loaded diff --git a/testsuite/modules.00-init/150-access-init.exp b/testsuite/modules.00-init/150-access-init.exp index cf1901b7d..d37a21109 100644 --- a/testsuite/modules.00-init/150-access-init.exp +++ b/testsuite/modules.00-init/150-access-init.exp @@ -54,15 +54,17 @@ if {[info exists tclextlib_file]} { # replace Tcl extension library by a non lib file file rename $tclextlib_file $tclextlib_file.orig file copy lib/envmodules.c $tclextlib_file + set tclextlib_file_abs_re [regsub -all "\(\[.+?\]\)" [file normalize $tclextlib_file] {\\\1}] if {$tcl_platform(os) eq {Darwin}} { - set tserr "$error_msgs: dlopen\\\($tclextlib_file,.*" + set tserr "$error_msgs: dlopen\\\($tclextlib_file_abs_re,.*" } else { - set tserr "$error_msgs: couldn't load file \"$tclextlib_file\":.*" + set tserr "$error_msgs: couldn't load file \"$tclextlib_file_abs_re\":.*" } testouterr_cmd_re sh {-V} {} $tserr file delete $tclextlib_file file rename $tclextlib_file.orig $tclextlib_file unset tserr + unset tclextlib_file_abs_re } # restrict read access to site-specific configuration script