[pacman-dev] [PATCH] makepkg: prevent error trap activation in bash-3.2
Allan McRae
allan at archlinux.org
Tue Jun 22 23:20:11 EDT 2010
Running "pacman -T foo" is expected to return a non-zero value when
"foo" is not installed. This sets of the error trap in bash-3.2 but
not bash 4.x. Work around this by disabling the error trap around
this pacman call as we are manually checking the return value anyway.
Signed-off-by: Allan McRae <allan at archlinux.org>
---
scripts/makepkg.sh.in | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4f9f89b..2699f63 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -382,11 +382,15 @@ run_pacman() {
}
check_deps() {
- (( $# > 0 )) || return
+ (( $# > 0 )) || return 0
+ # 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
- pmout=$(run_pacman -T "$@")
- ret=$?
+ pmout=$(run_pacman -T "$@") || ret=$?
+ set -E
+
if (( ret == 127 )); then #unresolved deps
echo "$pmout"
elif (( ret )); then
--
1.7.1
More information about the pacman-dev
mailing list