testbot: Add In-Reply-To header on the TestBot replies.

Alexandre Julliard julliard at winehq.org
Wed Nov 15 05:01:53 CST 2017


Signed-off-by: Alexandre Julliard <julliard at winehq.org>
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

I made some changes:

* Two minor syntax fixes.

* The usefulness of the In-Reply-To header is not limited to the 
  mailing list or the WineHQ website. So I think we should add it to all 
  reply emails now that we have it. So I added it to the email that 
  sends the logs privately to the user.

* In-Reply-To headers are long! The longest I have found in my 
  wine-devel / wine-patches archives is 86 characters long.

  The maximum length for this field is unclear.
  - It can contain multiple message ids (3.6.4. of RFC 2822), each of 
    which follows the same rules as email addresses.
  - In theory the maximum length for an email address is 320 characters 
    (64 for the local part + @ + 255 for the domain, all from 4.5.3.1 of 
    RFC 2821). However that same RFC limits the length of forward-path, 
    i.e. email addresses following the RCPT command, to 256 characters, 
    angle brackets included (which we keep). So in the end a given 
    message-id should be no more than 256 characters.
  - However as mentioned before there may be more than one and since 
    this field is not relevant to email servers I don't think we can 
    apply the 256 character limit. Then the only limit is the line 
    length, 998 characters CRLF excluded (2.1.1. in RFC 2822).

  998 seems pretty overkill. 256 would be consistent with email address 
  limits and thus should be reasonable. In practice we could probably 
  get away with 128. In the end I picked 256 because I don't think the 
  size of this field is much of an issue database-wise for the TestBot. 
  Let me know if you feel strongly for some other value.

* Real email addresses are much shorter in practice because people 
  don't like typing long addresses. But we should probably increase the 
  40 character limit anyway. We could go for the official 256 character 
  limit, or try to save a few bytes and go for 254 (256 minus the two 
  angle brackets since we don't store them), 128 or even 64. But that 
  should be a separate patch (which I can send).

With that it seems to work.


 testbot/bin/WineSendLog.pl         | 10 ++++++++++
 testbot/ddl/update27.sql           |  5 +++++
 testbot/ddl/winetestbot.sql        |  1 +
 testbot/lib/WineTestBot/Patches.pm |  6 ++++++
 4 files changed, 22 insertions(+)
 create mode 100644 testbot/ddl/update27.sql

diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 1cca338f..aaf7b313 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -189,6 +189,11 @@ sub SendLog($)
     $Subject .= ": " . $Description;
   }
   print SENDMAIL "Subject: $Subject\n";
+  if ($Job->Patch->MessageId)
+  {
+    print SENDMAIL "In-Reply-To: ", $Job->Patch->MessageId, "\n";
+    print SENDMAIL "References: ", $Job->Patch->MessageId, "\n";
+  }
   print SENDMAIL <<"EOF";
 MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary="==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47=="
@@ -419,6 +424,11 @@ EOF
     print SENDMAIL "To: $To\n";
     print SENDMAIL "Cc: $WinePatchCc\n";
     print SENDMAIL "Subject: Re: ", $Job->Patch->Subject, "\n";
+    if ($Job->Patch->MessageId)
+    {
+      print SENDMAIL "In-Reply-To: ", $Job->Patch->MessageId, "\n";
+      print SENDMAIL "References: ", $Job->Patch->MessageId, "\n";
+    }
     print SENDMAIL <<"EOF";
 
 Hi,
diff --git a/testbot/ddl/update27.sql b/testbot/ddl/update27.sql
new file mode 100644
index 00000000..0dc2b895
--- /dev/null
+++ b/testbot/ddl/update27.sql
@@ -0,0 +1,5 @@
+USE winetestbot;
+
+ALTER TABLE Patches
+  ADD MessageId VARCHAR(256) NULL
+      AFTER Subject;
diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql
index 5e79bd3d..f8d590fe 100644
--- a/testbot/ddl/winetestbot.sql
+++ b/testbot/ddl/winetestbot.sql
@@ -70,6 +70,7 @@ CREATE TABLE Patches
   FromName    VARCHAR(40)     NULL,
   FromEMail   VARCHAR(40)     NULL,
   Subject     VARCHAR(120)    NULL,
+  MessageId   VARCHAR(256)    NULL,
   PRIMARY KEY (Id),
   INDEX PatchesWebPatchId (WebPatchId)
 )
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index d5de05e4..b5320dc2 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -100,6 +100,11 @@ sub FromSubmission($$)
   my $PropertyDescriptor = $self->GetPropertyDescriptorByName("Subject");
   $self->Subject(substr($Subject, 0, $PropertyDescriptor->GetMaxLength()));
 
+  my $MessageId = $Head->get("Message-Id");
+  $MessageId =~ s/\s*\n\s*/ /gs;
+  $PropertyDescriptor = $self->GetPropertyDescriptorByName("MessageId");
+  $self->MessageId(substr($MessageId, 0, $PropertyDescriptor->GetMaxLength()));
+
   $self->Disposition("Processing");
 }
 
@@ -371,6 +376,7 @@ BEGIN
     CreateBasicPropertyDescriptor("FromName", "Author", !1, !1, "A", 40),
     CreateBasicPropertyDescriptor("FromEMail", "Author's email address", !1, !1, "A", 40),
     CreateBasicPropertyDescriptor("Subject", "Subject", !1, !1, "A", 120),
+    CreateBasicPropertyDescriptor("MessageId", "Message id", !1, !1, "A", 256),
     CreateBasicPropertyDescriptor("Disposition", "Disposition", !1, 1, "A", 40),
   );
 }
-- 
2.14.2



More information about the wine-patches mailing list