From 9b463ec9afe39c26bfeb18d15860a63df5a4fdae Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Wed, 3 Aug 2022 17:18:36 +0200 Subject: [PATCH] Unset mod spec on source subcmd if file exists In case module specification corresponds to a full path name file, unset parsed module specification on source sub-command. It is done not to confuse specific character in file path name (like '+') with module variant specification. --- tcl/modspec.tcl | 6 ++++++ tcl/subcmd.tcl.in | 3 +++ 2 files changed, 9 insertions(+) diff --git a/tcl/modspec.tcl b/tcl/modspec.tcl index d8efe08d..f02f8805 100644 --- a/tcl/modspec.tcl +++ b/tcl/modspec.tcl @@ -1490,6 +1490,12 @@ proc getModuleVersSpec {modarg} { } } +proc unsetModuleVersSpec {modarg} { + if {[info exists ::g_moduleVersSpec($modarg)]} { + unset ::g_moduleVersSpec($modarg) + } +} + # get module name from module name and version spec if parsed proc getModuleNameFromVersSpec {modarg} { if {[info exists ::g_moduleVersSpec($modarg)]} { diff --git a/tcl/subcmd.tcl.in b/tcl/subcmd.tcl.in index cf34fd53..1f0d9843 100644 --- a/tcl/subcmd.tcl.in +++ b/tcl/subcmd.tcl.in @@ -814,6 +814,9 @@ proc cmdModuleSource {mode args} { set modfile $absfpath set modname $absfpath set modnamevr $absfpath + # unset module specification not to confuse specific char in file + # path (like '+') with variant specification + unsetModuleVersSpec $mod set mod $absfpath # if not a path specification, try to resolve a modulefile } elseif {![isModuleFullPath $rawarg]} {