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 31D93429E2E for ; Mon, 3 Feb 2014 11:52:05 -0800 (PST) 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 0bDdN6qkOelq for ; Mon, 3 Feb 2014 11:51:59 -0800 (PST) Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com [74.125.83.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 946CB431FBC for ; Mon, 3 Feb 2014 11:51:59 -0800 (PST) Received: by mail-ee0-f46.google.com with SMTP id c13so3820980eek.19 for ; Mon, 03 Feb 2014 11:51:55 -0800 (PST) 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=YiOooJ8S+StSl6Ci8Gb4VwSwSckzNuXaBtDhOz83PCo=; b=B9eEnmkqmByE7lpx9BZM9cuxCN2/XQpSY7ovVdn3Ezs9JFxyv+SrB2SHbALxLsxT7x gyqRoHkKTOTGK1xZtLWRJ6/FINHGq2aHcyxf93WILe2vANCPRCcncuesxJoouwJckkcE ypxzdQ3le2DiGOL0MKUbvb9PV7Y6urJyLJzxuPbwE5pFyEsAvOiBGciXRbQzg2nvvNGL b85yblA5hjmd6DLZ80WPsrGcW7epGzxD/kOOsDrf4iikPZ6OGThmbVVXdt7PXCH7/tYn MJDKEZHYd9xL6gwwZGWdxCytEwVH9X2gryNC+adMtqvUSsGF0kbaLOFPB683nhS1q0Nw FMMg== X-Gm-Message-State: ALoCoQlnUZhSEm5W+hKmdpwiZp3ZRBk/bN4XBnGktvMk15bwDuhXK0U0zw8+y5F9zZDU6ELQtqGH X-Received: by 10.14.106.193 with SMTP id m41mr5147647eeg.62.1391457115851; Mon, 03 Feb 2014 11:51:55 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id j42sm79872675eep.21.2014.02.03.11.51.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 03 Feb 2014 11:51:55 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v3 1/6] cli: sanitize tabs and newlines to spaces in notmuch search Date: Mon, 3 Feb 2014 21:51:41 +0200 Message-Id: <69cbcc33a4f0701ce39950510ff59c921eee6bc0.1391456555.git.jani@nikula.org> X-Mailer: git-send-email 1.8.5.2 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: Mon, 03 Feb 2014 19:52:05 -0000 Sanitize tabs and newlines to spaces rather than question marks in --output=summary --format=text output. This will also hide any difference in unfolding a header that has been folded with a tab. Our own header parser replaces tabs with spaces, while gmime would retain the tab. --- notmuch-search.c | 4 +++- test/T090-search-output.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 91b5d10..0262eb3 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -41,7 +41,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 == '\n') + *loop = ' '; + else if ((unsigned char)(*loop) < 32) *loop = '?'; } return out; diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh index 5ccfeaf..86544ac 100755 --- a/test/T090-search-output.sh +++ b/test/T090-search-output.sh @@ -388,7 +388,7 @@ add_message "[subject]='two =?ISO-8859-1?Q?line=0A_subject?= headers'" notmuch search id:"$gen_msg_id" | notmuch_search_sanitize >OUTPUT cat <EXPECTED -thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; two line? subject headers (inbox unread) +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; two line subject headers (inbox unread) EOF test_expect_equal_file OUTPUT EXPECTED -- 1.8.5.2