From 24781b65c59be918e3bf19a09ad2332ec1df4306 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 17 Aug 2013 11:35:42 +2000 Subject: [PATCH] [PATCH v3 2/3] reply: Remove extraneous space from generated References --- 55/c2e1b964e72cab78f283ee4b850b6bab521f17 | 138 ++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 55/c2e1b964e72cab78f283ee4b850b6bab521f17 diff --git a/55/c2e1b964e72cab78f283ee4b850b6bab521f17 b/55/c2e1b964e72cab78f283ee4b850b6bab521f17 new file mode 100644 index 000000000..805cb0ad3 --- /dev/null +++ b/55/c2e1b964e72cab78f283ee4b850b6bab521f17 @@ -0,0 +1,138 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 3FDF3429E50 + for ; Fri, 16 Aug 2013 08:35:58 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id MhjqGQwZ1-kE for ; + Fri, 16 Aug 2013 08:35:54 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + by olra.theworths.org (Postfix) with ESMTP id B66A0429E3A + for ; Fri, 16 Aug 2013 08:35:49 -0700 (PDT) +X-AuditID: 12074423-b7f168e00000095a-45-520e46d4b3a5 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 5F.C2.02394.4D64E025; Fri, 16 Aug 2013 11:35:49 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r7GFZkoa021710; + Fri, 16 Aug 2013 11:35:46 -0400 +Received: from drake.dyndns.org + (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [216.15.114.40]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7GFZi2J020146 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Fri, 16 Aug 2013 11:35:45 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1VAM40-0002va-8E; Fri, 16 Aug 2013 11:35:44 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 2/3] reply: Remove extraneous space from generated + References +Date: Fri, 16 Aug 2013 11:35:42 -0400 +Message-Id: <1376667343-10863-3-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1376667343-10863-1-git-send-email-amdragon@mit.edu> +References: <1376667343-10863-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsUixCmqrHvVjS/IYN5uZos9+7wsrt+cyWzx + ZuU8Vgdmj7unuTwOf13I4vFs1S3mAOYoLpuU1JzMstQifbsEroxpRzazFPQLV3SvOsXewLic + v4uRk0NCwERi2a3VjBC2mMSFe+vZuhi5OIQE9jFKXL/xhAXC2cgoserIR3YI5w6TxPwdG5kh + nLmMEvunbWAB6WcT0JDYtn852CwRAWmJnXdns4LYzALxEm0vtrOD2MICARIHNr0Gq2ERUJWY + cLgJzOYVcJCYueEcM8QdihLdzyawgdicAo4Sn/s/gc0XAqrZMW8p2wRG/gWMDKsYZVNyq3Rz + EzNzilOTdYuTE/PyUot0zfRyM0v0UlNKNzGCgovdRXkH45+DSocYBTgYlXh4GSbyBgmxJpYV + V+YeYpTkYFIS5Z3nyBckxJeUn1KZkVicEV9UmpNafIhRgoNZSYR3qwFQjjclsbIqtSgfJiXN + waIkzvvs6dlAIYH0xJLU7NTUgtQimKwMB4eSBO9CV6BGwaLU9NSKtMycEoQ0EwcnyHAeoOF7 + QGp4iwsSc4sz0yHypxh1OS4cXviJUYglLz8vVUqc1xmkSACkKKM0D24OLCm8YhQHekuY9xRI + FQ8wocBNegW0hAloyaQzvCBLShIRUlINjKY3pRok1hs0eyptu76Cc8KUBMa6fwkFSgWSXTF+ + zGbnub5vbF57L3rbk316Z01qlf7764oLbdN//7L/5Oz2+imnHPdOiNuW+Yp31uneiJDLG3tt + 6hkEtaKnXvnFK6j7W0T6rNmJyQb189k4/r+Ov5IZclfYNWChz/1XVn6Tq/n0DkyeOHfWSiWW + 4oxEQy3mouJEAE37aCDlAgAA +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 16 Aug 2013 15:35:58 -0000 + +Previously, the References header code seemed to assume +notmuch_message_get_header would return NULL if the header was not +present, but it actually returns "". As a result of this, it was +inserting an unnecessary space when concatenating an empty or missing +original references header with the new reference. + +This shows up in only two tests because the text reply format later +passes the whole reply template through g_mime_filter_headers, which +has the side effect of stripping out this extra space. +--- + notmuch-reply.c | 7 +++++-- + test/multipart | 2 +- + test/reply | 2 +- + 3 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 3b2b58d..472a002 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -537,9 +537,12 @@ create_reply_message(void *ctx, + "In-Reply-To", in_reply_to); + + orig_references = notmuch_message_get_header (message, "references"); ++ if (!orig_references) ++ /* Treat errors like missing References headers. */ ++ orig_references = ""; + references = talloc_asprintf (ctx, "%s%s%s", +- orig_references ? orig_references : "", +- orig_references ? " " : "", ++ *orig_references ? orig_references : "", ++ *orig_references ? " " : "", + in_reply_to); + g_mime_object_set_header (GMIME_OBJECT (reply), + "References", references); +diff --git a/test/multipart b/test/multipart +index c974226..2033023 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -599,7 +599,7 @@ cat <EXPECTED + "From": "Notmuch Test Suite ", + "To": "Carl Worth , cworth@cworth.org", + "In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>", +- "References": " <87liy5ap00.fsf@yoom.home.cworth.org>"}, ++ "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"}, + "original": {"id": "XXXXX", + "match": false, + "excluded": false, +diff --git a/test/reply b/test/reply +index c877ffe..a85ebe5 100755 +--- a/test/reply ++++ b/test/reply +@@ -242,7 +242,7 @@ test_expect_equal_json "$output" ' + "reply-headers": { + "From": "Notmuch Test Suite ", + "In-reply-to": "<'${gen_msg_id}'>", +- "References": " <'${gen_msg_id}'>", ++ "References": "<'${gen_msg_id}'>", + "Subject": "Re: \u00e0\u00df\u00e7", + "To": "\u2603 " + } +-- +1.7.10.4 + -- 2.26.2