Ensure environment variable change at the Tcl interpreter level is
propagated to every sub-interpreters used to evaluate modulefiles or
modulercs.
Tcl by default maintain the `::env` array in sync across all started
interpreters. But in some cases, it appears a change occuring in master
interpreter is not correctly propagated when the variable is later on
updated in sub-interpreter.
Fixes#342
Rework loop walking the symbolic version target to include all elements
recursively contained in directory targeted by symbolic version. Now
using dir_list structure to walk path rather querying the whole
found_list with modEq test procedure.
Enable resolution of default module in module sub-directory when this
default symbol targets an hidden directory (whose name starts with a dot
character).
Adapt getModules procedure to add reference, in the directory description
returned as result, for symbolic version targets that are hidden, not
included in returned result but excluded from search made.
Fixes#331
Introduce a memory cache for the results build up by getModules
procedure. Done in order to reuse these results if next searches are
identical, which happens in whatis/search context.
As a side effect a module resolution cannot be changed by the evaluation
of a modulefile sharing same root name, as the initial module resolution
to find this modulefile to evaluation has cached resolution result.
This side effect should not however impact more than the project
testsuite as module resolution should not be defined within a modulefile
but within modulerc files.
And make it a repository for additional test modulefiles that do not
need to take part in the global avail tests made over the main
repository (modulefiles) and who could mixed with others (like other and
other2).
Fix argument parsing for the `append-path`, `prepend-path` and
`remove-path` modulefile commands to consider every arguments found
after the variable name as variable values and not command option even
if argument starts with `-` character.
Fixes#278.
Trim any whitespace, newline or ';' characters at the beginning or end
of the function body passed to set-function modulefile command to
correctly define shell function whatever the writing style used.
system modulefile command is intended to the command passed to it trough
shell, like done on compatibility version.
So update system procedure to find correct shell on the current platform
and run command through it.
Doing so, shell commands with backticks for instance are correctly run.
Fixes#205
fixed linelength and tabs/spaces
adding set-function/unset-function documentation
adding tests for set-function/unset-function
fixed failing test for function modulefile additions
Correctly transmit the arguments along with the command to execute. Need
to use 'eval' for the underlying command to get its multiple args and
not one joined string.
Fixes#201
Magic cookie at the beginning of modulefiles may sometimes set a version
number, for instance '#Module1.0'. Until now this version number was
about a modulefile standard version. However there is no known
modulefile API versioning and new modulefile commands are added along
new Modules releases.
So the idea here is to match this version number optionally set on magic
cookie and compare it to the modulecmd.tcl release version. If
modulefile sets a version number greater than modulecmd.tcl version,
this modulefile is not evaluated like when no magic cookie is set at
all.
Add specific tests in 20-locate suite and adapt modulefile man page and
MIGRATING doc.
Fixes#171
When looking for the default version of a given modulefile, if this
default is set on an hidden modulefile, this hidden modulefile were not
found as the initial modulefile search were not looking for hidden
modulefiles.
When this situation is now spotted, modulefile search is started again
with inclusion of hidden files.
Add a test for this situation in 20-locate/067-hidden.
Fixes#177
When producing code to output shell alias definition, escaping of
special characters was missing until now in renderSettings procedure.
Code to bake shell alias has been fixed to work in a similar way than
for environment variable with full range of shell special characters
escaped.
Translation of $n/$* in !!:n/!* on csh-like shells is maintained for
compatibility with v3. To improve this compatibility, a \ prior to $
disables translation on csh (like with v3), then after \$ is translated
in $ for all shells.
Adapt testsuite to use value escaping over expected output result for
shell alias (like done for environment variable). Adapt consequently all
shell alias tests in 50-cmds/07*.
Add test in 50-cmds/076-alias-sub to demonstrate escaping of complex
shell alias. Use modulefile from this new test within install testsuite
to garanty shell alias produce is effective on shell sessions. Check
availability of tools used by this alias (grep, tr, awk) to determine if
install test can be launched on current system.
Fixes#165
'module' modulefile command targets module procedure on load and unload
modes of modulefile evaluation. reportCmd is targeted on display mode.
For other modes a nop is targeted.
'module' command is now disabled on help, test and whatis mode which
stabilizes evaluation on these modes. On Modules v3, module command was
also disabled on all these query evaluation modes.
When unsetting (clearing) an environment variable in 'unset-env'
procedure, keep track of it in a g_clearedEnvVars array to be able to
distinguish later on, in 'getenv' procedure, if variable is equal to an
empty string or if it has been unset (cleared).
Allow to define value to return if variable name passed to the getenv
procedure is undef.
Add a description of 'getenv' command in the modulefile man page.
Like previously done for 'remove-path', set the variable passed to
'unsetenv' procedure in ::env() array to make accurate value
available for later use during the modulefile evaluation.
Add 50-cmds/039-unsetenv-env test to check this ::env() array change
over all evaluation mode. Adapt 50-cmds/350-allin to check this change
against 'whatis' mode.
Like previously done for 'append-path', set the variable passed to
'remove-path' procedure in ::env() array to make accurate value
available for later use during the modulefile evaluation.
As a side effect as remove-path command is now evaluated on help, test,
display and whatis modes, invalid argument on this command will raise
error. Previously arguments were not parsed so no error raised.
Add 50-cmds/069-remove-env test to check this ::env() array change over
all evaluation mode. Adapt 50-cmds/350-allin to check this change
against 'whatis' mode.
Test load and unload mode on modulefiles where setenv and append-path
commands play on same variable. Check both ways: setenv then append-path
or appen-path then setenv.
Like previously done for 'setenv', set the variable passed to
'append-path' and 'prepend-path' procedures in ::env() array to make it
available for later use during the modulefile evaluation.
As a side effect as append-path/prepend-path commands are now evaluated
on help, test, display and whatis modes, invalid argument on these
commands will raise error. Previously arguments were not parsed so no
error raised.
Add 50-cmds/049-append-env and 50-cmds/059-prepend-env tests to check
this ::env() array change over all evaluation mode. Adapt
50-cmds/350-allin to check this change against 'whatis' mode.
Set the variable passed to 'setenv' procedure in ::env() array to make
it available for later use during the modulefile evaluation.
Add 50-cmds/029-setenv-env tests to check this ::env() array change over
all evaluation mode. Adapt 50-cmds/350-allin to check this change
against 'whatis' mode.
Fixes#160
To be able to 'puts' content on opened channels, the 'puts' command
should be executed from the modulefile interpreter context. Elsewhere,
master interpreter does not know about the channels opened in its
sub-interpreters.
Adapt interpreter setup to add a command renaming step, to avoid the
puts modulefile alias to overwrite the original puts command. puts
modulefile alias now also pass the caller interpreter reference as first
argument to be able to execute the original puts command, renamed _puts,
within context of this caller interpreter.
Handle wrong argument number error in putsModfileCmd to report an error
for 'puts' command rather '_puts' which should not be known by users.
Add non-regression test to check puts command against opened channel.
Fixes#157