Hi,
I hope it's OK to post this here...
I have an issue with "module display <modulename>" and use of "[getenv <environment>]" with shell script sourcing in the module (Modules version 4.7.1).
Consider the following test module "display-test" :
#%Module1.0
#
# Display test
setenv CADROOT "/home/sdeacon"
switch -- [module-info shelltype] {
sh {
puts stderr "Source echo.sh"
source-sh bash $env(CADROOT)/echo.sh
}
csh {
puts stderr "Source echo.csh"
source-sh tcsh $env(CADROOT)/echo.csh
}
default {}
}
Where "echo.sh" and "echo.csh" are simple bash and csh scripts for test purposes - they just echo "hello"...
If I do "module display display-test" in a csh/tcsh, the output is as expected :
-------------------------------------------------------------------
/home/sdeacon/modules/display-test:
setenv CADROOT /home/sdeacon
Source echo.csh
-------------------------------------------------------------------
However, if I modify the module in the following way :
#%Module1.0
#
# Display test
setenv CADROOT "/home/sdeacon"
switch -- [module-info shelltype] {
sh {
puts stderr "Source echo.sh"
source-sh bash [getenv CADROOT]/echo.sh
}
csh {
puts stderr "Source echo.csh"
source-sh tcsh [getenv CADROOT]/echo.csh
}
default {}
}
I get the following issue with 'module display' :
-------------------------------------------------------------------
/home/sdeacon/modules/display-test:
setenv CADROOT /home/sdeacon
Source echo.csh
Module ERROR: Script '$CADROOT/echo.csh' cannot be found
while executing
"source-sh tcsh [getenv CADROOT]/echo.csh"
("csh" arm line 3)
invoked from within
"switch -- [module-info shelltype] {
sh {
puts stderr "Source echo.sh"
source-sh bash [getenv CADROOT]/echo.sh
}
csh {
..."
(file "/home/sdeacon/modules/display-test" line 5)
Please contact <root@localhost>
-------------------------------------------------------------------
Additionally, I also get the same kind of error if I do the following :
#%Module1.0
#
# Display test
setenv CADROOT "/home/sdeacon"
setenv SCRIPT_HOME [getenv CADROOT]
switch -- [module-info shelltype] {
sh {
puts stderr "Source echo.sh"
source-sh bash $env(SCRIPT_HOME)/echo.sh
}
csh {
puts stderr "Source echo.csh"
source-sh tcsh $env(SCRIPT_HOME)/echo.csh
}
default {}
}
Result of "module display" :
-------------------------------------------------------------------
/home/sdeacon/modules/display-test:
setenv CADROOT /home/sdeacon
setenv SCRIPT_HOME $CADROOT
Source echo.csh
Module ERROR: Script '$CADROOT/echo.csh' cannot be found
while executing
"source-sh tcsh $env(SCRIPT_HOME)/echo.csh"
("csh" arm line 3)
invoked from within
"switch -- [module-info shelltype] {
sh {
puts stderr "Source echo.sh"
source-sh bash $env(SCRIPT_HOME)/echo.sh
}
csh {
..."
(file "/home/sdeacon/modules/display-test" line 6)
Please contact <root@localhost>
-------------------------------------------------------------------
Am I doing something wrong ?
Best regards,
Shaun
--
Shaun Deacon
Senior Staff Software Engineer
Socionext America, Inc.
phone: ++1 408 212 7410
--
|