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 2F202431FB6 for ; Sun, 17 Apr 2011 10:24:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 vBZUpYnKxYnA for ; Sun, 17 Apr 2011 10:24:24 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 43A1A431FB5 for ; Sun, 17 Apr 2011 10:24:24 -0700 (PDT) Received: by wyi11 with SMTP id 11so4759431wyi.26 for ; Sun, 17 Apr 2011 10:24:22 -0700 (PDT) Received: by 10.227.149.73 with SMTP id s9mr4092852wbv.156.1303061060002; Sun, 17 Apr 2011 10:24:20 -0700 (PDT) Received: from localhost (103.39-242-81.adsl-dyn.isp.belgacom.be [81.242.39.103]) by mx.google.com with ESMTPS id bs4sm2783309wbb.1.2011.04.17.10.24.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 17 Apr 2011 10:24:19 -0700 (PDT) From: Pieter Praet To: Andreas Amann , Notmuch Mail Subject: Re: Problem with "Unexpected output" messages In-Reply-To: <8739ljwy7z.fsf@msstf091.ucc.ie> References: <87pqozi3q2.fsf@msstf091.ucc.ie> <8739ljwy7z.fsf@msstf091.ucc.ie> User-Agent: Notmuch/0.5-86-g4875299 (http://notmuchmail.org) Emacs/23.1.50.1 (x86_64-pc-linux-gnu) Date: Sun, 17 Apr 2011 19:24:16 +0200 Message-ID: <877haspz9b.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Sun, 17 Apr 2011 17:24:26 -0000 On Fri, 15 Apr 2011 12:28:00 +0100, Andreas Amann wrote: > On Wed, 06 Apr 2011 20:23:17 +0100, Andreas Amann wrote: > > > > since commit 44d3c57e (emacs: Display any unexpected output from notmuch > > search) I see a number of messages of the form > > > > Error: Unexpected output from notmuch search: > > thread:000000000000XXXX > > > > after notmuch-search in emacs. > > > FWIW, the patch below solves the problem for me. > > Andreas > > --------------------- > [PATCH] Sanitize "Subject:" and "Author:" fields to not contain control characters in notmuch-search > > When a Subject field contained encoded CRLF sequences, these sequences > would appear unfiltered in the output of notmuch search. This confused > the notmuch emacs interface leading to "Unexpected Output" > messages. This is now fixed by replacing all characters with ASCII > code less than 32 with a question mark. > --- > notmuch-search.c | 22 ++++++++++++++++++++-- > 1 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/notmuch-search.c b/notmuch-search.c > index 8b90121..fc13e60 100644 > --- a/notmuch-search.c > +++ b/notmuch-search.c > @@ -108,6 +108,20 @@ format_item_id_text (unused (const void *ctx), > printf ("%s%s", item_type, item_id); > } > > +static char * > +sanitize_string(const void *ctx, const char *str) > +{ > + char *out, *loop; > + > + loop = out = talloc_strdup (ctx, str); > + > + for(;*loop;loop++){ > + if ((unsigned char)(*loop) < 32) > + *loop = '?'; > + } > + return out; > +} > + > static void > format_thread_text (const void *ctx, > const char *thread_id, > @@ -117,13 +131,17 @@ format_thread_text (const void *ctx, > const char *authors, > const char *subject) > { > + void *ctx_quote = talloc_new (ctx); > + > printf ("thread:%s %12s [%d/%d] %s; %s", > thread_id, > notmuch_time_relative_date (ctx, date), > matched, > total, > - authors, > - subject); > + sanitize_string(ctx_quote, authors), > + sanitize_string(ctx_quote, subject)); > + > + talloc_free (ctx_quote); > } > > static void > -- > 1.7.4.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch Works as advertised, but IMHO (since notmuch solely does indexing, search and tagging) notmuch should return messages as truthful (i.e. unaltered) as possible. Any postprocessing should be the responsability of the MUA. However, since notmuch already provides output formats, this could be made part of those, eg. "--format=sanitized_text". Peace -Pieter