From: Jani Nikula Date: Thu, 17 Oct 2013 11:47:18 +0000 (+0300) Subject: Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b126d1b559c6db05192f10ea36edac4fc5930c6f;p=notmuch-archives.git Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search --- diff --git a/0e/17d9125342573a219bd5a1188d83ffd2531e98 b/0e/17d9125342573a219bd5a1188d83ffd2531e98 new file mode 100644 index 000000000..10ca35979 --- /dev/null +++ b/0e/17d9125342573a219bd5a1188d83ffd2531e98 @@ -0,0 +1,136 @@ +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 BEF6F431FB6 + for ; Thu, 17 Oct 2013 04:47:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 XbcF1TyV2AfO for ; + Thu, 17 Oct 2013 04:47:23 -0700 (PDT) +Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com + [209.85.215.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 30E29431FAE + for ; Thu, 17 Oct 2013 04:47:23 -0700 (PDT) +Received: by mail-ea0-f177.google.com with SMTP id f15so979633eak.8 + for ; Thu, 17 Oct 2013 04:47:21 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=B970QI6SRCnOKyS28e/6ZhW7bPLP3SiQz7jxrPQwsLs=; + b=VsBNlZZKc2e+FfLWwGQmFs2J8bsSl8gTlzvBnmBzTnrUt3DGmOFnPGzddZZ8g6mJwO + CETZWCH7nRTApxuP8XfAxi6aKfxMQbJx5lrZ08HEnRvmVstJzTawvv/UD1UXGgjQeImZ + QTtBoV34Ndv3BnFRdNmzXZB5ieLdPOOIYCAY4IDIjpIOBAoH3FjN5tVtsqOC9jAhTaw2 + 3bxhYn1h78qPBAKSGJct3gagUmwWhBY3INFDoSAf0AaJsI36U3fyxVdBrgxmP/sMd+Vx + ffq3sVOaj3vOjtipnWfr+68yiaZzxZyaecTiMYhQace1HQs1bKD0/ajEW8Spbns8OLxj + uNuA== +X-Gm-Message-State: + ALoCoQlamfU1Ha3IaBISHMYecc0aSHOTBzObwt6CrmKbOmGfc1difjw17Vpfw7AkYFL/ffOYq5+Z +X-Received: by 10.15.42.140 with SMTP id u12mr3821278eev.54.1382010440637; + Thu, 17 Oct 2013 04:47:20 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id i1sm191863352eeg.0.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 17 Oct 2013 04:47:19 -0700 (PDT) +From: Jani Nikula +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search +In-Reply-To: <87ob6ob9rh.fsf@qmul.ac.uk> +References: + + <87ob6ob9rh.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.16+97~g6878b0b (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Thu, 17 Oct 2013 14:47:18 +0300 +Message-ID: <87k3hcqfuh.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +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 11:47:34 -0000 + +On Thu, 17 Oct 2013, Mark Walters wrote: +> 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! + +Thanks for the review! + +> 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. + +Agreed. + +> Also why only tabs to spaces but \n to a '?' + +The notmuch header parser converts the tabs in header folding to spaces, +gmime keeps them as tabs. AFAICT that is the only difference between +headers indexed by notmuch and gmime, and causes tests to fail. So we do +the tabs to spaces conversion here to produce same output from cli. This +patch just does the minimal change required for tests to pass; other +changes might be good too, but they were not relevant for this series. + +BR, +Jani. + +> +> 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