[pacman-dev] [PATCH] makepkg: don't attach traps until after argument parsing

Dan McGee dan at archlinux.org
Thu Oct 13 18:29:05 EDT 2011


Nothing we do in our traps is necessary this early in the script. This
fixes FS#26196.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 scripts/makepkg.sh.in |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 09c1e96..3085bf5 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -174,17 +174,6 @@ clean_up() {
 }
 
 
-##
-# Signal Traps
-##
-set -E
-trap 'clean_up' 0
-for signal in TERM HUP QUIT; do
-	trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
-done
-trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
-trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
-
 enter_fakeroot() {
 	msg "$(gettext "Entering %s environment...")" "fakeroot"
 
@@ -1956,6 +1945,15 @@ while true; do
 	shift
 done
 
+# setup signal traps
+trap 'clean_up' 0
+for signal in TERM HUP QUIT; do
+	trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
+done
+trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
+trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
+set -E
+
 # preserve environment variables and canonicalize path
 [[ -n ${PKGDEST} ]] && _PKGDEST=$(canonicalize_path ${PKGDEST})
 [[ -n ${SRCDEST} ]] && _SRCDEST=$(canonicalize_path ${SRCDEST})
-- 
1.7.7



More information about the pacman-dev mailing list