Re: Bug/Issue: References header doesn't wrap in emacs package
[notmuch-archives.git] / 09 / 1008e43aef2e96ffdee710fc5c89cf2decb3b0
1 Return-Path: <jani@nikula.org>\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 C7558431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 02:12:10 -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 pn-ld9NsCCBr for <notmuch@notmuchmail.org>;\r
16         Sat, 18 Oct 2014 02:12:02 -0700 (PDT)\r
17 Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com\r
18         [209.85.212.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 524FF431FBC\r
21         for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 02:12:02 -0700 (PDT)\r
22 Received: by mail-wi0-f178.google.com with SMTP id h11so3178340wiw.5\r
23         for <notmuch@notmuchmail.org>; Sat, 18 Oct 2014 02:11:59 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:cc:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=iCmOE9vH003xLPt36pWG76Ge41o0e9DYGVdJe4BsUhs=;\r
29         b=TLVRMXYHGSY8QB8o8S6HzF6cQczxCDCkobBAg78RVcxs5M8aajzP29FJ/vBnxezW+t\r
30         0WnzNzQ4lhRV8vkkpeiZbibJRC+L/proIxEoGvyiy/2N1UiDUFwvLAfoCPnY/cuKqVE5\r
31         4sgC+sseHKzKFHKDM9VuJv4xyYm6wfvWIkgLT6+KiOQ3615oZ+bGo0Gs0yoGoa8OqtvH\r
32         n1N9WpGDRg2np9mm4G+pTIDf+SUCFrdHPNjk0asGqMDEk645+Pxux66a299u+w47lS9r\r
33         loHVv5XLOZcf9FfXCFQ0jeVRM/pyy0xJiE4TBoRcfA9ZJ18DiyhbC4HPJ7u3gPrLgf69\r
34         1dLw==\r
35 X-Gm-Message-State:\r
36  ALoCoQlYAN6uqjDgxI3bzs5JaYHDYe1VrECdrm5+QTcBkmxGM1Qf2Bp/n6yxwKvdCw6R22iHO83R\r
37 X-Received: by 10.180.14.231 with SMTP id s7mr4975919wic.0.1413623519809;\r
38         Sat, 18 Oct 2014 02:11:59 -0700 (PDT)\r
39 Received: from localhost (mobile-internet-5d6ad2-138.dhcp.inet.fi.\r
40         [93.106.210.138])\r
41         by mx.google.com with ESMTPSA id yr9sm4550840wjc.31.2014.10.18.02.11.58\r
42         for <multiple recipients>\r
43         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
44         Sat, 18 Oct 2014 02:11:58 -0700 (PDT)\r
45 From: Jani Nikula <jani@nikula.org>\r
46 To: sshilovsky@gmail.com, Jameson Graef Rollins <jrollins@finestructure.net>\r
47 Subject: Re: Tabulation in multiline headers\r
48 In-Reply-To:\r
49  <CAHc2pO21-pahkpyT1jYk2ExWHDGiOO+weovMA-vd8s82LpqK4A@mail.gmail.com>\r
50 References:\r
51  <CAHc2pO1QjtqMw9rf0aWGup+Bs_ZpvsZ1bd32H0xiDdzQ_k5GFA@mail.gmail.com>\r
52         <87vbnime8n.fsf@servo.finestructure.net>\r
53         <CAHc2pO21-pahkpyT1jYk2ExWHDGiOO+weovMA-vd8s82LpqK4A@mail.gmail.com>\r
54 User-Agent: Notmuch/0.18.1+65~g9f0f30f (http://notmuchmail.org) Emacs/24.3.1\r
55         (x86_64-pc-linux-gnu)\r
56 Date: Sat, 18 Oct 2014 12:11:56 +0300\r
57 Message-ID: <87ppdp3foj.fsf@nikula.org>\r
58 MIME-Version: 1.0\r
59 Content-Type: text/plain\r
60 Cc: notmuch@notmuchmail.org\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Sat, 18 Oct 2014 09:12:10 -0000\r
74 \r
75 On Sat, 18 Oct 2014, Sergei Shilovsky <sshilovsky@gmail.com> wrote:\r
76 >> Hi, Sergei.  I'm not clear on where exactly you are seeing a problem\r
77 >> with this tab in the subject line.  Is it showing up somewhere you think\r
78 >> it shouldn't?\r
79 >\r
80 > It is shown in e.g. `notmuch show` as well as\r
81 > 'notmuch_message_get_header(m, "subject")`\r
82 >\r
83 >> I'm not sure libnotmuch should be doing any scrubbing of the message\r
84 >> contents.  The emacs UI does seem to replace the tab with a space,\r
85 >> though.  Maybe other MUAs should be doing the same?\r
86 >\r
87 > My point is that this tabulation character does not relate to the\r
88 > contents of the header (this might be arguable though) and libnotmuch\r
89 > should return the contents, not its representation on file system.\r
90 \r
91 This is folding and unfolding of long header fields in action, described\r
92 in [1]. In short, folding happens by inserting CRLF before any WSP, and\r
93 unfolding happens by removing any CRLF immediately followed by WSP. The\r
94 WSP is preserved unchanged through folding and unfolding. The TAB is not\r
95 part of the multiple line representation, it's part of the unfolded\r
96 content.\r
97 \r
98 If my memory serves me right, many problems lead back to an\r
99 interpretation of [2] that you could insert extra WSP while folding. Due\r
100 to this interpretation, many agents replace the WSP following a CRLF\r
101 with a single space while unfolding. And presumably because of this,\r
102 buggy folding in a Python email package that replaces WSP by a TAB while\r
103 folding went unnoticed. This problem, in turn, has been literally spread\r
104 wide by Mailman 2 through its use of said email package. In practice it\r
105 follows that a perfectly good message will have folding WSP replaced by\r
106 TAB when it gets transmitted through Mailman 2. Again, this is all from\r
107 memory, [citation needed] etc.\r
108 \r
109 Notmuch is not free of a history of its own when it comes to header\r
110 unfolding. For historical reasons, we used two header parsers until\r
111 recently. One from gmime, and one of our own. After all of the above, it\r
112 shouldn't surprise the reader that the parsers treated folding WSP\r
113 differently! Our own parser replaced folding WSP with a single space,\r
114 while gmime respects the RFC. Starting from 0.18 we only use gmime to\r
115 parse headers, which means we're at least consistent, but, by the GIGO\r
116 principle, we may see more folding TABs.\r
117 \r
118 I do not think we should workaround header folding problems in the lib,\r
119 and I'm not sure about the cli either. We should consider replacing TABs\r
120 with spaces in notmuch-emacs though (I personally use a\r
121 notmuch-show-markup-headers-hook that does that).\r
122 \r
123 HTH,\r
124 Jani.\r
125 \r
126 \r
127 [1] https://tools.ietf.org/html/rfc5322#section-2.2.3\r
128 [2] https://tools.ietf.org/html/rfc822#section-3.1\r