unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Schoepe <daniel@schoepe.org>
To: Jameson Graef Rollins <jrollins@finestructure.net>,
	Thomas Schwinge <thomas@schwinge.name>
Cc: Notmuch Mail <notmuch@notmuchmail.org>
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	[thread overview]
Message-ID: <87r51xe5pa.fsf@gilead.invalid> (raw)
In-Reply-To: <87ehxzb0xg.fsf@servo.finestructure.net>

[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  parent reply	other threads:[~2011-10-28 11:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <id:87ipnzd4ds.fsf@zancas.localnet>
2011-10-09  3:47 ` [PATCH] NEWS: add notes about emacs improvements and reply formating cleanup Jameson Graef Rollins
2011-10-09  3:55   ` Jameson Graef Rollins
2011-10-09 17:54     ` Thomas Schwinge
2011-10-09 22:35       ` Jameson Graef Rollins
2011-10-09 22:35     ` [PATCH] emacs: Modify notmuch-show-get-message-id to return message-id unprefixed with "id:" Jameson Graef Rollins
2011-10-10 23:46       ` Thomas Schwinge
2011-10-18 15:16         ` Jameson Graef Rollins
2011-10-27  2:52         ` Jameson Graef Rollins
2011-10-27 13:52           ` Tomi Ollila
2011-10-28 11:06           ` Daniel Schoepe [this message]
2011-10-28 11:21             ` Tomi Ollila
2011-11-12 14:52       ` David Bremner
2011-11-12 21:42         ` Jameson Graef Rollins
2011-10-09 11:31   ` [PATCH] NEWS: add notes about emacs improvements and reply formating cleanup 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=87r51xe5pa.fsf@gilead.invalid \
    --to=daniel@schoepe.org \
    --cc=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.org \
    --cc=thomas@schwinge.name \
    /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).