On Sat, 2023-04-08 at 08:42 -0300, David Bremner wrote:

> did you test this with a message-id with spaces in it?
> the quoting is a delicate.

You are correct that the quoting for this was wrong, as it was also
wrong in the code before my patch and I just copied that, however...

I noticed that when notmuch stores the Message-ID in the Xapian
database, it strips the spaces, so messages with spaces in the
Message-ID are not found unless the id: search has no spaces also.

After switching from testing using id: to subject: and reading the
manual page I was able to find the correct quoting for spaces in $mid,
but I also added the space removals for the thread query.

Then I figured I should test with double quote characters and that blew
up in my face too, so I added double quote doubling to workaround that.

Then I noticed that you can put parentheses inside a quoted query and
that changes the meaning of the query but I couldn't find any way to
prevent an arbitrary Message-Id from inserting parentheses into the
query. Also notmuch converts Message-Id (test)@hostname to just
@hostname in the Xapian database. I think that right now I am not sure
that re-implementing all the idiosyncrasies of notmuch queries and
Message-Id munging within notmuch-mutt is the way to go, especially
since Message-Id fields that intersect with notmuch features are rare.

So I think that it would be good if there were a library for notmuch
query construction that would take care of all the different quoting
levels, Message-Id munging etc. This could then get language bindings
so that notmuch based tools and MUAs could use them for interactive
graphical query construction. Also maybe Xapian needs or has a way to
construct queries without serialising them to a text string and the
notmuch query construction library I propose could base itself on that.

Anyway, will send an updated patch series including space/quote fixing.

-- 
bye,
pabs

https://bonedaddy.net/pabs3/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to