From 468f16f9ec477f1501d643675b5d4bea2e344e8b Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Thu, 1 Mar 2018 19:15:44 +0100 Subject: [PATCH] init: shield autoinit res from param expansion on sh-shells Quote autoinit result for eval interpretation on SH-kind shells to avoid parameter expansion to randomly occur on generated code depending on file or directory names of current working directory. Test basic module commands in install testsuite with a 'something (test)' file existing in current working directory. Fixes bug reported at [1]. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1549664 Resolves: #1549664 --- diff --git a/doc/source/module.rst b/doc/source/module.rst index e90313b0..c73ce18b 100644 --- a/doc/source/module.rst +++ b/doc/source/module.rst @@ -96,7 +96,7 @@ Bourne Shell (sh) (and derivatives) with **autoinit** sub-command: .. parsed-literal:: - eval \`\ |libexecdir|\ /modulecmd.tcl sh autoinit\` + eval "\`\ |libexecdir|\ /modulecmd.tcl sh autoinit\`" Modulecmd startup diff --git a/init/bash.in b/init/bash.in index a926abe1..ce9822b4 100644 --- a/init/bash.in +++ b/init/bash.in @@ -35,7 +35,7 @@ fi; # define module command and surrounding initial environment (default value # for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath) -eval `${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl bash autoinit` +eval "`${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl bash autoinit`" # clean temp variables used to setup quarantine if [ -n "${_mlIFS+x}" ]; then diff --git a/init/ksh.in b/init/ksh.in index f7557c70..834b8224 100644 --- a/init/ksh.in +++ b/init/ksh.in @@ -35,7 +35,7 @@ fi; # define module command and surrounding initial environment (default value # for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath) -eval `${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl ksh autoinit` +eval "`${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl ksh autoinit`" # clean temp variables used to setup quarantine if [ -n "${_mlIFS+x}" ]; then diff --git a/init/sh.in b/init/sh.in index 3a62f11d..197b865e 100644 --- a/init/sh.in +++ b/init/sh.in @@ -35,7 +35,7 @@ fi; # define module command and surrounding initial environment (default value # for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath) -eval `${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl sh autoinit` +eval "`${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl sh autoinit`" # clean temp variables used to setup quarantine if [ -n "${_mlIFS+x}" ]; then diff --git a/init/zsh.in b/init/zsh.in index 1b669126..b2c10ef6 100644 --- a/init/zsh.in +++ b/init/zsh.in @@ -35,7 +35,7 @@ fi; # define module command and surrounding initial environment (default value # for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init/.modulespath) -eval `${=_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl zsh autoinit` +eval "`${=_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl zsh autoinit`" # clean temp variables used to setup quarantine if [ -n "${_mlIFS+x}" ]; then diff --git a/testsuite/bin/install_test_sh b/testsuite/bin/install_test_sh index 890d1ba0..165460a5 100755 --- a/testsuite/bin/install_test_sh +++ b/testsuite/bin/install_test_sh @@ -82,7 +82,7 @@ fi # source module init file if first step of given mode if [ "$mode" = 'top' -o "$mode" = 'sub' -o "$mode" = 'subsub' ]; then if [ $autoinit -eq 0 ]; then - eval $($initfile $shname autoinit) + eval "$($initfile $shname autoinit)" else . $initfile fi -- 2.13.6