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: allocate_string_data memory corruption Date: Tue, 24 Jan 2006 22:26:06 -0500 Message-ID: <878xt5q981.fsf@stupidchicken.com> References: <87vewha2zl.fsf@stupidchicken.com> <87wtgxdr9p.fsf@stupidchicken.com> <873bjkha3d.fsf@pacem.orebokech.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138159767 21768 80.91.229.2 (25 Jan 2006 03:29:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2006 03:29:27 +0000 (UTC) Cc: Romain Francoise , emacs-devel@gnu.org, Ken Raeburn , "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 25 04:29:24 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 1F1bJp-0004sY-Fe for ged-emacs-devel@m.gmane.org; Wed, 25 Jan 2006 04:27:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1bMY-0003Q9-85 for ged-emacs-devel@m.gmane.org; Tue, 24 Jan 2006 22:30:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F1bL8-0002zM-QX for emacs-devel@gnu.org; Tue, 24 Jan 2006 22:28:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F1bL6-0002yc-RS for emacs-devel@gnu.org; Tue, 24 Jan 2006 22:28:58 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1bL6-0002yW-Ls for emacs-devel@gnu.org; Tue, 24 Jan 2006 22:28:56 -0500 Original-Received: from [18.95.6.100] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F1bIQ-0001Na-Gd for emacs-devel@gnu.org; Tue, 24 Jan 2006 22:26:10 -0500 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 5175C1E42E3; Tue, 24 Jan 2006 22:26:06 -0500 (EST) Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Thu, 19 Jan 2006 22:46:03 -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 Xref: news.gmane.org gmane.emacs.devel:49510 Archived-At: >> Please remind me why we don't use SYNC_INPUT by default > > ... it supposedly may delay the processing of C-g since we then > processs signals with a "polling" model (if we get stuck in a loop > with no QUIT and no BLOCK_INPUT we won't ever process the C-g. It > seems to be that even without SYNC_INPUT, under X11, a C-g is not > process until we reach a QUIT, so the difference is not clear to > me). How about this idea... The problem is that the X signal handler (XTread_socket) does stuff that can clobber the heap. Richard's objection to SYNC_INPUT is that C-g may not be read in some loops. But Stefan pointed out that under X, C-g is not processed until we read a QUIT. My proposal is to make signal handling work like SYNC_INPUT when we are running in X (i.e., when read_socket_hook is NULL). The C-g behavior is no worse than before, and the terminal behavior remains the same as before. We lose nothing, while resolving the memory clobberage bugs. This change would look something like this: *** emacs/src/keyboard.c.~1.847.~ 2006-01-20 10:05:43.000000000 -0500 --- emacs/src/keyboard.c 2006-01-24 22:12:26.000000000 -0500 *************** *** 6897,6903 **** EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); #ifndef SYNC_INPUT ! handle_async_input (); #endif #ifdef BSD4_1 --- 6897,6904 ---- EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); #ifndef SYNC_INPUT ! if (!read_socket_hook) ! handle_async_input (); #endif #ifdef BSD4_1 *** emacs/src/lisp.h.~1.547.~ 2005-12-11 15:37:36.000000000 -0500 --- emacs/src/lisp.h 2006-01-24 22:13:41.000000000 -0500 *************** *** 1830,1835 **** --- 1830,1837 ---- Fthrow (Vthrow_on_input, Qt); \ Fsignal (Qquit, Qnil); \ } \ + else if (!read_socket_hook) \ + handle_async_input (); \ } while (0) #endif /* not SYNC_INPUT */