From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Emacs crashes accidentally Date: Fri, 08 Sep 2006 11:12:46 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1157728610 26811 80.91.229.2 (8 Sep 2006 15:16:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Sep 2006 15:16:50 +0000 (UTC) Cc: herberteuler@hotmail.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 08 17:16:49 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GLi65-00051P-6I for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2006 17:16:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLi64-0001ec-Fr for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2006 11:16:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GLi2C-0002eG-9l for emacs-devel@gnu.org; Fri, 08 Sep 2006 11:12:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GLi2B-0002cj-Jh for emacs-devel@gnu.org; Fri, 08 Sep 2006 11:12:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GLi2B-0002cL-Aa for emacs-devel@gnu.org; Fri, 08 Sep 2006 11:12:47 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GLi2n-0003Xc-Sm for emacs-devel@gnu.org; Fri, 08 Sep 2006 11:13:25 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1GLi2A-0008Ml-KT; Fri, 08 Sep 2006 11:12:46 -0400 Original-To: Andreas Schwab In-reply-to: (message from Andreas Schwab on Fri, 08 Sep 2006 10:49:16 +0200) 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 Xref: news.gmane.org gmane.emacs.devel:59568 Archived-At: Looks like a GC violation. See the comment for message_nolog: This may GC (insert may run before/after change hooks), so the buffer M must NOT point to a Lisp string. */ You're right. In fact, that's not the only thing in strout that is likely to cause lossage if GC relocates the string. print_string is supposed to be the function to use for a Lisp string. So I think the bug is that print_string calls strout in a case where that is not safe. Does this fix it? *** print.c 08 Sep 2006 07:47:26 -0400 1.227 --- print.c 08 Sep 2006 10:37:18 -0400 *************** *** 497,506 **** else chars = SBYTES (string); ! /* strout is safe for output to a frame (echo area) or to print_buffer. */ ! strout (SDATA (string), ! chars, SBYTES (string), ! printcharfun, STRING_MULTIBYTE (string)); } else { --- 497,524 ---- else chars = SBYTES (string); ! if (EQ (printcharfun, Qt)) ! { ! int nbytes = SBYTES (string); ! char *buffer; ! ! /* Output to echo area. Copy the string contents so that ! relocation by GC does not cause trouble. */ ! USE_SAFE_ALLOCA; ! ! SAFE_ALLOCA (buffer, char *, nbytes); ! bcopy (SDATA (string), buffer, nbytes); ! ! strout (buffer, chars, SBYTES (string), ! printcharfun, STRING_MULTIBYTE (string)); ! ! SAFE_FREE (); ! } ! else ! /* strout is safe for output to print_buffer. */ ! strout (SDATA (string), ! chars, SBYTES (string), ! printcharfun, STRING_MULTIBYTE (string)); } else {