mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-27 01:53:08 +02:00
Merge pull request #1346 from Pmodules/1343-call-module-with-absolute-paths-is-broken
modulecmd: bugfix for absolute modulefile path names
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
## Version 2.0.3
|
||||
|
||||
### modulecmd
|
||||
* It was not possible to load a module with it's absolute path.
|
||||
(#1343)
|
||||
* Bugfix in unloading modules. Under certain conditions unloading a module
|
||||
failed due to a wrong check in the test whether a module is loaded or not.
|
||||
(#1340)
|
||||
|
||||
+26
-13
@@ -1398,19 +1398,32 @@ find_modulefile(){
|
||||
|
||||
local -a modulepath=()
|
||||
IFS=':' read -r -a modulepath <<<"${MODULEPATH}"
|
||||
local -a mods=()
|
||||
local -- relstages="${UsedReleaseStages}"
|
||||
[[ "${modulename}" = */* ]] && relstages="${ReleaseStages}"
|
||||
get_available_modules \
|
||||
'load' \
|
||||
mods \
|
||||
"${modulename}" \
|
||||
"${relstages}" \
|
||||
"${modulepath[@]}"
|
||||
(( ${#mods[@]} == 0 )) && return 1
|
||||
ref_relstage="${mods[1]}"
|
||||
ref_moduledir="${mods[2]}"
|
||||
ref_modulefile="${mods[2]}/${mods[3]}"
|
||||
if [[ "${m:0:1}" = '/' || -r "${m}" ]]; then
|
||||
# handle absolut or relative module names
|
||||
local -- absname=$(std::get_abspath "${m}")
|
||||
local -- ol_name=''
|
||||
local -- group=''
|
||||
find_overlay ol_name group "${absname}"
|
||||
[[ "${ol_name}" != 'none' ]] && \
|
||||
die_ol_absname_not_allowed "${m}"
|
||||
ref_modulefile="${absname}"
|
||||
ref_relstage='stable'
|
||||
ref_moduledir="${absname%/*}"
|
||||
else
|
||||
local -a mods=()
|
||||
local -- relstages="${UsedReleaseStages}"
|
||||
[[ "${modulename}" = */* ]] && relstages="${ReleaseStages}"
|
||||
get_available_modules \
|
||||
'load' \
|
||||
mods \
|
||||
"${modulename}" \
|
||||
"${relstages}" \
|
||||
"${modulepath[@]}"
|
||||
(( ${#mods[@]} == 0 )) && return 1
|
||||
ref_relstage="${mods[1]}"
|
||||
ref_moduledir="${mods[2]}"
|
||||
ref_modulefile="${mods[2]}/${mods[3]}"
|
||||
fi
|
||||
is_modulefile ref_interp "${ref_modulefile}" || \
|
||||
die_module_not_a_modulefile "${modulename}"
|
||||
if [[ "${modulecmd}" == "Lmod_cmd" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user