[PATCH v3 02/15] test: add known broken test for reply to message with multiple Cc headers

Jani Nikula jani at nikula.org
Tue Sep 13 10:14:09 PDT 2016


As Daniel Kahn Gillmor <dkg at fifthhorseman.net> reports in
id:87d1ngv95p.fsf at alice.fifthhorseman.net, notmuch show combines
multiple Cc: fields into one, while notmuch reply does not. While such
messages are in violation of RFC 5322, it would be reasonable to
expect notmuch to be consistent. Add a known broken test to document
this expectation.

This also starts a new "broken" corpus for messages which are broken.

Details:

The original message is formatted using the message printing in
notmuch-show.c. For Cc:, it uses g_mime_message_get_recipients(),
which apparently combines all Cc: fields into one internally.

The addresses in the reply headers, OTOH, are based on headers queried
through libnotmuch. It boils down to g_mime_object_get_header() in
lib/message-file.c, which returns only the first occurence of header.
---
 test/T220-reply.sh            | 13 +++++++++++++
 test/corpora/README           | 11 +++++++++++
 test/corpora/broken/broken-cc |  9 +++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 test/corpora/README
 create mode 100644 test/corpora/broken/broken-cc

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 30b78f679d97..a72068ddde95 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -253,5 +253,18 @@ test_expect_equal_json "$output" '
     }
 }'
 
+test_begin_subtest "Reply to a message with multiple Cc headers"
+test_subtest_known_broken
+add_email_corpus broken
+output=$(notmuch reply id:multiple-cc at example.org)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite at notmuchmail.org>
+Subject: Re: wowsers!
+To: Alice <alice at example.org>, Daniel <daniel at example.org>
+Cc: Bob <bob at example.org>, Charles <charles at example.org>
+In-Reply-To: <multiple-cc at example.org>
+References: <multiple-cc at example.org>
+
+On Thu, 16 Jun 2016 22:14:41 -0400, Alice <alice at example.org> wrote:
+> Note the Cc: and cc: headers."
 
 test_done
diff --git a/test/corpora/README b/test/corpora/README
new file mode 100644
index 000000000000..77c48e6e7138
--- /dev/null
+++ b/test/corpora/README
@@ -0,0 +1,11 @@
+This directory contains email corpora for testing.
+
+default
+  The default corpus is based on about 50 messages from early in the
+  history of the notmuch mailing list, which allows for reliably
+  testing commands that need to operate on a not-totally-trivial
+  number of messages.
+
+broken
+  The broken corpus contains messages that are broken and/or RFC
+  non-compliant, ensuring we deal with them in a sane way.
diff --git a/test/corpora/broken/broken-cc b/test/corpora/broken/broken-cc
new file mode 100644
index 000000000000..57ae9ba9742c
--- /dev/null
+++ b/test/corpora/broken/broken-cc
@@ -0,0 +1,9 @@
+From: Alice <alice at example.org>
+To: Daniel <daniel at example.org>
+Cc: Bob <bob at example.org>
+Subject: wowsers!
+cc: Charles <charles at example.org>
+Message-Id: <multiple-cc at example.org>
+Date: Thu, 16 Jun 2016 22:14:41 -0400
+
+Note the Cc: and cc: headers.
-- 
2.1.4



More information about the notmuch mailing list