Whamcloud - gitweb
LU-1199 lbuild: Fix error handling
authorChristopher J. Morrone <morrone2@llnl.gov>
Thu, 21 Feb 2013 00:26:11 +0000 (16:26 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 1 May 2013 06:11:48 +0000 (02:11 -0400)
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 <morrone2@llnl.gov>
Reviewed-on: http://review.whamcloud.com/5961
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Brian J. Murrell <brian.murrell@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
contrib/lbuild/funcs.sh
contrib/lbuild/lbuild

index bbd7709..53854f7 100644 (file)
@@ -6,16 +6,15 @@ cleanup() {
 error() {
     local msg="$1"
 
 error() {
     local msg="$1"
 
-    [ -n "$msg" ] && echo -e "\n${0##*/}: $msg" >&$STDOUT
-
+    if [ -n "$msg" ]; then
+        echo -e "\n${0##*/}: $msg" >&$STDOUT
+    fi
 }
 
 fatal() {
 }
 
 fatal() {
-
     cleanup
     error "$2"
     exit $1
     cleanup
     error "$2"
     exit $1
-
 }
 
 #
 }
 
 #
index f389505..d682f3c 100755 (executable)
@@ -238,7 +238,7 @@ Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
     Builds a Xen domX kernel.
 
   --set-value
     Builds a Xen domX kernel.
 
   --set-value
-    Set's a variable to a given value.
+    Sets a variable to a given value.
 
 EOF
 
 
 EOF
 
@@ -1865,10 +1865,7 @@ else
   seen_list=$(add_list "$seen_list" "${BASH_SOURCE[0]}:${BASH_LINENO[0]}")
 fi
 backtrace
   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
 set -E
 
 [ -r ~/.lbuildrc ] && . ~/.lbuildrc