[PATCH v2 01/14] test: add known broken test for reply to message with multiple Cc headers

Subject: [PATCH v2 01/14] test: add known broken test for reply to message with multiple Cc headers

Date: Sat, 13 Aug 2016 14:37:25 +0300

To: notmuch@notmuchmail.org

Cc: Daniel Kahn Gillmor, jani@nikula.org

From: Jani Nikula


As Daniel Kahn Gillmor <dkg@fifthhorseman.net> reports in
id:87d1ngv95p.fsf@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.

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 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 30b78f679d97..d6f3a839ca48 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -253,5 +253,30 @@ test_expect_equal_json "$output" '
     }
 }'
 
+test_begin_subtest "Reply to a message with multiple Cc headers"
+test_subtest_known_broken
+cat > "${MAIL_DIR}"/broken_cc <<EOF
+From: Alice <alice@example.org>
+To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Cc: Bob <bob@example.org>
+Subject: wowsers!
+cc: Charles <charles@example.org>
+Message-Id: <abc123@example.org>
+Date: Thu, 16 Jun 2016 22:14:41 -0400
+
+Note the Cc: and cc: headers.
+EOF
+notmuch new >/dev/null
+output=$(notmuch reply id:abc123@example.org)
+notmuch reply id:abc123@example.com
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: wowsers!
+To: Alice <alice@example.org>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+Cc: Bob <bob@example.org>, Charles <charles@example.org>
+In-Reply-To: <abc123@example.org>
+References: <abc123@example.org>
+
+On Thu, 16 Jun 2016 22:14:41 -0400, Alice <alice@example.org> wrote:
+> Note the Cc: and cc: headers."
 
 test_done
-- 
2.1.4


Thread: