Re: [PATCH] emacs: Modify notmuch-show-get-message-id to return message-id unprefixed with "id:".

Subject: Re: [PATCH] emacs: Modify notmuch-show-get-message-id to return message-id unprefixed with "id:".

Date: Fri, 28 Oct 2011 13:06:09 +0200

To: Jameson Graef Rollins, Thomas Schwinge

Cc: Notmuch Mail

From: Daniel Schoepe


On Wed, 26 Oct 2011 19:52:59 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> In point of fact, do we need these quotes around message IDs at all?
> Can message IDs have characters that would need to be escaped for the
> shell?

Message ID syntax is defined in RFC 2822[1]:
> message-id      =       "Message-ID:" msg-id CRLF
> 
> in-reply-to     =       "In-Reply-To:" 1*msg-id CRLF
> 
> references      =       "References:" 1*msg-id CRLF
> 
> msg-id          =       [CFWS] "<" id-left "@" id-right ">" [CFWS]
> 
> id-left         =       dot-atom-text / no-fold-quote / obs-id-left
> 
> id-right        =       dot-atom-text / no-fold-literal / obs-id-right
> 
> no-fold-quote   =       DQUOTE *(qtext / quoted-pair) DQUOTE
>
> no-fold-literal =       "[" *(dtext / quoted-pair) "]"

And since
> quoted-pair     =       ("\" text) / obs-qp
>
> text            =       %d1-9 /         ; Characters excluding CR and LF
>                        %d11 /
>                        %d12 /
>                        %d14-127 /
>                        obs-text

It can theoretically include pretty much any character, including
quotes, if they are properly escaped. Hence, the query parser would have
to take that into account, but surrounding them by quotes probably isn't
useful anyway.

As far passing things to the shell goes:

> atext           =       ALPHA / DIGIT / ; Any character except controls,
>                         "!" / "#" /     ;  SP, and specials.
>                         "$" / "%" /     ;  Used for atoms
>                         "&" / "'" /
>                         "*" / "+" /
>                         "-" / "/" /
>                         "=" / "?" /
>                         "^" / "_" /
>                         "`" / "{" /
>                         "|" / "}" /
>                         "~"
> 
> atom            =       [CFWS] 1*atext [CFWS]
> 
> dot-atom        =       [CFWS] dot-atom-text [CFWS]
> 
> dot-atom-text   =       1*atext *("." 1*atext)

So, they can contain things like "$foo@$bar", which will be mangled if
passed to the shell, even with double quotes.

[1] http://tools.ietf.org/html/rfc2822#section-3.6.4

Cheers,
Daniel
part-000.sig (application/pgp-signature)

Thread: