modulefile - 模块卸载不会取消设置环境变量
我有一个非常简单的模块文件:
#%Module1.0#####################################################################
puts stderr "Loading personal environment"
proc ModulesHelp { } {
puts stderr "\tLoads personal environment"
puts stderr ""
}
setenv MYTEMPVAR sometext
这是我的命令行:
> env | grep MYTEMPVAR
> module load ~/wa/example_modulefile
Loading personal environment
> env | grep MYTEMPVAR
MYTEMPVAR=sometext
> module unload ~/wa/example_modulefile
> env | grep MYTEMPVAR
MYTEMPVAR=sometext
根据 modulefile 手册页 unload module 命令应该将所有 setenv 转换为 unsetenv,但它似乎不起作用。有谁知道我在这里可能做错了什么?
更多信息:
> module --version
VERSION=3.2.6
DATE=2007-02-14
AUTOLOADPATH=undef
BASEPREFIX="/usr/share"
BEGINENV=99
CACHE_AVAIL=undef
DEF_COLLATE_BY_NUMBER=undef
DOT_EXT=""
EVAL_ALIAS=1
HAS_BOURNE_FUNCS=1
HAS_BOURNE_ALIAS=1
HAS_TCLXLIBS=undef
HAS_X11LIBS=1
LMSPLIT_SIZE=undef
MODULEPATH="/company/tech/tools/modules/sites/$SITE/Linux/:/company/tech/tools/modules/projects"
MODULES_INIT_DIR="/usr/share/Modules/init"
PREFIX="/usr/share/Modules"
TCL_VERSION="8.4"
TCL_PATCH_LEVEL="8.4.19"
TMP_DIR="/tmp"
USE_FREE=undef
VERSION_MAGIC=1
VERSIONPATH=undef
WANTS_VERSIONING=0
WITH_DEBUG_INFO=undef
Hello World
> env | grep SHELL
SHELL=/bin/tcsh
对于那些不熟悉模块文件的人(它们似乎不太流行):
- 模块文件是一段简单的代码,用于设置或添加条目到 PATH、MANPATH 或其他环境变量
- 模块文件隐藏了不同类型 shell 的概念
- 模块文件以工具命令语言 Tcl 编写,并由 modulecmd 程序通过模块用户界面进行解释
I have a very simple modulefile:
#%Module1.0#####################################################################
puts stderr "Loading personal environment"
proc ModulesHelp { } {
puts stderr "\tLoads personal environment"
puts stderr ""
}
setenv MYTEMPVAR sometext
And here is my command line:
> env | grep MYTEMPVAR
> module load ~/wa/example_modulefile
Loading personal environment
> env | grep MYTEMPVAR
MYTEMPVAR=sometext
> module unload ~/wa/example_modulefile
> env | grep MYTEMPVAR
MYTEMPVAR=sometext
According to the modulefile man page unload module command was supposed to turn all setenv's to unsetenv but it doesn't seem to be working. Does anyone know what I might be doing wrong here?
More information:
> module --version
VERSION=3.2.6
DATE=2007-02-14
AUTOLOADPATH=undef
BASEPREFIX="/usr/share"
BEGINENV=99
CACHE_AVAIL=undef
DEF_COLLATE_BY_NUMBER=undef
DOT_EXT=""
EVAL_ALIAS=1
HAS_BOURNE_FUNCS=1
HAS_BOURNE_ALIAS=1
HAS_TCLXLIBS=undef
HAS_X11LIBS=1
LMSPLIT_SIZE=undef
MODULEPATH="/company/tech/tools/modules/sites/$SITE/Linux/:/company/tech/tools/modules/projects"
MODULES_INIT_DIR="/usr/share/Modules/init"
PREFIX="/usr/share/Modules"
TCL_VERSION="8.4"
TCL_PATCH_LEVEL="8.4.19"
TMP_DIR="/tmp"
USE_FREE=undef
VERSION_MAGIC=1
VERSIONPATH=undef
WANTS_VERSIONING=0
WITH_DEBUG_INFO=undef
Hello World
> env | grep SHELL
SHELL=/bin/tcsh
For those unfamiliar with modulefiles (they do not seem to be that popular):
- modulefile is a simple bit of code that set or add entries to the PATH, MANPATH, or other environment variables
- modulefiles hide the notion of different types of shells
- modulefiles are written in the Tool Command Language, Tcl and are interpreted by the modulecmd program via the module user interface
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
较新版本的模块 (>= 4.0) 可以正确卸载此完整路径模块文件。
对于旧版本,
module unload
命令无法将命令行上传递的完整路径模块文件与当前加载的模块正确匹配。结果,没有模块被卸载。旧版本(< 4.0)上的可重现问题:
正如邪恶奥托所说,在旧模块版本上,必须使用短模块名称来卸载此模块文件
在最新模块版本上获得的预期行为:
Newer versions of Modules (>= 4.0) correctly unload this full path modulefile.
With older versions, the
module unload
command does not correctly match the full path modulefile passed on the command line with the currently loaded module. As a result no module is unloaded.Reproductible issue on older version (< 4.0):
As evil otto said, on older module version, short module name has to be used to unload this modulefile
Expected behavior obtained on recent module version:
这显然按预期工作: http://sourceforge.net/tracker/?func=detail&aid=2384340&group_id=15538&atid=115538
看来您应该运行
module unload example_modulefile< /code> 而不给出模块文件的完整路径。
This is apparently working as intended: http://sourceforge.net/tracker/?func=detail&aid=2384340&group_id=15538&atid=115538
It seems you are expected to run
module unload example_modulefile
without giving it the full path to the module file.