From 9ddcc9c5b4c128a4e8ed2d21a586c541f03c893b Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 16 Aug 2013 13:27:37 +2000 Subject: [PATCH] [PATCH v2 2/3] reply: Remove extraneous space from generated References --- db/7012e14055fd9a9146f3bf96dc2df4f09a981a | 143 ++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 db/7012e14055fd9a9146f3bf96dc2df4f09a981a diff --git a/db/7012e14055fd9a9146f3bf96dc2df4f09a981a b/db/7012e14055fd9a9146f3bf96dc2df4f09a981a new file mode 100644 index 000000000..66c87b02e --- /dev/null +++ b/db/7012e14055fd9a9146f3bf96dc2df4f09a981a @@ -0,0 +1,143 @@ +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 B104A429E26 + for ; Thu, 15 Aug 2013 10:27:51 -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 wf8A93JRZHB5 for ; + Thu, 15 Aug 2013 10:27:46 -0700 (PDT) +Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu + [18.9.25.15]) + by olra.theworths.org (Postfix) with ESMTP id B73A2431FC2 + for ; Thu, 15 Aug 2013 10:27:46 -0700 (PDT) +X-AuditID: 1209190f-b7fa58e000000953-5a-520d0f92e805 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP + id EB.47.02387.29F0D025; Thu, 15 Aug 2013 13:27:46 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r7FHRgK1000756; + Thu, 15 Aug 2013 13:27:42 -0400 +Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7FHReeN009075 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 15 Aug 2013 13:27:41 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1VA1Km-00053e-05; Thu, 15 Aug 2013 13:27:40 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/3] reply: Remove extraneous space from generated + References +Date: Thu, 15 Aug 2013 13:27:37 -0400 +Message-Id: <1376587658-19202-3-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1376587658-19202-1-git-send-email-amdragon@mit.edu> +References: <1376587658-19202-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsUixCmqrTuJnzfI4NIvNovrN2cyW7xZOY/V + gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4MpY8/Ycc8EUkYppXVNYGxibBLoYOTgkBEwk + 3l1X72LkBDLFJC7cW8/WxcjFISSwj1Fi0fFNLBDORkaJFy+WMUI4R5gk/i38xw7hzGWUaH+9 + kB2kn01AQ2Lb/uWMILaIgLTEzruzWUFsZgEricNXN4HZwgIBEpca9oDZLAKqEsv/X2ADsXkF + HCQe9+xjhLhDUaL72QSwOKeAo8TKCffA4kJANfsXnmGbwMi/gJFhFaNsSm6Vbm5iZk5xarJu + cXJiXl5qka6JXm5miV5qSukmRnAoSfLvYPx2UOkQowAHoxIPb0Qbd5AQa2JZcWXuIUZJDiYl + Ud59fLxBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4v97jCRLiTUmsrEotyodJSXOwKInzPnt6 + NlBIID2xJDU7NbUgtQgmK8PBoSTBGw4yVLAoNT21Ii0zpwQhzcTBCTKcB2h4KkgNb3FBYm5x + ZjpE/hSjLseFwws/MQqx5OXnpUqJ80aCFAmAFGWU5sHNgaWAV4ziQG8J85aDVPEA0wfcpFdA + S5iAljhkc4EsKUlESEk1MLa39FX630mbbscc7BLP2aSp9flNl2D/xnuTy9dl8ir08mfpLo51 + Oc459bnwZqV8n5D1TrZWnlo7Zn+btXn7g10KRTzRaQv69P+f9Slsf7TjTLjJ2eAjYo/a7Nmb + Giy3Rpnl/TRLP3Dg7NsFGwLORNTlFVvpVe/WWRoUYrlwuTWvym1hyy4nJZbijERDLeai4kQA + n6KB4twCAAA= +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: Thu, 15 Aug 2013 17:27:52 -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 | 14 ++++++++------ + test/multipart | 2 +- + test/reply | 2 +- + 3 files changed, 10 insertions(+), 8 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 3b2b58d..0f3b9cd 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -537,12 +537,14 @@ create_reply_message(void *ctx, + "In-Reply-To", in_reply_to); + + orig_references = notmuch_message_get_header (message, "references"); +- references = talloc_asprintf (ctx, "%s%s%s", +- orig_references ? orig_references : "", +- orig_references ? " " : "", +- in_reply_to); +- g_mime_object_set_header (GMIME_OBJECT (reply), +- "References", references); ++ if (orig_references) { ++ references = talloc_asprintf (ctx, "%s%s%s", ++ *orig_references ? orig_references : "", ++ *orig_references ? " " : "", ++ in_reply_to); ++ g_mime_object_set_header (GMIME_OBJECT (reply), ++ "References", references); ++ } + + return reply; + } +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