[PATCH v2 1/7] cli: sanitize tabs and newlines to spaces in notmuch search
Jani Nikula
jani at nikula.org
Sat Nov 30 07:33:50 PST 2013
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/search-output | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/notmuch-search.c b/notmuch-search.c
index 7c973b3..11cd6ee 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/search-output b/test/search-output
index 5ccfeaf..86544ac 100755
--- a/test/search-output
+++ b/test/search-output
@@ -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.4.2
More information about the notmuch
mailing list