encrypting replies to encrypted mail
[notmuch-archives.git] / 45 / ba807862bc880c9ace7596fb4fcd8ab5b60b28
1 Return-Path: <pieter@praet.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 2F202431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 17 Apr 2011 10:24:26 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 vBZUpYnKxYnA for <notmuch@notmuchmail.org>;\r
16         Sun, 17 Apr 2011 10:24:24 -0700 (PDT)\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
18         [74.125.82.181]) (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 43A1A431FB5\r
21         for <notmuch@notmuchmail.org>; Sun, 17 Apr 2011 10:24:24 -0700 (PDT)\r
22 Received: by wyi11 with SMTP id 11so4759431wyi.26\r
23         for <notmuch@notmuchmail.org>; Sun, 17 Apr 2011 10:24:22 -0700 (PDT)\r
24 Received: by 10.227.149.73 with SMTP id s9mr4092852wbv.156.1303061060002;\r
25         Sun, 17 Apr 2011 10:24:20 -0700 (PDT)\r
26 Received: from localhost (103.39-242-81.adsl-dyn.isp.belgacom.be\r
27         [81.242.39.103])\r
28         by mx.google.com with ESMTPS id bs4sm2783309wbb.1.2011.04.17.10.24.18\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Sun, 17 Apr 2011 10:24:19 -0700 (PDT)\r
31 From: Pieter Praet <pieter@praet.org>\r
32 To: Andreas Amann <a.amann@ucc.ie>, Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: Re: Problem with "Unexpected output" messages\r
34 In-Reply-To: <8739ljwy7z.fsf@msstf091.ucc.ie>\r
35 References: <87pqozi3q2.fsf@msstf091.ucc.ie> <8739ljwy7z.fsf@msstf091.ucc.ie>\r
36 User-Agent: Notmuch/0.5-86-g4875299 (http://notmuchmail.org) Emacs/23.1.50.1\r
37         (x86_64-pc-linux-gnu)\r
38 Date: Sun, 17 Apr 2011 19:24:16 +0200\r
39 Message-ID:\r
40  <877haspz9b.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Sun, 17 Apr 2011 17:24:26 -0000\r
56 \r
57 On Fri, 15 Apr 2011 12:28:00 +0100, Andreas Amann <a.amann@ucc.ie> wrote:\r
58 > On Wed, 06 Apr 2011 20:23:17 +0100, Andreas Amann <a.amann@ucc.ie> wrote:\r
59 > > \r
60 > > since commit 44d3c57e (emacs: Display any unexpected output from notmuch\r
61 > > search) I see a number of messages of the form\r
62 > > \r
63 > > Error: Unexpected output from notmuch search:\r
64 > > thread:000000000000XXXX \r
65 > > \r
66 > > after notmuch-search in emacs. \r
67\r
68\r
69 > FWIW, the patch below solves the problem for me.\r
70\r
71 > Andreas\r
72\r
73 > ---------------------\r
74 > [PATCH] Sanitize "Subject:" and "Author:" fields to not contain control characters in notmuch-search\r
75\r
76 > When a Subject field contained encoded CRLF sequences, these sequences\r
77 > would appear unfiltered in the output of notmuch search. This confused\r
78 > the notmuch emacs interface leading to "Unexpected Output"\r
79 > messages. This is now fixed by replacing all characters with ASCII\r
80 > code less than 32 with a question mark.\r
81 > ---\r
82 >  notmuch-search.c |   22 ++++++++++++++++++++--\r
83 >  1 files changed, 20 insertions(+), 2 deletions(-)\r
84\r
85 > diff --git a/notmuch-search.c b/notmuch-search.c\r
86 > index 8b90121..fc13e60 100644\r
87 > --- a/notmuch-search.c\r
88 > +++ b/notmuch-search.c\r
89 > @@ -108,6 +108,20 @@ format_item_id_text (unused (const void *ctx),\r
90 >      printf ("%s%s", item_type, item_id);\r
91 >  }\r
92 >  \r
93 > +static char *\r
94 > +sanitize_string(const void *ctx, const char *str)\r
95 > +{\r
96 > +    char *out, *loop;\r
97 > +\r
98 > +    loop = out = talloc_strdup (ctx, str);\r
99 > +\r
100 > +    for(;*loop;loop++){\r
101 > +     if ((unsigned char)(*loop) < 32)\r
102 > +         *loop = '?';\r
103 > +    }\r
104 > +    return out;\r
105 > +}\r
106 > +\r
107 >  static void\r
108 >  format_thread_text (const void *ctx,\r
109 >                   const char *thread_id,\r
110 > @@ -117,13 +131,17 @@ format_thread_text (const void *ctx,\r
111 >                   const char *authors,\r
112 >                   const char *subject)\r
113 >  {\r
114 > +    void *ctx_quote = talloc_new (ctx);\r
115 > +\r
116 >      printf ("thread:%s %12s [%d/%d] %s; %s",\r
117 >           thread_id,\r
118 >           notmuch_time_relative_date (ctx, date),\r
119 >           matched,\r
120 >           total,\r
121 > -         authors,\r
122 > -         subject);\r
123 > +         sanitize_string(ctx_quote, authors),\r
124 > +         sanitize_string(ctx_quote, subject));\r
125 > +\r
126 > +    talloc_free (ctx_quote);\r
127 >  }\r
128 >  \r
129 >  static void\r
130 > -- \r
131 > 1.7.4.1\r
132\r
133 > _______________________________________________\r
134 > notmuch mailing list\r
135 > notmuch@notmuchmail.org\r
136 > http://notmuchmail.org/mailman/listinfo/notmuch\r
137 \r
138 \r
139 Works as advertised, but IMHO (since notmuch solely does indexing,\r
140 search and tagging) notmuch should return messages as truthful\r
141 (i.e. unaltered) as possible.\r
142 \r
143 Any postprocessing should be the responsability of the MUA.\r
144 \r
145 However, since notmuch already provides output formats, this could be\r
146 made part of those, eg. "--format=sanitized_text".\r
147 \r
148 \r
149 Peace\r
150 \r
151 -Pieter\r