From de5052bacbf91ed1daaaeb98e54239af7702edae Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Sun, 13 Apr 2025 14:43:26 +0200 Subject: [PATCH] doc: desc. newline char support in env var value Signed-off-by: Xavier Delaruelle --- NEWS.rst | 6 ++++++ doc/source/changes.rst | 3 +++ doc/source/modulefile.rst | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 27034c36..536bd767 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -132,6 +132,12 @@ Modules 5.6.0 (not yet released) * Issue the *nearly-forbidden* warning at the end of the affected modulefile evaluation, ensuring it is always reported at the same stage regardless of where it is defined. +* Change underlying shell code to set environment variable on *sh*, *bash*, + *ksh*, *zsh* and *fish* shells: enclose value within single quotes rather + escaping each special characters. +* :mfcmd:`setenv` modulefile command now supports environment variable value + containing newline character. Exception is made for *csh* and *tcsh* shells + where newline characters are chopped from value. (fix issue #557) .. _Security policy: https://github.com/envmodules/modules/blob/main/SECURITY.md .. _Modules chat room: https://matrix.to/#/#modules:matrix.org diff --git a/doc/source/changes.rst b/doc/source/changes.rst index b2036657..7d9d9191 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1151,6 +1151,9 @@ The following modulefile Tcl commands appeared on Modules 5. Starting with version ``5.1``, the ``--set-if-undef`` option is added to set environment variable when modulefile is loaded only if not yet defined. + Starting with version ``5.6``, value set can contain newline character. + Exception for csh shell family where such character is chopped from value. + :mfcmd:`source-sh` Starting Modules ``5.1``, this modulefile command also tracks shell diff --git a/doc/source/modulefile.rst b/doc/source/modulefile.rst index 418e4ace..e068b52e 100644 --- a/doc/source/modulefile.rst +++ b/doc/source/modulefile.rst @@ -1452,11 +1452,16 @@ the *modulefile* is being loaded. When the ``--set-if-undef`` option is set, environment variable is defined when *modulefile* is loaded only if not yet defined. + Any newline character in *value* is chopped if using *csh* or *tcsh* shells. + .. only:: html .. versionchanged:: 5.1 Option ``--set-if-undef`` added + .. versionchanged:: 5.6 + Newline character in value supported except for *csh* and *tcsh* shells + .. mfcmd:: source-sh [--ignore eltlist] shell script [arg...] Evaluate with *shell* the designated *script* with defined *arguments* to