From e02fd3da241004ad2e26bfac55715cd87a4ce99f Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 16 Oct 2013 22:00:09 +0300 Subject: [PATCH] [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search --- 56/aa746aa1f2eace437661014faa9bfe50bcdea7 | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 56/aa746aa1f2eace437661014faa9bfe50bcdea7 diff --git a/56/aa746aa1f2eace437661014faa9bfe50bcdea7 b/56/aa746aa1f2eace437661014faa9bfe50bcdea7 new file mode 100644 index 000000000..204dda337 --- /dev/null +++ b/56/aa746aa1f2eace437661014faa9bfe50bcdea7 @@ -0,0 +1,94 @@ +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 4695A431FBF + for ; Wed, 16 Oct 2013 12:00:31 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +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 nSTK87CLosLH for ; + Wed, 16 Oct 2013 12:00:25 -0700 (PDT) +Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com + [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + A9880431FBC for ; Wed, 16 Oct 2013 12:00:22 -0700 + (PDT) +Received: by mail-ee0-f53.google.com with SMTP id t10so586557eei.12 + for ; Wed, 16 Oct 2013 12:00: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:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=0jhZf2PmKZqigaHc2c61VZ4OV+UCWbgw6/2uuPiZmdg=; + b=Kz4scS91bpvglyq6HYMYGsbfYosnD8AgAfN+mHRgetN6mjQJuQPC0eJCTCIUp/hP6k + txH2XHNWGPwD94cAlEg0Jg6vlNwEMJyQmG7zD+r+ienzyR7Ph/1Srse13g/96z2/LcOW + aeEgXZJd0q0a/H2exH7xj3OJtC3g6Nt1n2UsvRV8jA4ZsolGn8W1+0U0QvifWtFaSLTr + v9hnmhv0pn27XyNuVGpw2a7uX/dAZO06w9r6587DkAZHCj+ffjbUNmU3mJlEn3Ul1ghq + z29Os7NbKH/mTtoR9lXL/gKGqarkMTUEujL2CVWtRwO9S/iMTV8P15TsyEk766vFgu/q + Iefw== +X-Gm-Message-State: + ALoCoQnEOrEq8xkg+8znaDTS10VqrpicE5cT3XFVCXIhVFmihJdwIL8mTE/r6N24ktEA75xw+xpO +X-Received: by 10.14.214.136 with SMTP id c8mr6788769eep.6.1381950021607; + Wed, 16 Oct 2013 12:00:21 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + x47sm183065494eea.16.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 16 Oct 2013 12:00:20 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 2/6] cli: sanitize tabs to spaces in notmuch search +Date: Wed, 16 Oct 2013 22:00:09 +0300 +Message-Id: + +X-Mailer: git-send-email 1.8.4.rc3 +In-Reply-To: +References: +In-Reply-To: +References: +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: Wed, 16 Oct 2013 19:00:31 -0000 + +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. +--- + 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 + -- 2.26.2