unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations
@ 2010-07-16 11:32 Michal Sojka
  2010-07-17 11:55 ` Dmitry Kurochkin
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Sojka @ 2010-07-16 11:32 UTC (permalink / raw)
  To: notmuch

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.
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations
  2010-07-16 11:32 [PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations Michal Sojka
@ 2010-07-17 11:55 ` Dmitry Kurochkin
  2010-07-18 15:00   ` Michal Sojka
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kurochkin @ 2010-07-17 11:55 UTC (permalink / raw)
  To: Michal Sojka, notmuch

Hi Michal.

On Fri, 16 Jul 2010 13:32:35 +0200, Michal Sojka <sojkam1@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations
  2010-07-17 11:55 ` Dmitry Kurochkin
@ 2010-07-18 15:00   ` Michal Sojka
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Sojka @ 2010-07-18 15:00 UTC (permalink / raw)
  To: Dmitry Kurochkin, notmuch

Hi Dmitry,

On Sat, 17 Jul 2010, Dmitry Kurochkin wrote:
> I have 2 messages that cause emacs segfault.

My patch didn't fix a segfault but stack overflow which was reported by
emacs in its *Messages* buffer without crashing.

> 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?

I'm more Emacs user then developer so I cannot give you much detailed
information. First, try to check
http://mid.gmane.org/87pr0t5h1q.fsf@yoom.home.cworth.org and Emacs
bug#6214. There may by a fix your problem.


> Debug notmuch lisp code (how?)? Enable some verbose logging in emacs?

To debug elisp code I open the source in Emacs, move the point to the
function I'm interested in and press C-u C-M-x. This instruments the
function code so that the next time the function is invoked, elisp
debugger appears and you can execute the function step by step and
inspect variables.

Maybe, some Emacs guru can give you a better advice.

Bye
Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-18 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16 11:32 [PATCH] emacs: Fix stack overflow in notmuch-wash-tidy-citations Michal Sojka
2010-07-17 11:55 ` Dmitry Kurochkin
2010-07-18 15:00   ` Michal Sojka

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).