From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/64059 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.pretest.bugs,gmane.emacs.gnus.general Subject: Re: gnus crashes on threads deeper than 333 articles Date: Sun, 03 Dec 2006 15:36:04 -0500 Message-ID: <87wt58emyz.fsf@stupidchicken.com> References: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1165178173 24053 80.91.229.10 (3 Dec 2006 20:36:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Dec 2006 20:36:13 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, ding@gnus.org Original-X-From: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Sun Dec 03 21:36:10 2006 Return-path: Envelope-to: gebp-emacs-pretest-bug@gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1Gqy4D-0004Ct-BA for gebp-emacs-pretest-bug@gmane.org; Sun, 03 Dec 2006 21:36:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqy4C-0000uu-VY for gebp-emacs-pretest-bug@gmane.org; Sun, 03 Dec 2006 15:36:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gqy45-0000sG-H8 for emacs-pretest-bug@gnu.org; Sun, 03 Dec 2006 15:35:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gqy43-0000oW-4p for emacs-pretest-bug@gnu.org; Sun, 03 Dec 2006 15:35:56 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqy42-0000oG-S9 for emacs-pretest-bug@gnu.org; Sun, 03 Dec 2006 15:35:54 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gqy42-0000Mo-U5 for emacs-pretest-bug@gnu.org; Sun, 03 Dec 2006 15:35:55 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id CD4814E45A; Sun, 3 Dec 2006 15:36:04 -0500 (EST) Original-To: Chris Moore In-Reply-To: (Chris Moore's message of "Thu\, 30 Nov 2006 16\:15\:59 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-BeenThere: emacs-pretest-bug@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for CVS Emacs." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Errors-To: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.pretest.bugs:15417 gmane.emacs.gnus.general:64059 Archived-At: Chris Moore 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."