From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Emacs 23.1.93 pretest Date: Tue, 02 Mar 2010 22:53:05 +0200 Message-ID: <83zl2q30pa.fsf@gnu.org> References: <87pr3rny7e.fsf@stupidchicken.com> <83fx4n122q.fsf@gnu.org> <833a0ndlo0.fsf@gnu.org> <83vddidh73.fsf@gnu.org> <83hbp2cxgx.fsf@gnu.org> <87aauugy1g.fsf@stupidchicken.com> <83eik6co9l.fsf@gnu.org> <87mxyuyvxy.fsf@stupidchicken.com> <87fx4l8mkf.fsf@stupidchicken.com> <831vg5cll1.fsf@gnu.org> <83pr3pb1iu.fsf@gnu.org> <834oky4mkt.fsf@gnu.org> <87635ejy9c.fsf@stupidchicken.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1267563244 9217 80.91.229.12 (2 Mar 2010 20:54:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Mar 2010 20:54:04 +0000 (UTC) Cc: Kenichi Handa , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 02 21:53:58 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmZ6L-0001zV-VX for ged-emacs-devel@m.gmane.org; Tue, 02 Mar 2010 21:53:58 +0100 Original-Received: from localhost ([127.0.0.1]:52266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmZ6L-0008SG-HH for ged-emacs-devel@m.gmane.org; Tue, 02 Mar 2010 15:53:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmZ6G-0008S6-UV for emacs-devel@gnu.org; Tue, 02 Mar 2010 15:53:52 -0500 Original-Received: from [140.186.70.92] (port=57118 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmZ6G-0008Ry-2o for emacs-devel@gnu.org; Tue, 02 Mar 2010 15:53:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmZ6E-0007lK-Uz for emacs-devel@gnu.org; Tue, 02 Mar 2010 15:53:51 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:39752) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmZ6E-0007l8-Ka for emacs-devel@gnu.org; Tue, 02 Mar 2010 15:53:50 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0KYO00J009O3QO00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Tue, 02 Mar 2010 22:52:53 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.228.54.31]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KYO00ICDA04N230@a-mtaout21.012.net.il>; Tue, 02 Mar 2010 22:52:53 +0200 (IST) In-reply-to: <87635ejy9c.fsf@stupidchicken.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:121576 Archived-At: > From: Chong Yidong > Cc: emacs-devel@gnu.org > Date: Tue, 02 Mar 2010 14:53:51 -0500 > > Eli Zaretskii writes: > > > Actually, it turns out it's not ``reshuffling the heap'' that triggers > > the bug, but rather the fact that when we call xmalloc, Emacs might > > relocate buffer text. > > > > IOW, I found the reason for the bug. One of the callers of > > load_charset_map_from_file maintains pointers into buffer text, so > > when that gets relocated, ... you get the idea. > > Could you point out where this happens? Yes, I can, now that I know that myself ;-) The problem was in two places: in emacs_mule_char and in decode_coding_emacs_mule (which calls emacs_mule_char). emacs_mule_char called DECODE_CHAR, which could result in a call to decode_char, which could call load_charset_map_from_file (through load_charset). Both emacs_mule_char and decode_coding_emacs_mule walk through buffer text with pointers, and those need to be fixed-up after the call to load_charset_map_from_file. I replaced the call to DECODE_CHAR with CODING_DECODE_CHAR, which wraps DECODE_CHAR with code that fixes up the pointers to buffer text if a charset map was loaded by DECODE_CHAR. decode_coding_emacs_mule needed a similar fixup for its own pointers to buffer text. This is now fixed in the repository. I think this fixes the original problem; at least my .emacs.desktop file with a Latin-2 character now loads correctly, both in the MS-Windows build and in the MS-DOS build. Perhaps Handa-san could look at the two other callers of DECODE_CHAR in coding.c, and see if they, too, need to be replaced with CODING_DECODE_CHAR.