[PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Sat Jul 17 04:55:18 PDT 2010


Hi Michal.

On Fri, 16 Jul 2010 13:32:35 +0200, Michal Sojka <sojkam1 at fel.cvut.cz> wrote:
> The following message (146 kB) breaks the emacs interface:
> http://rtime.felk.cvut.cz/~sojka/notmuch/notmuch-wash-tidy-citations-stack-overflow.txt
> 
> An attempt to view the message produced message
> "notmuch-wash-tidy-citations: Stack overflow in regexp matcherq" and
> it was not possible to work with the message.
> 
> I tracked the problem down to the regexp search, which probably
> attempts to match a very big piece of text (several lines). I changed
> the regexp to only match a single line. The result is probably slower,
> but doesn't produce the error.

I have 2 messages that cause emacs segfault. Both are notifications from
svn. One is 37933 lines, 1,2M. Another is huge - 963179 lines, 31M. I
believe the root cause is the same for both segfaults.

Your patch does not fix the problem, unfortunately. Can you advise how
to debug this segfault? Build emacs with debug symbols and get backtrace
from gdb? Debug notmuch lisp code (how?)? Enable some verbose logging in
emacs?

Regards,
  Dmitry

> ---
>  emacs/notmuch-wash.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
> index 26a3f88..051dd17 100644
> --- a/emacs/notmuch-wash.el
> +++ b/emacs/notmuch-wash.el
> @@ -218,7 +218,7 @@ Perform four transformations on the message body:
>  
>    ;; Insert a blank line before a citation if there isn't one.
>    (goto-char (point-min))
> -  (while (re-search-forward "\\(^[^>]+\\)\n>" nil t)
> +  (while (re-search-forward "\\(^[^>][^\n]+\\)\n>" nil t)
>      (replace-match "\\1\n\n>"))
>  
>    ;; Insert a blank line after a citation if there isn't one.
> -- 
> 1.7.1.3.g75e44
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list