From 4f6269fbeb51364abb71137ed554aeccf359b537 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Fri, 16 Aug 2013 17:19:25 +0300 Subject: [PATCH] Re: [PATCH v2 2/3] reply: Remove extraneous space from generated References --- 3a/c1854638c28e4276dd71ef0d56b49168112c57 | 152 ++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 3a/c1854638c28e4276dd71ef0d56b49168112c57 diff --git a/3a/c1854638c28e4276dd71ef0d56b49168112c57 b/3a/c1854638c28e4276dd71ef0d56b49168112c57 new file mode 100644 index 000000000..1f8821a61 --- /dev/null +++ b/3a/c1854638c28e4276dd71ef0d56b49168112c57 @@ -0,0 +1,152 @@ +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 171F9431E82 + for ; Fri, 16 Aug 2013 07:19:29 -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 1pNfV3s1Gmtk for ; + Fri, 16 Aug 2013 07:19:21 -0700 (PDT) +Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com + [209.85.214.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A41E5431FAF + for ; Fri, 16 Aug 2013 07:19:21 -0700 (PDT) +Received: by mail-bk0-f43.google.com with SMTP id mz13so647337bkb.16 + for ; Fri, 16 Aug 2013 07:19:20 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=x-gm-message-state:from:to:cc:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=hY16oIruLu+VjIeOowyZzU7p588cbxV4sV7KgckgtGc=; + b=TOT8Scc1HPoeqfuv3RY8IX66fjY09M8l4hyLLwoRYNMj7w8ImdhJiA8jOL21X6Vv1P + SPnb//A1GdpLkOf6VeKa6q/mqS2S+kfZGZbWRihC9ly4E2dXBuQIGJPMxUKw6+O+IAV9 + ZWCH31LT9mjNa7N9Qv8yrXgkL5PV51Y35oC4W73MgzqZUuOWCQAs4Elo63Jp5AD7prwA + KXmJtHhmw0+dv1bS2aS2aUYsjve0QKhggPZ8R0PSL9BR/OAtoc34AUWgJVhjqsL4+HVQ + pibBO2DOtIB5t+oLdC5rZOyPq12TeJgq+jv8hqHZs4dO6m/Yj812cwJAAcZhAy9xD1zL + qtyw== +X-Gm-Message-State: + ALoCoQmEMBC02BEZjplTjMPo6CMYtzm/YU/z6gX5gqAS/shGCIgwM5cKgocf9jGI26Ubtf63JSRu +X-Received: by 10.204.77.72 with SMTP id f8mr920709bkk.28.1376662760251; + Fri, 16 Aug 2013 07:19:20 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id 14sm362700bkl.17.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 16 Aug 2013 07:19:19 -0700 (PDT) +From: Jani Nikula +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v2 2/3] reply: Remove extraneous space from generated + References +In-Reply-To: <1376587658-19202-3-git-send-email-amdragon@mit.edu> +References: <1376587658-19202-1-git-send-email-amdragon@mit.edu> + <1376587658-19202-3-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.15.2+227~g40b2846 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Fri, 16 Aug 2013 17:19:25 +0300 +Message-ID: <87k3jl3ehe.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +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 14:19:29 -0000 + +On Thu, 15 Aug 2013, Austin Clements wrote: +> 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); +> + } + +If orig_references turned out to be NULL, wouldn't this then fail to add +a References: header with in_reply_to in it? + +Jani. + + +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2