easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
148 stars 201 forks source link

EB gets confused if BASH_ENV defines Lmod and EASYBUILD_MODULE_TOOL=EnvironmentModulesC #947

Open rtmclay opened 10 years ago

boegel commented 10 years ago

to reproduce this:

$ export BASH_ENV=$HOME/lmod/5.6.2/init/bash
$ export EASYBUILD_MODULES_TOOL=EnvironmentModulesC
$ type module
module is a function
module () 
{ 
    eval `/Users/kehoste/.local/environment-modules/Modules/$MODULE_VERSION/bin/modulecmd bash $*`
}
$ python -m test.framework.modules
...
EasyBuildError: 'EasyBuild crashed with an error (at easybuild/tools/modules.py:247 in
check_module_function): pattern \'.*modulecmd\' (EnvironmentModulesC) not found in
defined \'module\' function.\nSpecify the correct modules tool to avoid weird problems
due to this mismatch, see the --modules-tool and --avail-modules-tools command line
options.\nOr alternatively, use --allow-modules-tool-mismatch to stop treating this as
an error. Obtained definition of \'module\' function: module is a function\nmodule () \n
{ \n    eval $($LMOD_CMD bash "$@");\n    [ $? = 0 ] && eval $(${LMOD_SETTARG_CMD:-:} -s
 sh)\n}\n'

This occurs because commands run by EasyBuild are being run in a subshell, as a bash script...

So, we should unset $BASH_ENV, probably in main.py? @pforai: would that suffice, or do we have to make sure it's undefined for every command we run (because it may get redefined?!)