Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echo command fails during module installation #51

Open
jasperalbers opened this issue Feb 2, 2022 · 4 comments
Open

Echo command fails during module installation #51

jasperalbers opened this issue Feb 2, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@jasperalbers
Copy link
Collaborator

Issue

In build_functions.sh, in the function module_install, executing line 251

echo -e "${module@P}" >"${module_path}"

raises the following error for me on JURECA-DC:

mkdir: created directory '<my/module/path>/modules/nest-simulator/3.2'
<my/Builder/path>/build_functions.sh: line 251: INSTALLDIR: unbound variable

Workaround:

Skipping the if-case by deleting lines 250 – 253, removing one level of indent from lines 254 – 280, deleting line 281.

@jasperalbers jasperalbers added the bug Something isn't working label Feb 2, 2022
@terhorstd
Copy link
Collaborator

the problem is likely in 3.2/<variant>.module, could you provide the diff to an existing and working <variant>.module?

@jasperalbers
Copy link
Collaborator Author

Compared to the 3.0 planfile on master, only the bottom part concerning the nest.vars content is different.
Old:

# NEST is installed here. When you relocate NEST, change this variable.
setenv          NEST_INSTALL_DIR        \$INSTALLDIR

# NEST finds standard *.sli files \$NEST_DATA_DIR/sli
setenv          NEST_DATA_DIR           \$INSTALLDIR/share/nest

# NEST finds help files \$NEST_DOC_DIR/help
setenv          NEST_DOC_DIR            \$INSTALLDIR/share/doc/nest

# The path where NEST looks for user modules.
setenv          NEST_MODULE_PATH        \$INSTALLDIR/lib64/nest

# The path where the PyNEST bindings are installed.
setenv          NEST_PYTHON_PREFIX      \$INSTALLDIR

prepend-path    PYTHONPATH              \$INSTALLDIR
prepend-path    PATH                    \$INSTALLDIR/bin
#prepend-path    LD_LIBRARY_PATH  \$INSTALLDIR/lib64
#prepend-path    MANPATH \$INSTALLDIR/man

New:

prepend-path    PYTHONPATH              $INSTALLDIR/lib64/python3.8/site-packages
prepend-path    PATH                    $INSTALLDIR/bin

@terhorstd
Copy link
Collaborator

Yes, this explains it. There are no \, so builder tries to resolve the variable, instead of the module command. The latter has the variable defined in

set INSTALLDIR ${TARGET}
Builder, however, does not know about that and bails out. The fix would be to somehow produce a more understandable error message pointing to the problematic file. Note also that currently there are two paths substituting Builder variables in module files, separated by the
if version_gt $BASH_VERSION 4.4; then

The sed case only replaces specific variables, but is horrible to maintain. The ${module@P} is a feature of more recent shells, using all defined environment variables for replacement. (Thus trying to interpret the unescaped $INSTALLDIR)

@terhorstd terhorstd added good first issue Good for newcomers and removed bug Something isn't working labels Feb 11, 2022
@terhorstd
Copy link
Collaborator

I've removed the 'bug' label, since the bug is in the provided module file (not in the repository). Improving the error message would be a very useful contribution, however, and is a nicely separated issue to learn much about shell error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants