unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: add known broken test for message-id with embedded spaces.
@ 2023-05-27 17:20 David Bremner
  2023-07-09 15:12 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: David Bremner @ 2023-05-27 17:20 UTC (permalink / raw)
  To: notmuch

According to my reading of RFC5322, there is an obsolete syntax for
Message-Id which permits folding whitespace (i.e. to be removed /
ignored by parsers). In [1] Paul Wise observed that notmuch removed
whitespace on indexing, but does not do any corresponding
normalization of queries. Mark the latter as a bug by adding a failing
test.

[1]: id:20230409044143.4041560-1-pabs3@bonedaddy.net
---
 test/T080-search.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/T080-search.sh b/test/T080-search.sh
index a3f0dead..515eb88f 100755
--- a/test/T080-search.sh
+++ b/test/T080-search.sh
@@ -34,6 +34,12 @@ add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"
 output=$(notmuch search id:${gen_msg_id} | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
 
+test_begin_subtest "Message-Id with spaces"
+test_subtest_known_broken
+add_message '[id]="message id@example.com"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
+output=$(notmuch search --output=messages id:"message id@example.com")
+test_expect_equal "$output" "messageid@example.com"
+
 test_begin_subtest "Search by mid:"
 add_message '[subject]="search by mid"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
 output=$(notmuch search mid:${gen_msg_id} | notmuch_search_sanitize)
@@ -132,6 +138,7 @@ thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-sübjéct (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)
+thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; Message-Id with spaces (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by mid (inbox unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)
 thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)
-- 
2.39.2
\r

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test: add known broken test for message-id with embedded spaces.
  2023-05-27 17:20 [PATCH] test: add known broken test for message-id with embedded spaces David Bremner
@ 2023-07-09 15:12 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2023-07-09 15:12 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> According to my reading of RFC5322, there is an obsolete syntax for
> Message-Id which permits folding whitespace (i.e. to be removed /
> ignored by parsers). In [1] Paul Wise observed that notmuch removed
> whitespace on indexing, but does not do any corresponding
> normalization of queries. Mark the latter as a bug by adding a failing
> test.

Applied to master. I'm curious how many such message ids there are in
the wild. It is not particularly hard to fix this in the query
parser(s), but it is a bit tedious (e.g. a new field processor would
need to be added for the id prefix in the infix query processor).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-09 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 17:20 [PATCH] test: add known broken test for message-id with embedded spaces David Bremner
2023-07-09 15:12 ` David Bremner

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).