From: Jani Nikula <jani@nikula.org>
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 [thread overview]
Message-ID: <69cbcc33a4f0701ce39950510ff59c921eee6bc0.1391456555.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1391456555.git.jani@nikula.org>
In-Reply-To: <cover.1391456555.git.jani@nikula.org>
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 <<EOF >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
next prev parent reply other threads:[~2014-02-03 19:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 19:51 [PATCH v3 0/6] lib: replace the message header parser with gmime Jani Nikula
2014-02-03 19:51 ` Jani Nikula [this message]
2014-02-03 19:51 ` [PATCH v3 2/6] cli: refactor reply from guessing Jani Nikula
2014-02-03 19:51 ` [PATCH v3 3/6] util: make sanitize string available in string util for reuse Jani Nikula
2014-03-08 11:32 ` David Bremner
2014-03-09 13:19 ` David Bremner
2014-02-03 19:51 ` [PATCH v3 4/6] cli: sanitize the received header before scanning for replies Jani Nikula
2014-02-03 20:46 ` Austin Clements
2014-03-19 16:44 ` [PATCH] " Jani Nikula
2014-03-26 0:33 ` David Bremner
2014-02-03 19:51 ` [PATCH v3 5/6] lib: replace the header parser with gmime Jani Nikula
2014-02-03 21:31 ` Austin Clements
2014-02-03 19:51 ` [PATCH v3 6/6] lib: parse messages only once Jani Nikula
2014-02-03 21:40 ` Austin Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69cbcc33a4f0701ce39950510ff59c921eee6bc0.1391456555.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).