Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
tcl85-2:
runs-on: ubuntu-22.04
env:
CONFIGURE_OPTS: --with-tclsh=tclsh8.5 --prefix=/tmp/modules --with-tcl=/usr/local/lib --enable-quarantine-support --enable-silent-shell-debug-support --enable-modulespath --with-pager=more --with-dark-background-colors=hi --with-locked-configs=implicit_default --enable-wa-277 --enable-advanced-version-spec --disable-ml --disable-implicit-requirement --enable-set-shell-startup
CONFIGURE_OPTS: --with-tclsh=tclsh8.5 --prefix=/tmp/modules --with-tcl=/usr/local/lib --enable-quarantine-support --enable-silent-shell-debug-support --enable-modulespath --with-pager=more --with-dark-background-colors=hi --with-locked-configs=implicit_default --enable-wa-277 --enable-advanced-version-spec --disable-ml --disable-implicit-requirement --enable-set-shell-startup --enable-path-entry-reorder
COVERAGE: y
EXTRA_SCRIPT_PRETEST: make install-testinitrc-1 install-testetcrc install-testmodspath
EXTRA_SCRIPT_POSTTEST: make uninstall-testconfig
Expand Down
2 changes: 2 additions & 0 deletions .hunspell.en.dic
Original file line number Diff line number Diff line change
Expand Up @@ -1324,3 +1324,5 @@ structs
reimplementation
gid
cmp
Achim
Gsell
16 changes: 16 additions & 0 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,19 @@ instance :instopt:`--disable-set-manpath<--enable-set-manpath>`):
.. versionchanged:: 5.6
Enables automated *require via* mechanism

.. instopt:: --enable-path-entry-reorder

Change order of entry in a path-like environment variable, when
:mfcmd:`prepend-path`, :mfcmd:`append-path` or :subcmd:`use` target a path
entry that is already defined in the environment variable. (default=no)

This installation option defines the default value of the
:mconfig:`path_entry_reorder` configuration option which could be changed
after installation with the :subcmd:`config` sub-command.

.. only:: html or latex

.. versionadded:: 5.7

.. instopt:: --enable-quarantine-support

Expand Down Expand Up @@ -1723,6 +1736,9 @@ installation.
| | | :envvar:`MODULES_PAGER`, | | |
| | | :option:`--paginate`, :option:`--no-pager` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`path_entry_reorder` | ``0`` | :instopt:`--enable-path-entry-reorder`, | | |
| | | :envvar:`MODULES_PATH_ENTRY_REORDER` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`protected_envvars` | *Unset by default* | :envvar:`MODULES_PROTECTED_ENVVARS` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`quarantine_support` | ``0`` | :instopt:`--enable-quarantine-support`, | X | |
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ else
setwa277 := 0
endif

ifeq ($(pathentryreorder),y)
setpathentryreorder := 1
else
setpathentryreorder := 0
endif

ifneq ($(tcllinteropts),)
tcllintercmd := $(tcllinter) $(tcllinteropts)
else
Expand Down Expand Up @@ -442,6 +448,7 @@ sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@sourcecache@|$(setsourcecache)|g' \
-e 's|@searchmatch@|$(searchmatch)|g' \
-e 's|@wa277@|$(setwa277)|g' \
-e 's|@pathentryreorder@|$(setpathentryreorder)|g' \
-e 's|@icase@|$(icase)|g' \
-e 's|@nearlyforbiddendays@|$(nearlyforbiddendays)|g' \
-e 's|@tagabbrev@|$(tagabbrev)|g' \
Expand Down
3 changes: 3 additions & 0 deletions Makefile.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ variantshortcut := @variantshortcut@
# editor
editor := @editor@

# path change behavior
pathentryreorder := @pathentryreorder@

