From: Mark Walters Date: Thu, 17 Oct 2013 08:07:46 +0000 (+0100) Subject: Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b4b3db580c9e036f5d835d10dd4a1e8f7b8c4813;p=notmuch-archives.git Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search --- diff --git a/07/627ce9cc5b3c2fc3d5b5a167d110408bb0bbda b/07/627ce9cc5b3c2fc3d5b5a167d110408bb0bbda new file mode 100644 index 000000000..95229302a --- /dev/null +++ b/07/627ce9cc5b3c2fc3d5b5a167d110408bb0bbda @@ -0,0 +1,122 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CB2FB431FBC + for ; Thu, 17 Oct 2013 01:07:58 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.148 +X-Spam-Level: +X-Spam-Status: No, score=0.148 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_BL_SPAMCOP_NET=1.246, + RCVD_IN_DNSWL_MED=-2.3] 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 1fb6xH1ItOsY for ; + Thu, 17 Oct 2013 01:07:54 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D5601431FAE + for ; Thu, 17 Oct 2013 01:07:53 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1VWicV-0000BQ-K5; Thu, 17 Oct 2013 09:07:50 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VWicV-00017l-1l; Thu, 17 Oct 2013 09:07:47 +0100 +From: Mark Walters +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search +In-Reply-To: + +References: + +User-Agent: Notmuch/0.15.2+334~gafd5c6a (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Thu, 17 Oct 2013 09:07:46 +0100 +Message-ID: <87ob6ob9rh.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: a3d5a750b9c0cfb97c132851950f5200 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Thu, 17 Oct 2013 08:07:58 -0000 + + +Hi + +I have looked at the whole series and broadly it looks good. However, I +don't know this code so this is not a full review. I do have a few +comments: some of these may be plain wrong in which case my apologies! + +On Wed, 16 Oct 2013, Jani Nikula wrote: + +> This is in preparation of switching to gmime header parsing, but +> arguably converting tabs to spaces rather than question marks is the +> right thing to do anyway. +> --- + +I think it would be worth saying in the commit message that this is only +for text summary output. + +Also why only tabs to spaces but \n to a '?' + +Best wishes + +Mark + + + + +> notmuch-search.c | 4 +++- +> 1 file changed, 3 insertions(+), 1 deletion(-) +> +> diff --git a/notmuch-search.c b/notmuch-search.c +> index d9d39ec..eab314f 100644 +> --- a/notmuch-search.c +> +++ b/notmuch-search.c +> @@ -40,7 +40,9 @@ sanitize_string (const void *ctx, const char *str) +> loop = out = talloc_strdup (ctx, str); +> +> for (; *loop; loop++) { +> - if ((unsigned char)(*loop) < 32) +> + if (*loop == '\t') +> + *loop = ' '; +> + else if ((unsigned char)(*loop) < 32) +> *loop = '?'; +> } +> return out; +> -- +> 1.8.4.rc3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch