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

Daniel Schoepe daniel at schoepe.org
Fri Oct 28 04:06:09 PDT 2011


On Wed, 26 Oct 2011 19:52:59 -0700, Jameson Graef Rollins <jrollins at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20111028/5c5e7499/attachment.pgp>


More information about the notmuch mailing list