From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A727429E2F for ; Fri, 16 Aug 2013 08:15:38 -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 w76czCu95UHV for ; Fri, 16 Aug 2013 08:15:32 -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 BC6D0431E82 for ; Fri, 16 Aug 2013 08:15:32 -0700 (PDT) X-AuditID: 1209190f-b7fa58e000000953-8a-520e4214b77e Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id C9.14.02387.4124E025; Fri, 16 Aug 2013 11:15:32 -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 r7GFFUiC019207; Fri, 16 Aug 2013 11:15:30 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7GFFRpp012041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 16 Aug 2013 11:15:28 -0400 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1VALkM-0002RV-Gz; Fri, 16 Aug 2013 11:15:26 -0400 Date: Fri, 16 Aug 2013 11:15:25 -0400 From: Austin Clements To: Jani Nikula Subject: Re: [PATCH v2 2/3] reply: Remove extraneous space from generated References Message-ID: <20130816151525.GH13257@mit.edu> References: <1376587658-19202-1-git-send-email-amdragon@mit.edu> <1376587658-19202-3-git-send-email-amdragon@mit.edu> <87k3jl3ehe.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k3jl3ehe.fsf@nikula.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsUixCmqrCvixBdk8H47h0XTdGeL6zdnMlu8 WTmP1YHZ4/DXhSwet+6/Zvd4tuoWcwBzFJdNSmpOZllqkb5dAldG1/o1rAWTpCoubJ3P1sA4 Q6SLkZNDQsBEYv28ThYIW0ziwr31bF2MXBxCAvsYJRonTmQHSQgJbGSUeNBpDpE4zSSx6OIT FghnCaPE9h9nmEGqWARUJfruPwTrYBPQkNi2fzkjiC0ioCix+eR+MJtZQF9i5cmZYPXCAmES s/fdZQWxeQV0JB41/mWGGDqVUWLao1nMEAlBiZMzn7BANGtJ3Pj3kqmLkQPIlpZY/o8DJMwJ tOvPv06w+aICKhJTTm5jm8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3S NdHLzSzRS00p3cQIDnVJ/h2M3w4qHWIU4GBU4uFlmMgbJMSaWFZcmXuIUZKDSUmUd54jX5AQ X1J+SmVGYnFGfFFpTmrxIUYJDmYlEd6tBkA53pTEyqrUonyYlDQHi5I477OnZwOFBNITS1Kz U1MLUotgsjIcHEoSvOkgQwWLUtNTK9Iyc0oQ0kwcnCDDeYCGN4PU8BYXJOYWZ6ZD5E8x6nJc OLzwE6MQS15+XqqUOG85SJEASFFGaR7cHFiKesUoDvSWMG8ISBUPML3BTXoFtIQJaMmkM7wg S0oSEVJSDYySCmr5e4+FuQeddX66MrnZetNmrZW6D490Lqhy+BdQGZTcn5Nz9UOmjLThToPG 0Mp/9+qP3JW6Vbto8js5hcUqecdL1527eqQzoGLeI58teWfN1GQFE1ed1pSLd42oPp6/eO3k uRqX1ziJ3gq4/b2AY1EZx9PsCeWBtsealx4vEa+dLif0M0qJpTgj0VCLuag4EQBnP2vdLAMA AA== Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org 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:15:38 -0000 Quoth Jani Nikula on Aug 16 at 5:19 pm: > 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? That's true. It's not clear what the best course of action is if orig_references is NULL, but you're right that failing to produce a References header altogether is probably not it. I'll make it treat errors and missing/empty References headers identically. > 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 " > > }