[pacman-dev] [PATCH 2/3] makepkg: don't save the same shopts twice

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


Both run_function and run_function_safe will save and restore `shopt -p`
but the former is only called from the latter. It makes sense to save
this as part of a "safe" runner, so let's just do it in one place, there
where we save and restore everything else too.

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

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index bb8332c6..bb24c633 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -447,9 +447,6 @@ run_function() {
 	msg "$(gettext "Starting %s()...")" "$pkgfunc"
 	cd_safe "$srcdir"
 
-	# save our shell options so pkgfunc() can't override what we need
-	local shellopts=$(shopt -p)
-
 	local ret=0
 	if (( LOGGING )); then
 		local fullver=$(get_full_version)
@@ -479,8 +476,6 @@ run_function() {
 	else
 		"$pkgfunc"
 	fi
-	# reset our shell options
-	eval "$shellopts"
 }
 
 run_prepare() {
-- 
2.18.0


More information about the pacman-dev mailing list