Skip to content

Commit

Permalink
Unset mod spec on source subcmd if file exists
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xdelaruelle committed Aug 3, 2022
1 parent 77d604b commit 9b463ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tcl/modspec.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]} {
Expand Down
3 changes: 3 additions & 0 deletions tcl/subcmd.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -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]} {
Expand Down

0 comments on commit 9b463ec

Please sign in to comment.