summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorXavier Delaruelle <xavier.delaruelle@cea.fr>2023-07-19 17:57:37 +0200
committerGitHub <noreply@github.com>2023-07-19 17:57:37 +0200
commitd9fbdfbee930c9bae5c4c007bfb6a844ffdb0744 (patch)
tree866a3487c701f15001d37eefc584ab49ff3719b9 /share
parentae08b25dacd56b287d8c80ad648b998cfa2ec8cb (diff)
downloadspack-d9fbdfbee930c9bae5c4c007bfb6a844ffdb0744.tar.gz
spack-d9fbdfbee930c9bae5c4c007bfb6a844ffdb0744.tar.bz2
spack-d9fbdfbee930c9bae5c4c007bfb6a844ffdb0744.tar.xz
spack-d9fbdfbee930c9bae5c4c007bfb6a844ffdb0744.zip
modules: use curly braces to enclose value in Tcl modulefile (#38375)
Use curly braces instead of quotes to enclose value or text in Tcl modulefile. Within curly braces Tcl special characters like [, ] or $ are treated verbatim whereas they are evaluated within quotes. Curly braces is Tcl recommended way to enclose verbatim content [1]. Note: if curly braces charaters are used within content, they must be balanced. This point has been checked against current repository and no unbalanced curly braces has been spotted. Fixes #24243 [1] https://wiki.tcl-lang.org/page/Tcl+Minimal+Escaping+Style
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.tcl22
1 files changed, 11 insertions, 11 deletions
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
index 52d987da61..746fea2f31 100644
--- a/share/spack/templates/modules/modulefile.tcl
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -11,16 +11,16 @@
{% block header %}
{% if short_description %}
-module-whatis "{{ short_description }}"
+module-whatis {{ '{' }}{{ short_description }}{{ '}' }}
{% endif %}
proc ModulesHelp { } {
- puts stderr "Name : {{ spec.name }}"
- puts stderr "Version: {{ spec.version }}"
- puts stderr "Target : {{ spec.target }}"
+ puts stderr {{ '{' }}Name : {{ spec.name }}{{ '}' }}
+ puts stderr {{ '{' }}Version: {{ spec.version }}{{ '}' }}
+ puts stderr {{ '{' }}Target : {{ spec.target }}{{ '}' }}
{% if long_description %}
- puts stderr ""
-{{ long_description| textwrap(72)| quote()| prepend_to_line(' puts stderr ')| join() }}
+ puts stderr {}
+{{ long_description| textwrap(72)| curly_quote()| prepend_to_line(' puts stderr ')| join() }}
{% endif %}
}
{% endblock %}
@@ -54,13 +54,13 @@ conflict {{ name }}
{% block environment %}
{% for command_name, cmd in environment_modifications %}
{% if command_name == 'PrependPath' %}
-prepend-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+prepend-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
{% elif command_name in ('AppendPath', 'AppendFlagsEnv') %}
-append-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+append-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
{% elif command_name in ('RemovePath', 'RemoveFlagsEnv') %}
-remove-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
+remove-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
{% elif command_name == 'SetEnv' %}
-setenv {{ cmd.name }} "{{ cmd.value }}"
+setenv {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
{% elif command_name == 'UnsetEnv' %}
unsetenv {{ cmd.name }}
{% endif %}
@@ -68,7 +68,7 @@ unsetenv {{ cmd.name }}
{% endfor %}
{# Make sure system man pages are enabled by appending trailing delimiter to MANPATH #}
{% if has_manpath_modifications %}
-append-path --delim ":" MANPATH ""
+append-path --delim {{ '{' }}:{{ '}' }} MANPATH {{ '{' }}{{ '}' }}
{% endif %}
{% endblock %}