diff --git a/CHANGELOG.md b/CHANGELOG.md index 00f32d8..3395bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## Version 2.0.4 ### modulecmd +* When loading multiple modules, `LD_LIBRARY_PATH` may not have + been set correctly. + (#1354) ### build system diff --git a/Pmodules/libstd.bash b/Pmodules/libstd.bash index 2d75dfc..6f04171 100644 --- a/Pmodules/libstd.bash +++ b/Pmodules/libstd.bash @@ -39,6 +39,18 @@ std::def_cmd(){ which "$1" 2>/dev/null || std::die 255 "'$1' not found!" } +std::def_cmd1(){ + local -- name="$1" + local -- bin='' + bin=$(which $1) || std::die 255 "'${name}' not found!" + + eval "${name}(){ + LD_PRELOAD= ${bin} \"\$@\" + } + declare -g ${name}=${name} + readonly -f ${name}" +} + std::def_cmd2(){ local -- name="$1" local -- bin='' @@ -223,7 +235,7 @@ std::def_cmd2 'make' std::def_cmd2 'md5sum' std::def_cmd2 'mkdir' std::def_cmd2 'mktemp' -std::def_cmd2 'modulecmd' +std::def_cmd1 'modulecmd' std::def_cmd2 'patch' std::def_cmd2 'pwd' std::def_cmd2 'readlink'