# shell completion location
bashcompletiondir := @bashcompletiondir@
fishcompletiondir := @fishcompletiondir@
Expand Down
7 changes: 7 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ Modules 5.7.0 (not yet released)
environment variable on Fish shell version 4.3.
* When fetching user's groups, in case a group name cannot be resolved use
this group gid number as name instead of raising an error. (fix issue #604)
* Introduce :mconfig:`path_entry_reorder` configuration option that change
order of entry in a path-like environment variable when it is added again.
This new configuration option is disabled by default. This option can be
changed at installation time with :instopt:`--enable-path-entry-reorder`.
When :mconfig:`path_entry_reorder` is changed with :subcmd:`config`
sub-command, it sets the :envvar:`MODULES_PATH_ENTRY_REORDER` environment
variable. (fix issue #595 with contribution from Achim Gsell)


.. _5.6 release notes:
Expand Down
9 changes: 8 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ multilibsupport libdir64 libdir32 versioning silentshdbgsupport \
setshellstartup quarantinesupport autohandling availindepth implicitdefault \
extendeddefault moduleshome initconfin pager pageropts verbosity color \
darkbgcolors lightbgcolors termbg lockedconfigs icase unloadmatchorder \
searchmatch modulepath loadedmodules quarantinevars wa277 advversspec ml \
searchmatch modulepath loadedmodules quarantinevars wa277 pathentryreorder advversspec ml \
windowssupport nearlyforbiddendays implicitrequirement tagabbrev \
tagcolorname mcookieversioncheck availoutput availterseoutput listoutput \
listterseoutput editor variantshortcut bashcompletiondir fishcompletiondir \
Expand Down Expand Up @@ -79,6 +79,7 @@ extendeddefault=y
advversspec=y
ml=y
wa277=n
pathentryreorder=n
loadedmodules=
quarantinevars=
binsearchpath=/usr/bin:/bin:/usr/local/bin
Expand Down Expand Up @@ -291,6 +292,9 @@ Optional Features:
--enable-require-via set modulecmd.tcl to consider that a module enabling
a modulepath is a requirement for the loaded modules
stored in this modulepath [no]
--enable-path-entry-reorder
change order of entry in a path-like environment
variable when it is added again [no]
--enable-implicit-requirement
implicitly define a requirement toward modules
specified on ``module load`` or ``module unload``
Expand Down Expand Up @@ -803,6 +807,9 @@ for arg in "$@"; do
--enable-mcookie-version-check*|--disable-mcookie-version-check)
# shellcheck disable=SC2034
mcookieversioncheck=$(get_feature_value "$arg") ;;
--enable-path-entry-reorder*|--disable-path-entry-reorder)
# shellcheck disable=SC2034
pathentryreorder=$(get_feature_value "$arg") ;;
--with-bin-search-path=*|--without-bin-search-path)
binsearchpath=$(get_package_value "$arg") ;;
--with-moduleshome=*|--without-moduleshome)
Expand Down
4 changes: 4 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,8 @@ The following environment variables appeared on Modules 5.
| | :envvar:`__MODULES_LMUSE`, |
| | :envvar:`MODULES_REQUIRE_VIA` |
+------------+-----------------------------------------------------------------+
| 5.7 | :envvar:`MODULES_PATH_ENTRY_REORDER` |
+------------+-----------------------------------------------------------------+

