From 05403115a680adf51990bc9439d78947e8a7beba Mon Sep 17 00:00:00 2001 From: "Christopher J. Morrone" Date: Wed, 20 Feb 2013 16:26:11 -0800 Subject: [PATCH] LU-1199 lbuild: Fix error handling Improper grouping of expressions in the error() function meant that even a simple "lbuild -h" would trigger a backtrace, and email to someone at whamcloud.com. That is fixed here. Also stop sending email to a static email address on errors. Also fix a minor typo. Change-Id: I5a3f6131baaadc9dba23414e9e959f72fbda2679 Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/5961 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: Brian J. Murrell Reviewed-by: Oleg Drokin --- contrib/lbuild/funcs.sh | 7 +++---- contrib/lbuild/lbuild | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index bbd7709..53854f7 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -6,16 +6,15 @@ cleanup() { error() { local msg="$1" - [ -n "$msg" ] && echo -e "\n${0##*/}: $msg" >&$STDOUT - + if [ -n "$msg" ]; then + echo -e "\n${0##*/}: $msg" >&$STDOUT + fi } fatal() { - cleanup error "$2" exit $1 - } # diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index f389505..d682f3c 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -238,7 +238,7 @@ Usage: ${0##*/} [OPTION]... [-- ] Builds a Xen domX kernel. --set-value - Set's a variable to a given value. + Sets a variable to a given value. EOF @@ -1865,10 +1865,7 @@ else seen_list=$(add_list "$seen_list" "${BASH_SOURCE[0]}:${BASH_LINENO[0]}") fi backtrace -echo -echo "Environment:" -set -) | mail -s "Untrapped error at ${BASH_SOURCE[0]##*/}:$((LINENO-15)) on $HOSTNAME" brian@whamcloud.com >&2; set $xtrace' ERR +) ; set $xtrace' ERR set -E [ -r ~/.lbuildrc ] && . ~/.lbuildrc -- 1.8.3.1