Skip to content

Commit 898e471

Browse files
committed
doc: clarify script exec properties through source-sh/sh-to-mod
Fixes #646 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
1 parent 45afd22 commit 898e471

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

NEWS.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Modules 5.7.0 (not yet released)
126126
which causes :instopt:`--enable-set-pythonpath` to append the Modules
127127
``init`` directory to :envvar:`PYTHONPATH` instead of prepending it.
128128
(contribution from Byron Boulton)
129+
* Doc: clarify shell script, executed by :mfcmd:`source-sh` modulefile command
130+
or :subcmd:`sh-to-mod` sub-command, does not get access to shell aliases,
131+
functions or completions settings only available in interactive sessions or
132+
defined in profile files. (fix issue #646)
129133

130134

131135
.. _5.6 release notes:

doc/source/design/source-shell-script-in-modulefile.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Specification
103103

104104
- if this module is unloaded and if it does not trigger the unload of the modulefile using ``source-sh``, variable will be unset as source-sh script has not increased variable reference counter
105105

106+
- **Limitation**: Script will not get access to shell aliases, functions or completions defined in interactive mode or shell profile configurations
107+
106108
- **Note**: environment change done through ``source-sh`` will not preserve change order occurring in sourced script, as all changes are analyzed after sourcing script
107109

108110
- Most shell will not get the full environment content when spawned as a sub-process

doc/source/module.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,6 +2634,11 @@ Module Sub-Commands
26342634
is not sourced but the output resulting from its execution is evaluated to
26352635
determine the environment changes it does.
26362636

2637+
.. note:: *shell* is run in non-interactive mode without loading any shell
2638+
configuration or profile. As a result, script does not have access to
2639+
transient definitions that are only available in interactive sessions or
2640+
profile files, such as shell aliases, functions, or completion settings.
2641+
26372642
.. only:: html or latex
26382643

26392644
.. versionadded:: 4.6

doc/source/modulefile.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,11 @@ the *modulefile* is being loaded.
16021602
multiple shell element separated by colon character. Accepted shell elements
16031603
are: ``envvar``, ``alias``, ``function``, ``chdir`` and ``complete``.
16041604

1605+
.. note:: *shell* is run in non-interactive mode without loading any shell
1606+
configuration or profile. As a result, script does not have access to
1607+
transient definitions that are only available in interactive sessions or
1608+
profile files, such as shell aliases, functions, or completion settings.
1609+
16051610
.. only:: html or latex
16061611

16071612
.. versionadded:: 4.6

0 commit comments

Comments
 (0)