From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el] Date: Tue, 13 Dec 2005 17:27:04 -0500 Message-ID: <87bqzkiqfb.fsf@stupidchicken.com> References: <20123679.1132565664852.JavaMail.www@wwinf1507> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1134513103 15332 80.91.229.2 (13 Dec 2005 22:31:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2005 22:31:43 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 13 23:31:40 2005 Return-path: Original-Received: from [199.232.75.2] (helo=lists.gnu.org) by ciao.gmane.org with esmtp (Exim 4.43) id 1EmIgA-0006ad-MV for ged-emacs-devel@m.gmane.org; Tue, 13 Dec 2005 23:31:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EmIgi-0006Dc-Fv for ged-emacs-devel@m.gmane.org; Tue, 13 Dec 2005 17:32:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EmIcX-0003Ca-34 for emacs-devel@gnu.org; Tue, 13 Dec 2005 17:27:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EmIcW-0003C5-81 for emacs-devel@gnu.org; Tue, 13 Dec 2005 17:27:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EmIcW-0003C0-55 for emacs-devel@gnu.org; Tue, 13 Dec 2005 17:27:40 -0500 Original-Received: from [18.95.6.185] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EmIeS-00064q-JP; Tue, 13 Dec 2005 17:29:40 -0500 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 30E0F1E4242; Tue, 13 Dec 2005 17:27:06 -0500 (EST) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Mon, 05 Dec 2005 20:42:48 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-Broken-Reverse-DNS: no host name found for IP address 199.232.75.2 Xref: news.gmane.org gmane.emacs.devel:47642 Archived-At: "Richard M. Stallman" writes: > I reproduced the error and also found that Emacs hangs in the built-in > function `prin1-to-string' when it tries to print the value the > function `widget-create' returns, which contains a lot of circular > references in a deeply nested list. If I don't interrupt the hang, > after some time, the function fails with a "Memory exhausted" message. > Notice that the widgets are correctly created in the "*Open Recent*" > buffer. This is only the edebug prin1 function that hangs. > > When I set the value of `edebug-print-level' to 10 instead of the > default value of 50, Emacs no more hangs. > > Maybe there is a bug in the prin1-to-string function? Unfortunately I > don't know how to fix it. > > Can someone investigate that bug? David Ponce said he can't. I think the trouble is that the way print_preprocess "follows" nested lists, while handling print_depth, is slightly different from the way print_object does it. Because of this, it is possible for print_preprocess to give up sooner than print_object would. An object could thus fail to be put into Vprint_number_table, even though print_object later is later called for it. There is a quick but inelegant way to cover up this bug: *** emacs/src/print.c.~1.214.~ 2005-11-10 08:45:06.000000000 -0500 --- emacs/src/print.c 2005-12-13 17:17:49.000000000 -0500 *************** *** 1313,1319 **** /* Give up if we go so deep that print_object will get an error. */ /* See similar code in print_object. */ ! if (print_depth >= PRINT_CIRCLE) return; /* Avoid infinite recursion for circular nested structure --- 1313,1319 ---- /* Give up if we go so deep that print_object will get an error. */ /* See similar code in print_object. */ ! if (print_depth > 2 * PRINT_CIRCLE) return; /* Avoid infinite recursion for circular nested structure