This reverts commit 59ac24e243.
FPATH variable cannot be handled within autoinit process as this is not
an environment variable. Thus when modulecmd.tcl is executed, it does
not know the current value of FPATH. So if it sets FPATH during
autoinit, previous value of this variable is lost. As a result FPATH
must stay defined in initialization script.
According to ShellCheck's documentation:
When command expansions are unquoted, word splitting and globbing will occur.
This often manifests itself by breaking when filenames contain spaces.
Related: https://www.shellcheck.net/wiki/SC2046
Related: #470
Some variables, that were unquoted intentionally were converted to arrays.
According to ShellCheck's documentation:
Quoting variables prevents word splitting and glob expansion, and prevents
the script from breaking when input contains spaces, line feeds, glob
characters and such.
Related: https://www.shellcheck.net/wiki/SC2086
Related: #470
These occurrences do not seem to cause any problems described below but
let's still fix it for the sake of consistency within this script.
According to ShellCheck's documentation:
ShellCheck noticed that you have used a variable as an array, but then assign
it a string. array=foo is equivalent to array[0]=foo, and leaves the rest
of the elements unaffected.
Related: https://www.shellcheck.net/wiki/SC2178
Related: #470
According to ShellCheck's documentation:
-a and -o in [ .. ] test expressions are not well defined, and can cause
incorrect results when arguments start with dashes or contain !.
Related: https://www.shellcheck.net/wiki/SC2166
Related: #470
According to ShellCheck's documentation:
Bourne shells are very whitespace sensitive. Adding or removing spaces can
drastically alter the meaning of a script.
Related: https://www.shellcheck.net/wiki/SC1035
Related: #470
According to ShellCheck's documentation:
Different shells support different features. To give effective advice,
ShellCheck needs to know which shell your script is going to run on.
Related: https://www.shellcheck.net/wiki/SC2148
Related: #470
Use install command rather mkdir or cp to apply regular file mode when
installing Modules. A specific umask configuration set in the current
environment will not impact modes set on installed files.
Follow same approach than Makefiles generated by autotools, with an
INSTALL Makefile variable.
Update initialization, profile and completion scripts to enclose all
references to the installation paths.
Enclosing modulecmd.tcl installation path this way is not effective with
the quarantine mechanism that implies a double shell code evaluation. So
it is advised not to install Modules in a path containing a whitespace
character if the quarantine mechanism is needed.
Add zsh FPATH setup in autoinit command instead of zsh shell
initialization script. This way all the shell setup is gathered in the
autoinit process. What is left in initialization script is the code to
properly call the autoinit process.
Fixes#462.
Add shell completion setup in autoinit command instead of shell
initialization scripts. Use this way one modulecmd.tcl internal code
instead of shell code for every shell having some completion to source
(bash, tcsh, fish).
Fixes#462.
Add MANPATH setup in autoinit command instead of shell initialization
scripts. Use this way one modulecmd.tcl internal code instead of shell
code for every shell requiring to setup MANPATH with Modules binaries
location (sh, bash, ksh, zsh, csh, tcsh, fish).
Fixes#462.
Add PATH setup in autoinit command instead of shell initialization
scripts. Use this way one modulecmd.tcl internal code instead of shell
code for every shell requiring to setup PATH with Modules binaries
location (sh, bash, ksh, zsh, csh, tcsh, fish).
Fixes#462.
Export the module, _module_raw and ml bash shell functions directly
through the autoinit sub-command process rather within the bash shell
initialization script.
Cannot apply the same change to the sh shell when it is bash launched as
sh, since we cannot tell in the modulecmd.tcl execution that the current
sh shell is bash (as BASH environment variable is not exported to
sub-shells).
Fixes#462.
The Makefile script in the init directory does not depend on the
definitions stored in the version.inc file. So remove inclusion and
requirement definition to this version.inc file in init/Makefile.