emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus crashes on threads deeper than 333 articles


From: Chong Yidong
Subject: Re: gnus crashes on threads deeper than 333 articles
Date: Sun, 03 Dec 2006 15:36:04 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

Chris Moore <address@hidden> writes:

> I just tried opening a mail folder using nnimap in gnus.
>
> One of the threads in the folder is 834 messages long, and each
> message in the thread is a reply to the previous one which results in
> the thread being 834 messages 'deep'.
>
> The definition of gnus-sort-threads in lisp/gnus/gnus-sum.el does
> this:
>     (let ((max-lisp-eval-depth 5000))
> but it doesn't increase max-specpdl-size.  Maybe it should?
>
> Or maybe it shouldn't impose fixed limits on the maximum allowable
> thread length at all.  A re-implementation using a loop instead of
> recursion should be able to get around this limit.  It's walking the
> thread tree, sorting as it goes.

The attached patch provides a reimplementation of gnus-sort-threads-1
that uses a loop instead of recursion.  It may be a little too
intricate a change to check into Emacs at this point, though.  What do
people think?

*** emacs/lisp/gnus/gnus-sum.el.~1.93.~ 2006-11-24 14:49:06.000000000 -0500
--- emacs/lisp/gnus/gnus-sum.el 2006-12-03 15:25:31.000000000 -0500
***************
*** 4550,4560 ****
            (gnus-delete-line)))))))
  
  (defun gnus-sort-threads-1 (threads func)
!   (sort (mapcar (lambda (thread)
!                 (cons (car thread)
!                       (and (cdr thread)
!                            (gnus-sort-threads-1 (cdr thread) func))))
!               threads) func))
  
  (defun gnus-sort-threads (threads)
    "Sort THREADS."
--- 4550,4569 ----
            (gnus-delete-line)))))))
  
  (defun gnus-sort-threads-1 (threads func)
!   (let* ((superthread (cons nil threads))
!        (stack (list (cons superthread threads)))
!        remaining-threads thread)
!     (while stack
!       (setq remaining-threads (cdr (car stack)))
!       (if remaining-threads
!         (progn (setq thread (car remaining-threads))
!                (setcdr (car stack) (cdr remaining-threads))
!                (if (cdr thread)
!                    (push (cons thread (cdr thread)) stack)))
!       (setq thread (caar stack))
!       (setcdr thread (sort (cdr thread) func))
!       (pop stack)))
!     (cdr superthread)))
  
  (defun gnus-sort-threads (threads)
    "Sort THREADS."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]