unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>,  notmuch@notmuchmail.org
Subject: Re: [Patch v4] lib: regexp matching in 'subject' and 'from'
Date: Thu, 09 Feb 2017 18:15:56 +0200	[thread overview]
Message-ID: <m2lgtfwdab.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <87efz8vz0w.fsf@rocinante.cs.unb.ca>

On Thu, Feb 09 2017, David Bremner <david@tethera.net> wrote:

> Jani Nikula <jani@nikula.org> writes:
>
>>
>> Theoretically "/" is an acceptable character in message-ids [1]. Rare,
>> unlikely, but acceptable. Searching for message-id's beginning with "/"
>> would have to use regexps, which would break in all sorts of ways
>> throughout the stack. I don't think there are handy alternatives to
>> "/<regex>/", given the characters that are acceptable in message-ids,
>> but this is something to think about.
>
> Would telling the user to \ escape ( or double /) the initial / be good

a while ago I thought this double // but dismissed it quickly 
(re-searching just for single quote can be useful...) In the rare
cases anyone needs to disable regex processing, imo this \ is the
best idea i've (not) come up with.

some command line testing with(and -out) quoting:

$ printf %s\\n  id:\/some/crazy/message-id
id:/some/crazy/message-id

$ printf %s\\n  "id:\/some/crazy/message-id"
id:\/some/crazy/message-id

$ printf %s\\n  'id:\/some/crazy/message-id'
id:\/some/crazy/message-id


$ printf %s\\n  id:\\/some/crazy/message-id
id:\/some/crazy/message-id

$ printf %s\\n  "id:\\/some/crazy/message-id"
id:\/some/crazy/message-id

$ printf %s\\n  'id:\\/some/crazy/message-id'
id:\\/some/crazy/message-id

so:
$ printf %s\\n  'id:"\/some/crazy/message-id with spaces"'
id:"\/some/crazy/message-id with spaces"


> enough there? This would disable regex processing.  I guess this goes
> back to someone's earlier suggestion.  A third option would be to use
> single quotes there ("id:'/foo'"), but that isn't really consistent with
> either Xapian 
> or usual regex conventions.

$ printf %s\\n 'id:"'\''/foo with spaces ;D'\''"'
id:"'/foo with spaces ;D'"

or, perhaps this is clearer >;)

$ printf %s\\n 'id:"'"'"'/foo with spaces ;D'"'"'"'
id:"'/foo with spaces ;D'"

>
> So I guess my favourite idea ATM is to use id:\/some/crazy/message-id
> FWIW, I don't have any such message ids.
>
>> For example, could the regexp matcher for message-ids first check if the
>> "regexp" is a strict match with "/" and all, and accept those? This
>> might be a reasonable workaround if it can be made to work.
>
> We're building a query, so I think the equivalent is to make an OR, with
> the exact match and the regex posting source. That could be done,
> although I'm a bit uneasy about how this makes the syntax for id:
> different, so id:/foo would be legit, but from:/foo would be an error.
> Maybe the dwim-factor is worth it.
>
> d

  reply	other threads:[~2017-02-09 16:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 13:33 [PATCH] lib: regexp matching in 'subject' and 'from' David Bremner
2016-11-14 21:46 ` [Patch v2] " David Bremner
2017-01-18 20:05   ` Jani Nikula
2017-01-18 21:01     ` David Bremner
2017-01-19 12:16       ` [Patch v3] " David Bremner
2017-01-21  3:27         ` [WIP] " David Bremner
2017-01-21 13:59           ` [Patch v4] " David Bremner
2017-01-25 19:40             ` Tomi Ollila
2017-01-26  2:21               ` David Bremner
2017-01-29 11:23                 ` Jani Nikula
2017-02-05 20:16                   ` Tomi Ollila
2017-02-05 23:28                     ` David Bremner
2017-02-09  3:11                   ` David Bremner
2017-02-09 16:15                     ` Tomi Ollila [this message]
2017-02-10  8:29                     ` Mark Walters
2017-02-11 23:25                       ` David Bremner
2017-01-29 11:06               ` Jani Nikula
2017-01-19 14:27   ` [Patch v2] " David Bremner

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=m2lgtfwdab.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=david@tethera.net \
    --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).