From f930fe9336ba1850bf6d54511f3045cf612d242f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Feb 2010 21:18:40 +0000 Subject: [PATCH] More error handling: set -e, set -o pipefail --- stump/bin/noAck | 2 ++ stump/bin/preApprove | 2 ++ stump/bin/processApproved | 5 ++++- stump/bin/processRejected | 2 ++ stump/bin/report.sh | 5 ++++- stump/bin/send_pgp_key | 6 +++++- stump/bin/stump-pgp | 4 +++- stump/bin/submitFailed | 4 +++- stump/bin/verifySignature | 5 ++++- stump/etc/modack.approved.INO | 5 ++++- stump/etc/modack.received.INO | 5 ++++- stump/etc/mods-message | 5 ++++- stump/etc/my_rnews | 4 +++- stump/etc/posted_log | 4 +++- 14 files changed, 47 insertions(+), 11 deletions(-) diff --git a/stump/bin/noAck b/stump/bin/noAck index 8fde0a5..e0ca66f 100755 --- a/stump/bin/noAck +++ b/stump/bin/noAck @@ -1,5 +1,7 @@ #!/bin/sh +set -e + if [ "x$@" = "x" ]; then cat >> $MNG_ROOT/data/noack.list diff --git a/stump/bin/preApprove b/stump/bin/preApprove index bb0baa5..e9ab9d4 100755 --- a/stump/bin/preApprove +++ b/stump/bin/preApprove @@ -1,5 +1,7 @@ #!/bin/sh +set -e + if [ "x$@" = "x" ]; then cat >> $MNG_ROOT/data/good.guys.list diff --git a/stump/bin/processApproved b/stump/bin/processApproved index 9cdf3c6..615d0c1 100755 --- a/stump/bin/processApproved +++ b/stump/bin/processApproved @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail NEWSBIN=/var/lib/newsbin; export NEWSBIN shift diff --git a/stump/bin/processRejected b/stump/bin/processRejected index c2dbc5e..460c25a 100755 --- a/stump/bin/processRejected +++ b/stump/bin/processRejected @@ -4,6 +4,8 @@ # reply message, signs it with PGP and sends back to the author. # +set -e + # echo $0 invoked with arguments $@ 1>&2 MESSAGE=$TMP/rejected.$$ diff --git a/stump/bin/report.sh b/stump/bin/report.sh index 13138f1..966d083 100755 --- a/stump/bin/report.sh +++ b/stump/bin/report.sh @@ -1,9 +1,12 @@ -#!/bin/sh +#!/bin/bash # posts a nice report # # $Id: report.sh,v 1.2 2007/05/03 23:47:49 rram Exp $ # Modified to work with GPG +set -e +set -o pipefail + TODAY="`date`" DATE6="`date +%y%m%d`" diff --git a/stump/bin/send_pgp_key b/stump/bin/send_pgp_key index 4104f1b..0e1decd 100755 --- a/stump/bin/send_pgp_key +++ b/stump/bin/send_pgp_key @@ -1,4 +1,8 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail + ( formail -r -I "Subject: $NEWSGROUP Approval PGP Key" \ -I "Reply-To: devnull@algebra.com" \ diff --git a/stump/bin/stump-pgp b/stump/bin/stump-pgp index 05425d3..2c07e64 100755 --- a/stump/bin/stump-pgp +++ b/stump/bin/stump-pgp @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +set -e # $Id: stump-pgp,v 1.2 2007/05/03 23:47:55 rram Exp $ # Modified to work with GPG diff --git a/stump/bin/submitFailed b/stump/bin/submitFailed index 938d341..43bc126 100755 --- a/stump/bin/submitFailed +++ b/stump/bin/submitFailed @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +set -e cd $MNG_ROOT/tmp diff --git a/stump/bin/verifySignature b/stump/bin/verifySignature index 45571a3..c719d01 100755 --- a/stump/bin/verifySignature +++ b/stump/bin/verifySignature @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail # $Id: verifySignature,v 1.2 2007/05/03 23:50:21 rram Exp $ # Modified to work with GPG diff --git a/stump/etc/modack.approved.INO b/stump/etc/modack.approved.INO index d07d760..17f9717 100755 --- a/stump/etc/modack.approved.INO +++ b/stump/etc/modack.approved.INO @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail ( cat $@ | formail -rt -I "Reply-To: $NOACK" \ diff --git a/stump/etc/modack.received.INO b/stump/etc/modack.received.INO index 63be110..f666c0b 100755 --- a/stump/etc/modack.received.INO +++ b/stump/etc/modack.received.INO @@ -1,4 +1,7 @@ -#!/bin/sh +#!/bin/bash + +set -e +set -o pipefail TMPFILE=$TMP/reply.$$ diff --git a/stump/etc/mods-message b/stump/etc/mods-message index 3d3c4c7..ddc73d6 100755 --- a/stump/etc/mods-message +++ b/stump/etc/mods-message @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # This script sends an email to a group of people listed in # env var RECIPIENTS (we create this var here from etc/moderators) @@ -7,6 +7,9 @@ # human moderators of your newsgroup. # +set -e +set -o pipefail + FILTER="NO_$2_LIST"; RECIPIENTS="`cat $MNG_ROOT/etc/moderators \ diff --git a/stump/etc/my_rnews b/stump/etc/my_rnews index 8ba5f13..86c5894 100755 --- a/stump/etc/my_rnews +++ b/stump/etc/my_rnews @@ -1,9 +1,11 @@ -#!/bin/sh +#!/bin/bash # # use this script instead of standard rnews or inews, if you want better # propagation of your articles. # +set -e + TEMPFILE=$TMP/posting.$$ cat $@ > $TEMPFILE diff --git a/stump/etc/posted_log b/stump/etc/posted_log index 0f48c6c..08c8e5a 100755 --- a/stump/etc/posted_log +++ b/stump/etc/posted_log @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +set -e # This file creates a little .posted_log file in your home # directory. Runs if activeated by crontab. See your crontab -- 2.30.2