[pacman-dev] [PATCH 1/3] makepkg: use bash 4.4 to localize `set` without explicitly saving/restoring

Eli Schwartz eschwartz at archlinux.org
Tue Aug 14 01:20:56 UTC 2018


Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---
 scripts/makepkg.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4024f477..bb8332c6 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -418,13 +418,14 @@ prepare_buildenv() {
 }
 
 run_function_safe() {
-	local restoretrap restoreset restoreshopt
+	local restoretrap restoreshopt
 
 	# we don't set any special shopts of our own, but we don't want the user to
 	# muck with our environment.
 	restoreshopt=$(shopt -p)
 
-	restoreset=$(shopt -o -p)
+	# localize sets, sadly this does not work for shopt
+	local -
 	shopt -o -s errexit errtrace
 
 	restoretrap=$(trap -p ERR)
@@ -434,7 +435,6 @@ run_function_safe() {
 
 	trap - ERR
 	eval "$restoretrap"
-	eval "$restoreset"
 	eval "$restoreshopt"
 }
 
-- 
2.18.0


More information about the pacman-dev mailing list