From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#5984: Crash displaying composed characters Date: Tue, 20 Apr 2010 20:29:29 +0300 Message-ID: <83vdbm3udi.fsf@gnu.org> References: <831vea5fjh.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1271786380 20064 80.91.229.12 (20 Apr 2010 17:59:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Apr 2010 17:59:40 +0000 (UTC) To: lekktu@gmail.com, 5984@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 20 19:59:39 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1O4HjW-0003N1-EB for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 19:59:38 +0200 Original-Received: from localhost ([127.0.0.1]:43589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4HjV-0000CW-WE for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 13:59:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4HjI-00008D-Uf for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 13:59:24 -0400 Original-Received: from [140.186.70.92] (port=60054 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4HjH-00007X-Dz for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 13:59:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4HjF-00075U-7B for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 13:59:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45487) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4HjF-00075Q-5T for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 13:59:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O4HGt-0000K2-OM; Tue, 20 Apr 2010 13:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Apr 2010 17:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5984 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5984-submit@debbugs.gnu.org id=B5984.12717845711196 (code B ref 5984); Tue, 20 Apr 2010 17:30:03 +0000 Original-Received: (at 5984) by debbugs.gnu.org; 20 Apr 2010 17:29:31 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4HGM-0000JF-R3 for submit@debbugs.gnu.org; Tue, 20 Apr 2010 13:29:31 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4HGK-0000JA-LH for 5984@debbugs.gnu.org; Tue, 20 Apr 2010 13:29:29 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0L1600900QAPJ700@a-mtaout21.012.net.il> for 5984@debbugs.gnu.org; Tue, 20 Apr 2010 20:29:22 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.237.174]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L1600AUJR8X1K00@a-mtaout21.012.net.il>; Tue, 20 Apr 2010 20:29:22 +0300 (IDT) In-reply-to: <831vea5fjh.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 20 Apr 2010 13:30:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org 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:36374 Archived-At: > Date: Tue, 20 Apr 2010 18:06:58 +0300 > From: Eli Zaretskii > Cc: 5984@debbugs.gnu.org >=20 > > From: Juanma Barranquero > > Date: Tue, 20 Apr 2010 15:42:16 +0200 > > Cc:=20 > >=20 > > Package: emacs > > Version: 24.0.50 > >=20 > > Discussed in the thread of bug#5973 > >=20 > > Juanma > >=20 > >=20 > >=20 > >=20 > > Breakpoint 1, w32_abort () at w32fns.c:7349 > > 7349 button =3D MessageBox (NULL, > > (gdb) bt > > #0 w32_abort () at w32fns.c:7349 > > #1 0x012be7c9 in temp_set_point_both (buffer=3D0x34b6e00, charpo= s=3D32, > > bytepos=3D33) at intervals.c:1944 > > #2 0x012772b4 in autocmp_chars (cft_element=3D50852182, charpos= =3D29, > > bytepos=3D29, limit=3D31, win=3D0x350b400, face=3D0x4e8c100, stri= ng=3D49838082) > > at composite.c:1002 > > #3 0x01278591 in composition_reseat_it (cmp_it=3D0x88db74, charp= os=3D29, > > bytepos=3D29, endpos=3D32, w=3D0x350b400, face=3D0x4e8c100, strin= g=3D49838082) > > at composite.c:1147 > > #4 0x01069fcb in next_element_from_buffer (it=3D0x88d6f8) at xdi= sp.c:6834 > > #5 0x01066642 in get_next_display_element (it=3D0x88d6f8) at xdi= sp.c:5828 >=20 > I see the same crash in Emacs 23.1.96, which means two things: >=20 > . It has nothing to do with bidi code (phew!) >=20 > . It is much more urgent to fix Here's the analysis of what causes this crash: . The defadvice displays the value of END, the second argument to narrow-to-region. When the defadvice is evaluated, Edebug displays the result, and attempts to interpret it as a character. . As the result, the following text is inserted into the " *Echo Area 0*" buffer, with the purpose of displaying it in the echo area: Result: 784 (#o1420, #x310, 0=CC=90) The funny character before the right parenthesis is composed from u+0310 (COMBINING CANDRABINDU), and ASCII `0' (the digit zero). = I presume that some composition rule causes us to display a bare u+0310 composed like that. . Emacs then enters redisplay to display the echo area. As part of redisplay, autocmp_chars is called, and it records the values of point in character and byte units: EMACS_INT pt =3D PT, pt_byte =3D PT_BYTE; At this point, pt is 32 and pt_byte is 33, which is consistent with the multibyte text we have in the buffer, as shown above. . Further down, autocmp_chars calls the value of auto-composition-function: =09 if (NILP (LGSTRING_ID (gstring))) =09 { =09 Lisp_Object args[6]; =09 args[0] =3D Vauto_composition_function; =09 args[1] =3D AREF (elt, 2); =09 args[2] =3D pos; =09 args[3] =3D make_number (to); =09 args[4] =3D font_object; =09 args[5] =3D string; =09 gstring =3D safe_call (6, args); =09 } . The call to auto-composition-function loads uni-combining.el. An= d because force-load-messages is non-nil, that displays the 2 messages Loading lisp/international/uni-combining.el (source)... Loading lisp/international/uni-combining.el (source)...done . Now the " *Echo Area0*" buffer holds a totally different text, unbeknownst to autocmp_chars, which still passes the old values 3= 2 and 33 to TEMP_SET_PT_BOTH: =09 if (NILP (string)) =09 TEMP_SET_PT_BOTH (pt, pt_byte); =09 return unbind_to (count, gstring); . temp_set_pt_both uses BUF_ZV and BUF_ZV_BYTE to validate its argument, but now BUF_ZV and BUF_ZV_BYTE correspond to the text "Loading ...", which has an entirely different length and contents, and the validation fails. Therefore, temp_set_pt_both aborts. One kludgy way of fixing this would be to bind force-load-messages to nil around the call to auto-composition-function. But that sounds to= o harsh: after all, whoever sets that variable, actually wants to see all these messages. Another way is to force the "Loading..." messages use the second echo area buffer. Do we have ways to do something like that? Ideas are welcome.