[PATCH 06/13] dispatcher: check of hook returns error

Jacob Keller jacob.e.keller at intel.com
Thu Mar 20 16:37:04 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 c0c188e50626..48bfbb2d2dad 100755
--- a/email/aiaiai-email-dispatcher-helper
+++ b/email/aiaiai-email-dispatcher-helper
@@ -96,19 +96,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 \"$file\""
-	$hook "$file" "$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 \"$file\""
+	if ! $hook "$file" "$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