From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.emacs.bugs Subject: dired.c fails to gc protect lisp object (patch included) Date: Sun, 11 Mar 2007 19:53:37 -0400 Message-ID: <20070311235337.GA9566@brightrain.aerifal.cx> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jgZe/MVqb4R23kNC" X-Trace: sea.gmane.org 1173656739 26723 80.91.229.12 (11 Mar 2007 23:45:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Mar 2007 23:45:39 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 12 00:45:33 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HQXjI-0007c1-QH for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Mar 2007 00:45:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HQXjt-0000zt-90 for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Mar 2007 18:46:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HQXjO-0000DC-UQ for bug-gnu-emacs@gnu.org; Sun, 11 Mar 2007 19:45:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HQXjO-0000Bi-2O for bug-gnu-emacs@gnu.org; Sun, 11 Mar 2007 19:45:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HQXjN-0000BX-PI for bug-gnu-emacs@gnu.org; Sun, 11 Mar 2007 18:45:37 -0500 Original-Received: from brightrain.aerifal.cx ([216.12.86.13]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HQXim-0001P8-B2 for bug-gnu-emacs@gnu.org; Sun, 11 Mar 2007 19:45:00 -0400 Original-Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1HQXr7-0002Ue-00 for bug-gnu-emacs@gnu.org; Sun, 11 Mar 2007 23:53:37 +0000 Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-detected-kernel: Linux 2.4-2.6 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15623 Archived-At: --jgZe/MVqb4R23kNC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline i was experiencing random crashes because file_name_completion (in dired.c) does not protect the "name" object from garbage collection. the attached patch seems to fix it. i'm using emacs-unicode-2 but this might apply to other versions as well. ~rich felker --jgZe/MVqb4R23kNC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dired-gcpro.diff" Index: dired.c =================================================================== RCS file: /sources/emacs/emacs/src/dired.c,v retrieving revision 1.104.4.17 diff -u -r1.104.4.17 dired.c --- dired.c 26 Jan 2007 06:15:08 -0000 1.104.4.17 +++ dired.c 11 Mar 2007 23:39:11 -0000 @@ -521,6 +521,7 @@ for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++) { int inner_count = SPECPDL_INDEX (); + struct gcpro gcpro1; BLOCK_INPUT; d = opendir (SDATA (Fdirectory_file_name (encoded_dir))); @@ -665,6 +666,7 @@ } else name = make_string (dp->d_name, len); + GCPRO1(name); /* Test the predicate, if any. */ @@ -673,7 +675,10 @@ Lisp_Object decoded; decoded = Fexpand_file_name (DECODE_FILE (name), dirname); if (NILP (call1 (predicate, decoded))) - continue; + { + UNGCPRO; + continue; + } } /* Suitably record this match. */ @@ -736,6 +741,7 @@ matchsize++; bestmatchsize = matchsize; } + UNGCPRO; } /* This closes the directory. */ bestmatch = unbind_to (inner_count, bestmatch); --jgZe/MVqb4R23kNC Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-gnu-emacs mailing list bug-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs --jgZe/MVqb4R23kNC--