[PATCH] email-test-patchset: fix a bug when project is unknown

Artem Bityutskiy dedekind1 at gmail.com
Mon Feb 3 04:46:56 EST 2014

From: Jacob Keller <jacob.e.keller at intel.com>

This patch corrects an issue due to attempting to use cfg_reply_to_all (a
per-project configuration option) before we have checked whether the project
is valid. This causes the whole aiaiai-email service to die. To fix this, move
the checks for no project and unknown project above the cfg_reply_to_all use.
Also unassign the to variable when sending these emails so that we don't spam
everyone, (regardless of the reply_to_all setting). This restores the behavior
to the previous default.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
 email/aiaiai-email-test-patchset | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index 83eff04..b32ab16 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -201,18 +201,9 @@ verbose "Project \"$prj\""
 # Fetch project configuration
 parse_prj_config "$cfgfile" "$prj"
-# Merge the "To" and "Cc" addresses
-to="$(merge_addresses "$to" "$cc")"
-if [ "$cfg_reply_to_all" != "1" ]; then
-	to=
-	# Strip own address
-	to=$(strip_address "$to" "$cfg_ownmail")
 # Reject the e-mail if the project has not been specified
 if [ -z "$prj" ]; then
+	to=
 	send_email <<EOF
 Sorry, but you have not specified the project name. Please, specify it
 using symbol "+" in the e-mail address of $ownname.
@@ -228,6 +219,7 @@ fi
 # Check if we have this project in our config file
 if [ -z "$cfg_name" ]; then
+	to=
 	send_email <<EOF
 Sorry, but project "$prj" is not supported. List of projects $cfg_ownname supports:
@@ -238,6 +230,16 @@ EOF
 	exit 0
+# Merge the "To" and "Cc" addresses
+to="$(merge_addresses "$to" "$cc")"
+if [ "$cfg_reply_to_all" != "1" ]; then
+	to=
+	# Strip own address
+	to=$(strip_address "$to" "$cfg_ownmail")
 # Notify the sender that the patches have been accepted
 if [ "$cfg_accept_notify" = "1" ]; then
 	message "Sending \"accepted\" e-mail"

More information about the aiaiai mailing list