[PATCH RFC 3/7] dispatcher: check of hook returns error

Jacob Keller jacob.e.keller at intel.com
Wed Mar 19 15:46:43 PDT 2014


Expected behavior of the dispatch hook is that it only returns failure
on an actual internal error, but not on normal patch failure. We should
check this error, and fail in the same manner than we fail for internal
aiaiai-email-test-patchset errors.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
 email/aiaiai-email-dispatcher-helper | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/email/aiaiai-email-dispatcher-helper b/email/aiaiai-email-dispatcher-helper
index 5b851cd1421c..9b430fb34df6 100755
--- a/email/aiaiai-email-dispatcher-helper
+++ b/email/aiaiai-email-dispatcher-helper
@@ -95,19 +95,24 @@ parse_config "$cfgfile"
 
 tmpdir="$(mktemp -dt "$PROG.XXXX")"
 
-# Run the dispatcher hook
-if [ -n "$cfg_dispatch_hook" ]; then
-	hook="$(readlink -fv -- "$cfg_dispatch_hook")"
-	verbose "Running \"$hook\" on \"$mbox\""
-	$hook "$mbox" "$cfgfile"
-fi
-
 verbose "Validating \"$mbox\", queue directory is: $queuedir"
 verbose "Configuration file: $cfgfile"
 
 mv $verbose -- "$mbox" "$tmpdir" >&2
 file="$tmpdir/${mbox##*/}"
 
+# Run the dispatcher hook
+if [ -n "$cfg_dispatch_hook" ]; then
+	hook="$(readlink -fv -- "$cfg_dispatch_hook")"
+	verbose "Running \"$hook\" on \"$mbox\""
+	if ! $hook "$mbox" "$cfgfile"; then
+		verbose "Dispatcher hook failed"
+		touch -- "$fail_file"
+		mv $verbose -- "$file" "$queuedir" >&2
+		exit 1
+	fi
+fi
+
 if ! cat -- "$file" | aiaiai-email-test-patchset "$verbose" "$cfgfile"; then
 	verbose "Validation failed"
 	touch -- "$fail_file"
-- 
1.8.3.1




More information about the aiaiai mailing list