[pacman-dev] [PATCH 04/10] makepkg: consistent err trap handling

Andres P aepd87 at gmail.com
Fri Jun 25 19:16:39 EDT 2010


ERR trap was being toggled on and off in 3 places in confusingly different
ways. One of these ocurrances went untouched after this commit. Since disabling
the ERR trap is unintuitive enough, at least it should be done in a way that is
uniform across makepkg.

Also, in check_deps the ERR trap was being disabled before needed. If
the assignments included in the range were unsuccesful because the variables
had the readonly attribute, makepkg would've exited without "unknown error"
thanks to errexit.

Signed-off-by: Andres P <aepd87 at gmail.com>
---
 scripts/makepkg.sh.in |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2237cfe..bbc28d9 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -389,11 +389,9 @@ check_deps() {
 
 	# Disable error trap in pacman subshell call as this breaks bash-3.2 compatibility
 	# Also, a non-zero return value is not unexpected and we are manually dealing them
-	set +E
 	local ret=0
 	local pmout
-	pmout=$(run_pacman -T "$@") || ret=$?
-	set -E 
+	pmout=$(set +E; run_pacman -T "$@") || ret=$?
 	
 	if (( ret == 127 )); then #unresolved deps
 		echo "$pmout"
@@ -427,10 +425,9 @@ handle_deps() {
 
 	# we might need the new system environment
 	# avoid triggering the ERR trap
-	local restoretrap=$(trap -p ERR)
-	trap - ERR
+	set +E
 	source /etc/profile &>/dev/null
-	eval $restoretrap
+	set -E
 
 	return $R_DEPS_SATISFIED
 }
-- 
1.7.1



More information about the pacman-dev mailing list