Re: notmuch-tree display
[notmuch-archives.git] / 94 / 66163f62b614a6d75683774218a35821621023
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1A727429E2F\r
6         for <notmuch@notmuchmail.org>; Fri, 16 Aug 2013 08:15:38 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id w76czCu95UHV for <notmuch@notmuchmail.org>;\r
16         Fri, 16 Aug 2013 08:15:32 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id BC6D0431E82\r
20         for <notmuch@notmuchmail.org>; Fri, 16 Aug 2013 08:15:32 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7fa58e000000953-8a-520e4214b77e\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id C9.14.02387.4124E025; Fri, 16 Aug 2013 11:15:32 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r7GFFUiC019207; \r
27         Fri, 16 Aug 2013 11:15:30 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7GFFRpp012041\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
33         Fri, 16 Aug 2013 11:15:28 -0400\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
35         (envelope-from <amdragon@MIT.EDU>)\r
36         id 1VALkM-0002RV-Gz; Fri, 16 Aug 2013 11:15:26 -0400\r
37 Date: Fri, 16 Aug 2013 11:15:25 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Jani Nikula <jani@nikula.org>\r
40 Subject: Re: [PATCH v2 2/3] reply: Remove extraneous space from generated\r
41         References\r
42 Message-ID: <20130816151525.GH13257@mit.edu>\r
43 References: <1376587658-19202-1-git-send-email-amdragon@mit.edu>\r
44         <1376587658-19202-3-git-send-email-amdragon@mit.edu>\r
45         <87k3jl3ehe.fsf@nikula.org>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 Content-Disposition: inline\r
49 In-Reply-To: <87k3jl3ehe.fsf@nikula.org>\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)\r
51 X-Brightmail-Tracker:\r
52  H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsUixCmqrCvixBdk8H47h0XTdGeL6zdnMlu8\r
53         WTmP1YHZ4/DXhSwet+6/Zvd4tuoWcwBzFJdNSmpOZllqkb5dAldG1/o1rAWTpCoubJ3P1sA4\r
54         Q6SLkZNDQsBEYv28ThYIW0ziwr31bF2MXBxCAvsYJRonTmQHSQgJbGSUeNBpDpE4zSSx6OIT\r
55         FghnCaPE9h9nmEGqWARUJfruPwTrYBPQkNi2fzkjiC0ioCix+eR+MJtZQF9i5cmZYPXCAmES\r
56         s/fdZQWxeQV0JB41/mWGGDqVUWLao1nMEAlBiZMzn7BANGtJ3Pj3kqmLkQPIlpZY/o8DJMwJ\r
57         tOvPv06w+aICKhJTTm5jm8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3S\r
58         NdHLzSzRS00p3cQIDnVJ/h2M3w4qHWIU4GBU4uFlmMgbJMSaWFZcmXuIUZKDSUmUd54jX5AQ\r
59         X1J+SmVGYnFGfFFpTmrxIUYJDmYlEd6tBkA53pTEyqrUonyYlDQHi5I477OnZwOFBNITS1Kz\r
60         U1MLUotgsjIcHEoSvOkgQwWLUtNTK9Iyc0oQ0kwcnCDDeYCGN4PU8BYXJOYWZ6ZD5E8x6nJc\r
61         OLzwE6MQS15+XqqUOG85SJEASFFGaR7cHFiKesUoDvSWMG8ISBUPML3BTXoFtIQJaMmkM7wg\r
62         S0oSEVJSDYySCmr5e4+FuQeddX66MrnZetNmrZW6D490Lqhy+BdQGZTcn5Nz9UOmjLThToPG\r
63         0Mp/9+qP3JW6Vbto8js5hcUqecdL1527eqQzoGLeI58teWfN1GQFE1ed1pSLd42oPp6/eO3k\r
64         uRqX1ziJ3gq4/b2AY1EZx9PsCeWBtsealx4vEa+dLif0M0qJpTgj0VCLuag4EQBnP2vdLAMA        AA==\r
65 Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Fri, 16 Aug 2013 15:15:38 -0000\r
79 \r
80 Quoth Jani Nikula on Aug 16 at  5:19 pm:\r
81 > On Thu, 15 Aug 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
82 > > Previously, the References header code seemed to assume\r
83 > > notmuch_message_get_header would return NULL if the header was not\r
84 > > present, but it actually returns "".  As a result of this, it was\r
85 > > inserting an unnecessary space when concatenating an empty or missing\r
86 > > original references header with the new reference.\r
87 > >\r
88 > > This shows up in only two tests because the text reply format later\r
89 > > passes the whole reply template through g_mime_filter_headers, which\r
90 > > has the side effect of stripping out this extra space.\r
91 > > ---\r
92 > >  notmuch-reply.c |   14 ++++++++------\r
93 > >  test/multipart  |    2 +-\r
94 > >  test/reply      |    2 +-\r
95 > >  3 files changed, 10 insertions(+), 8 deletions(-)\r
96 > >\r
97 > > diff --git a/notmuch-reply.c b/notmuch-reply.c\r
98 > > index 3b2b58d..0f3b9cd 100644\r
99 > > --- a/notmuch-reply.c\r
100 > > +++ b/notmuch-reply.c\r
101 > > @@ -537,12 +537,14 @@ create_reply_message(void *ctx,\r
102 > >                           "In-Reply-To", in_reply_to);\r
103 > >  \r
104 > >      orig_references = notmuch_message_get_header (message, "references");\r
105 > > -    references = talloc_asprintf (ctx, "%s%s%s",\r
106 > > -                             orig_references ? orig_references : "",\r
107 > > -                             orig_references ? " " : "",\r
108 > > -                             in_reply_to);\r
109 > > -    g_mime_object_set_header (GMIME_OBJECT (reply),\r
110 > > -                         "References", references);\r
111 > > +    if (orig_references) {\r
112 > > +   references = talloc_asprintf (ctx, "%s%s%s",\r
113 > > +                                 *orig_references ? orig_references : "",\r
114 > > +                                 *orig_references ? " " : "",\r
115 > > +                                 in_reply_to);\r
116 > > +   g_mime_object_set_header (GMIME_OBJECT (reply),\r
117 > > +                             "References", references);\r
118 > > +    }\r
119\r
120 > If orig_references turned out to be NULL, wouldn't this then fail to add\r
121 > a References: header with in_reply_to in it?\r
122 \r
123 That's true.  It's not clear what the best course of action is if\r
124 orig_references is NULL, but you're right that failing to produce a\r
125 References header altogether is probably not it.  I'll make it treat\r
126 errors and missing/empty References headers identically.\r
127 \r
128 > Jani.\r
129\r
130\r
131 > >  \r
132 > >      return reply;\r
133 > >  }\r
134 > > diff --git a/test/multipart b/test/multipart\r
135 > > index c974226..2033023 100755\r
136 > > --- a/test/multipart\r
137 > > +++ b/test/multipart\r
138 > > @@ -599,7 +599,7 @@ cat <<EOF >EXPECTED\r
139 > >   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
140 > >   "To": "Carl Worth <cworth@cworth.org>, cworth@cworth.org",\r
141 > >   "In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>",\r
142 > > - "References": " <87liy5ap00.fsf@yoom.home.cworth.org>"},\r
143 > > + "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"},\r
144 > >   "original": {"id": "XXXXX",\r
145 > >   "match": false,\r
146 > >   "excluded": false,\r
147 > > diff --git a/test/reply b/test/reply\r
148 > > index c877ffe..a85ebe5 100755\r
149 > > --- a/test/reply\r
150 > > +++ b/test/reply\r
151 > > @@ -242,7 +242,7 @@ test_expect_equal_json "$output" '\r
152 > >      "reply-headers": {\r
153 > >          "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
154 > >          "In-reply-to": "<'${gen_msg_id}'>",\r
155 > > -        "References": " <'${gen_msg_id}'>",\r
156 > > +        "References": "<'${gen_msg_id}'>",\r
157 > >          "Subject": "Re: \u00e0\u00df\u00e7",\r
158 > >          "To": "\u2603 <snowman@example.com>"\r
159 > >      }\r