[Patch v4] lib: regexp matching in 'subject' and 'from'

David Bremner david at tethera.net
Sat Feb 11 15:25:18 PST 2017

Mark Walters <markwalters1009 at gmail.com> writes:

> Hi
> Broadly I like the backslash escaping option. Two thoughts: can any
> fields (from/subject/message-id) start with a "\" anyway? I think not
> but thought it worth checking.

>From and subject are probablistic xapian fields, so punctuation is
essentially ignored by the query parser. That being said, nothing
prevents subjects from starting with /.  According to my reading of
rfc5322, conforming message ids cannot contain any of '()<>[]:;@\,."'

> Secondly, message-id is often round-tripped, that is output from notmuch
> and then fed back to notmuch. Do we want to escape the output as above
> before printing in any cases? My view is that if we output the
> message-id prefixed with "id:" then we should escape it (which applies
> with --output=messages --format=text), but if we don't print the "id:"
> part then we shouldn't (eg with --format=json). A similar thing would
> apply to emacs: if it is a normal stash then escape the id, but if it is
> a "bare stash" then do not.

Yes that sounds about right. Do we actually output from and subject with
prefixes attached to them? I have the feeling not.

> Actually, one more thing: it would be a shame to block or significantly
> delay the series for such a corner case.

If it's _only_ the output of notmuch search --output=messages, then I
guess it's doable.


More information about the notmuch mailing list