Gnus development mailing list
 help / color / mirror / Atom feed
From: Matthias Andree <matthias.andree@gmx.de>
To: Roger <wenrui@gmail.com>
Cc: ding@gnus.org
Subject: Re: [PATCH] Match lone lines in imap efficiently
Date: Thu, 19 May 2011 10:55:41 +0200	[thread overview]
Message-ID: <4DD4DB0D.7050307@gmx.de> (raw)
In-Reply-To: <1305767995-27472-1-git-send-email-wenrui@gmail.com>

Am 19.05.2011 03:19, schrieb Roger:
> When some email with large number of recipients is hit, Gnus
> will hit error "Stack overflow in regexp matcher"
> ---
>  lisp/nnimap.el |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lisp/nnimap.el b/lisp/nnimap.el
> index 6882ed6..967cb36 100644
> --- a/lisp/nnimap.el
> +++ b/lisp/nnimap.el
> @@ -190,7 +190,7 @@ textual parts.")
>    (let (article bytes lines size string)
>      (block nil
>        (while (not (eobp))
> -	(while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)"))
> +	(while (not (looking-at "^\\* [0-9]+ FETCH[[:space:](]*UID \\([0-9]+\\)"))
>  	  (delete-region (point) (progn (forward-line 1) (point)))
>  	  (when (eobp)
>  	    (return)))
> @@ -1904,7 +1904,7 @@ textual parts.")
>    (let (article bytes)
>      (block nil
>        (while (not (eobp))
> -	(while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)"))
> +	(while (not (looking-at "^\\* [0-9]+ FETCH[[:space:](]*UID \\([0-9]+\\)"))
>  	  (delete-region (point) (progn (forward-line 1) (point)))
>  	  (when (eobp)
>  	    (return)))

While it may fix the immediate problem, it looks pretty bogus to me and
will break IMAP functionality with some servers, depending on response
format.

I think dumb regexps aren't the right approach for IMAP parsing,
instead, the reply should be properly parsed into keywords.

1. RFC3501 demands that there is exactly one SP between the FETCH
keyword and the sequence set.

2. The open parenthesis isn't optional before UID - it must be somewhere
between FETCH and UID.

3. Other keywords can come before the UID, see p. 61 in RFC3501. Your
patch breaks that.



  reply	other threads:[~2011-05-19  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19  1:19 Roger
2011-05-19  8:55 ` Matthias Andree [this message]
2011-05-30 18:26 ` Lars Magne Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DD4DB0D.7050307@gmx.de \
    --to=matthias.andree@gmx.de \
    --cc=ding@gnus.org \
    --cc=wenrui@gmail.com \
    /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.
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 NNTP newsgroup(s).