From 32293ce05ffccee5b8a1aa9fc8d9313ebcf09930 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Tue, 6 Mar 2018 10:52:19 +0100 Subject: [PATCH] Fix error messages caused by unquoted parameters (#1549664) --- ...oinit-res-from-param-expansion-on-sh.patch | 101 ++++++++++++++++++ environment-modules.spec | 8 +- 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 0001-init-shield-autoinit-res-from-param-expansion-on-sh.patch diff --git a/0001-init-shield-autoinit-res-from-param-expansion-on-sh.patch b/0001-init-shield-autoinit-res-from-param-expansion-on-sh.patch new file mode 100644 index 0000000..d4a89de --- /dev/null +++ b/0001-init-shield-autoinit-res-from-param-expansion-on-sh.patch @@ -0,0 +1,101 @@ +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 + diff --git a/environment-modules.spec b/environment-modules.spec index d319147..328e289 100644 --- a/environment-modules.spec +++ b/environment-modules.spec @@ -2,13 +2,14 @@ Name: environment-modules Version: 4.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Provides dynamic modification of a user's environment Group: System Environment/Base License: GPLv2+ URL: http://modules.sourceforge.net/ Source0: http://downloads.sourceforge.net/modules/modules-%{version}.tar.bz2 +Patch0: 0001-init-shield-autoinit-res-from-param-expansion-on-sh.patch BuildRequires: tcl-devel, tclx-devel, libX11-devel BuildRequires: dejagnu, sed, procps, hostname, man, less @@ -56,6 +57,8 @@ This package provides Environment Modules compatibility version (3.2). %prep %setup -q -n modules-%{version} +%patch0 -p1 + %build %configure --prefix=%{_datadir}/Modules \ @@ -175,6 +178,9 @@ fi %changelog +* Tue Mar 6 2018 Jan Synáček - 4.1.1-2 +- Fix error messages caused by unquoted parameters (#1549664) + * Tue Feb 20 2018 Jan Synáček - 4.1.1-1 - Update to 4.1.1 (#1546450, #1139165, #1545369) + Big thanks to Xavier Delaruelle for a spec patch!