Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use file normalise and load library using absolute path #345

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modulecmd.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions testsuite/modules.00-init/150-access-init.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down