Modules Specific Tcl Commands
"""""""""""""""""""""""""""""
Expand Down Expand Up @@ -1279,6 +1281,8 @@ The following Modules configuration option has been introduced on Modules 5.
| 5.6 | :mconfig:`spider_output`, :mconfig:`spider_terse_output`, |
| | :mconfig:`spider_indepth`, :mconfig:`require_via` |
+------------+-----------------------------------------------------------------+
| 5.7 | :mconfig:`path_entry_reorder` |
+------------+-----------------------------------------------------------------+

:mconfig:`auto_handling`

Expand Down
49 changes: 49 additions & 0 deletions doc/source/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,23 @@ Module Sub-Commands
sub-command when changing this configuration option from its default value.
See :envvar:`MODULES_PAGER` description for details.

.. mconfig:: path_entry_reorder

Change order of entry in a path-like environment variable, when
:mfcmd:`prepend-path`, :mfcmd:`append-path` or :subcmd:`use` target a path
entry that is already defined in the environment variable.

Default value is ``0``. It can be changed at installation time with the
:instopt:`--enable-path-entry-reorder` option. The
:envvar:`MODULES_PATH_ENTRY_REORDER` environment variable is defined by
:subcmd:`config` sub-command when changing this configuration option from
its default value. See :envvar:`MODULES_PATH_ENTRY_REORDER` description
for details.

.. only:: html or latex

.. versionadded:: 5.7

.. mconfig:: protected_envvars

Prevents any modification of listed environment variables (colon `:`
Expand Down Expand Up @@ -5274,6 +5291,38 @@ ENVIRONMENT
.. versionchanged:: 5.5
No pager when :file:`modulecmd.tcl` is run for scripting languages

.. envvar:: MODULES_PATH_ENTRY_REORDER

This environment variable changes the behavior of :mfcmd:`prepend-path`,
:mfcmd:`append-path` and :mfcmd:`module use<module>` modulefile commands and
sub-commands.

If set to ``1``, and one of these commands targets a path entry that already
exists in the environment variable, the entry is moved to the beginning or
end (depending on the command), unless duplicates are allowed. If set to
``0``, the environment variable is not modified when the entry already
exists.

.. parsed-literal::

:ps:`$` module config path_entry_reorder 0
:ps:`$` module append-path PATHVAR /foo
:ps:`$` module append-path PATHVAR /bar
:ps:`$` module append-path PATHVAR /foo
:ps:`$` echo $PATHVAR
/foo:/bar
:ps:`$` module config path_entry_reorder 1
:ps:`$` module append-path PATHVAR /foo
:ps:`$` echo $PATHVAR
/bar:/foo
:ps:`$` module append-path --duplicates PATHVAR /bar
:ps:`$` echo $PATHVAR
/bar:/foo:/bar

.. only:: html or latex

.. versionadded:: 5.7

.. envvar:: MODULES_PROTECTED_ENVVARS

A colon separated list of environment variable names that should not be
Expand Down
5 changes: 3 additions & 2 deletions doc/source/other-implementations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ table highlights features that are unique to each implementation.
* `i18n`_
* `Find best module`_
* `Path entry priorities`_
* `Update path entry order`_
* ``--regexp`` search option
* `settarg`_
* `Hook functions`_
Expand Down Expand Up @@ -158,6 +157,8 @@ implementation.
- :ref:`Requiring via module`
* - `Autoswap`_
- :ref:`Conflict unload MIGRATING`
* - `Update path entry order`_
- :mconfig:`path_entry_reorder` configuration option
* - |LMOD_DOWNSTREAM_CONFLICTS|_ environment variable
- :ref:`Dependencies between modulefiles`
* - |LMOD_QUARANTINE_VARS|_ environment variable
Expand Down Expand Up @@ -286,5 +287,5 @@ additional tools that enhance how modulefiles are handled.
If you're aware of a ``module``-related project missing from this list, feel
free to :ref:`contact us<Community>` so we can add it.

.. |modules_version| replace:: Modules 5.6.0
.. |modules_version| replace:: Modules 5.7.0 (not yet released)
.. |lmod_version| replace:: Lmod 9.0.5
3 changes: 2 additions & 1 deletion init/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ comp_lint_opts := -a -i --all --icase
comp_modtosh_opts := --auto --no-auto --force -f --icase -i
comp_path_opts := -d --delim --duplicates
comp_rm_path_opts := -d --delim --index
comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277
comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277

define translate-in-script
$(ECHO_GEN)
Expand Down Expand Up @@ -167,6 +167,7 @@ sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@comp_path_opts@|$(comp_path_opts)|g' \
-e 's|@comp_rm_path_opts@|$(comp_rm_path_opts)|g' \
-e 's|@comp_config_opts@|$(comp_config_opts)|g' \
-e 's|@comp_path_entry_reorder@|$(comp_path_entry_reorder)|g' \
-e '$(setzshfpathre)' \
-e $$'s|@modulerc@|$(modulerc)|g' \
-e 's|@modulepath@|$(modulepath)|g' \
Expand Down
2 changes: 1 addition & 1 deletion init/fish_completion
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ complete -c module -n '__fish_module_use_stashlist' -f -a "(module stashlist --c
/Stash collection list\$/d; \
/:\$/d; \
/:ERROR:/d;')"
complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277"
complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277"

complete -f -n '__fish_module_no_subcommand' -c module -a 'help' --description 'Print this or modulefile(s) help info'
complete -f -n '__fish_module_no_subcommand' -c module -a 'avail' --description 'List all or matching available modules'
Expand Down
2 changes: 1 addition & 1 deletion init/zsh-functions/_module.in
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ _module() {
_arguments \
'--dump-state[Report each state value of current Modules execution]' \
'--reset[Unset environment variable relative to configuration key]' \
'1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \
'1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \
&& ret=0
;;
(edit)
Expand Down
2 changes: 2 additions & 0 deletions site.exp.in
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ set install_variantshortcut "@variantshortcut@"

set install_editor "@editor@"

set install_pathentryreorder "@pathentryreorder@"

set install_bashcompletiondir "@bashcompletiondir@"
set install_fishcompletiondir "@fishcompletiondir@"
set install_zshcompletiondir "@zshcompletiondir@"
Expand Down
Loading
Loading