You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Having an empty line at then end of a Lua multi-line variable used in set_shell_function() results in a syntax error while loading the module:
$ ml test/01
bash: syntax error near unexpected token `;'
Workaround: removing the empty line after echo foo in the multi-line Lua variable doesn't generate the syntax error message. Escaping the last line works as well:
local _func = [==[
echo foo \
]==]
doesn't generate the shell syntax error when loading the module.
Expected behavior
No syntax error when loading the module.
Desktop (please complete the following information):
OS: Linux
Linux distribution: CentOS
Lmod Version: 8.7.55
For Lmod Versions 8.7.7+, please run "module --miniConfig" and
include the output here.
$ module --miniConfig
Modules based on Lua: Version 8.7.55 [branch: (detached from 8.7.55)] 2025-02-10 15:54 -08:00
by Robert McLay [email protected]
Lmod Version: 8.7.55
Lua Version: 5.1
MODULEPATH: /share/software/modules/staging:/share/software/modules/math:/share/software/modules/devel:/share/software/modules/categories
Changes from Default Configuration
----------------------------------
Name Where Set Default Value
---- --------- ------- -----
LFS_VERSION D 1.6.3 1.8.0
LMOD_ADMIN_FILE E /share/software/user/open/lmod/etc/admin.list /share/software/modules/admin.list
LMOD_AVAIL_STYLE E <system> categories
LMOD_BRANCH D main (detached from 8.7.55)
LMOD_FAST_TCL_INTERP C yes no
LMOD_MODULERC E /share/software/user/open/lmod/etc/rc /share/software/modules/.modulerc.lua
LMOD_PACKAGE_PATH D nil /share/software/modules/
LMOD_PAGER C less /bin/less
LMOD_RC E /share/software/modules/lmodrc.lua
LMOD_REDIRECT E no yes
LMOD_SITEPACKAGE_LOCATION Other /share/software/user/open/lmod/8.7.55/libexec/SitePackage.lua /share/software/modules/SitePackage.lua
LMOD_SITE_NAME C false sherlock
LMOD_SYSHOST E false sherlock
LMOD_SYSTEM_DEFAULT_MODULES E __unknown__ devel,math
LMOD_TCLSH C tclsh /bin/tclsh
LMOD_USING_FAST_TCL_INTERP Other yes no
MODULEPATH_ROOT E /share/software/modules
PATH_TO_LUA C lua /bin/lua
Where Set -> D: default, E: environment, C: configuration
lmod_cfg: lmod_config.lua SitePkg: SitePackage StdPkg: StandardPackage
Other: Set somewhere outside of normal locations
The text was updated successfully, but these errors were encountered:
I was able to reproduce the issue and devised a solution. The only thing I can do is remove blank lines from the function definition. Anything else is crazy. For example having a module like:
local _func = [==[
STR="
foo
bar
"
echo $STR \
]==]
set_shell_function("foo", _func)
will affect the string definition if I try to add "" to the end of each line.
Please try branch IS748-shFunc to see if it works for you. Thanks very much for the bug report!
Describe the bug
Having an empty line at then end of a Lua multi-line variable used in
set_shell_function()
results in a syntax error while loading the module:To Reproduce
Steps to reproduce the behavior:
Workaround: removing the empty line after
echo foo
in the multi-line Lua variable doesn't generate the syntax error message. Escaping the last line works as well:doesn't generate the shell syntax error when loading the module.
Expected behavior
No syntax error when loading the module.
Desktop (please complete the following information):
include the output here.
The text was updated successfully, but these errors were encountered: