From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.bugs Subject: bug#1179: Emacs on Windows hangs displaying unibyte strings Date: Thu, 16 Oct 2008 16:52:07 +0200 Message-ID: Reply-To: Juanma Barranquero , 1179@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224169861 4105 80.91.229.12 (16 Oct 2008 15:11:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Oct 2008 15:11:01 +0000 (UTC) To: Bug-Gnu-Emacs Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 16 17:11:52 2008 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 1KqUVu-0000mk-Ce for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Oct 2008 17:11:46 +0200 Original-Received: from localhost ([127.0.0.1]:52694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqUUp-0000b2-FW for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Oct 2008 11:10:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqUUl-0000ap-O2 for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 11:10:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqUUl-0000aa-58 for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 11:10:35 -0400 Original-Received: from [199.232.76.173] (port=35874 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqUUl-0000aX-2a for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 11:10:35 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:58424) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KqUUj-0005j8-UE for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 11:10:34 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9GFA0rp032080; Thu, 16 Oct 2008 08:10:00 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m9GF03uI029102; Thu, 16 Oct 2008 08:00:03 -0700 X-Loop: don@donarmstrong.com Resent-From: "Juanma Barranquero" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , don@donarmstrong.com Resent-Date: Thu, 16 Oct 2008 15:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1179 X-Emacs-PR-Package: emacs,w32 X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122416873527745 (code B ref -1); Thu, 16 Oct 2008 15:00:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 16 Oct 2008 14:52:15 +0000 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9GEqBJb027739 for ; Thu, 16 Oct 2008 07:52:12 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqUCx-00057W-Bl for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 10:52:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqUCv-00057K-Mv for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 10:52:10 -0400 Original-Received: from [199.232.76.173] (port=44272 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqUCv-00057H-Gs for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 10:52:09 -0400 Original-Received: from mail-gx0-f10.google.com ([209.85.217.10]:56414) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KqUCu-0001fK-V8 for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2008 10:52:09 -0400 Original-Received: by gxk3 with SMTP id 3so8436401gxk.18 for ; Thu, 16 Oct 2008 07:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=eqDIk+FyjTWCOp35ChINPJmEnnhIlGgsSTzu3L8ijAE=; b=IeV6XESsh1QfLH12T0cfDlIkTuMh9iu+KF1MOCLMw/2B/huZyaxWH95OaQR+/io3Ku 76XCyChXq1LLy+WFYmp20I+OpZ6vZNR49AU7Jka5PjW6xn7+sqw/Aoa71fVe7WWvK+JF 4UYlPTQmiJEfOq4y1noo0RgSWZooQABPzarJQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=LoUqOMxAAvFVrU2uv/b4W6Lqc21i2xKZWPBDXsV/rlwOIZ3ikrPq86UEcpdMGxJ7pl mD1FLc/3G3cdQpgLwhbv/4jjpLBxaFyfJ8MpFuOgpDJM1iWlJ0uvlSJxeE65UZ4XjGcA FF/Z+dUxGgtIWrW8rc+AGueUzqt7t8VPgm7ew= Original-Received: by 10.100.142.4 with SMTP id p4mr3632822and.23.1224168727696; Thu, 16 Oct 2008 07:52:07 -0700 (PDT) Original-Received: by 10.100.13.13 with HTTP; Thu, 16 Oct 2008 07:52:07 -0700 (PDT) Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 16 Oct 2008 11:10:35 -0400 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:21540 Archived-At: X-Debbugs-No-Ack: yes Package: emacs,w32 Version: 23.0.60 This bug is perhaps a variant of #872, as it involves several common elements: - Seems a Windows-specific thing - (setq unibyte-display-via-language-environment t) - (set-buffer-multibyte nil) - Optimized vs. non-optimized builds do behave diferently though the result is a bit different: Emacs hangs instead of crashing. The initial bug I was looking at is that w32-list-locales, when run on a Spanish edition of Windows XP, produces the following output: 1025 ARA \301rabe (Arabia Saud\355) 1026 BGR B\372lgaro 1027 CAT Catal\341n 1028 CHT Chino (Taiw\341n) 1029 CSY Checo 1030 DAN Dan\351s 1031 DEU Alem\341n (Alemania) etc., so obviously there's some kind of unibyte/multibyte problem: the output of w32-get-locale-info is a unibyte "Windows ANSI" string, while the resulting buffer is multibyte, iso-latin-1-dos. That led me to try the following .emacs: ;;; .emacs ;;; (setq unibyte-display-via-language-environment t) (defun my-list-locales-bug () ;; ;; this is w32-list-locales almost verbatim ;; (interactive) (if (null w32-valid-locales) (setq w32-valid-locales (w32-get-valid-locale-ids))) (switch-to-buffer-other-window (get-buffer-create "*Supported Locales*")) ;;;;;;;;;;;;;;;;;;;;;;;;;; (set-buffer-multibyte nil) ;;;;;;;;;;;;;;;;;;;;;;;;;; (erase-buffer) (insert "LCID\tAbbrev\tFull name\n\n") (insert (mapconcat '(lambda (x) (format "%d\t%s\t%s" x (w32-get-locale-info x) (w32-get-locale-info x t))) w32-valid-locales "\n")) (insert "\n") (goto-char (point-min))) ;;; .emacs ends here ;;; Then, after M-x my-list-locales-bug, Emacs hangs. - With the default Courier New font, it hangs once the cursor moves over a non-ASCII char or the buffer scrolls, prompting a redisplay. It uses around 50% CPU. The bug does not show on non-optimized builds. - With DejaVu Sans Mono, it hangs immediately, and does not use CPU. This happens with optimized and non-optimized builds. This is a backtrace after C-c in the Courier New case: Quit (expect signal SIGINT when the program is resumed) (gdb) thread 1 [Switching to thread 1 (thread 860.0x370)]#0 0x7c91e4f4 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll (gdb) bt #0 0x7c91e4f4 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll #1 0x77ef597f in ?? () from C:\WINDOWS\system32\gdi32.dll #2 0x77efd880 in UnrealizeObject () from C:\WINDOWS\system32\gdi32.dll #3 0x011f765a in w32_fill_rect (f=0x2e42200, hdc=0x30010fd8, pix=33554435, lprect=0x82e7dc) at w32term.c:393 #4 0x011f8127 in w32_draw_relief_rect (f=0x2e42200, left_x=136, top_y=560, right_x=167, bottom_y=575, width=20810504, raised_p=0, top_p=1, bot_p=1, left_p=0, right_p=0, clip_rect=0x82e86c) at w32term.c:1634 #5 0x011f841e in x_draw_glyph_string_box (s=0x82eac0) at w32term.c:1758 #6 0x011ff527 in x_draw_glyph_string (s=0x82eac0) at w32term.c:2266 #7 0x01056ccd in draw_glyphs (w=0x313da00, x=176, row=0x331f428, area=TEXT_AREA, start=9, end=14, hl=DRAW_NORMAL_TEXT, overlaps=0) at xdisp.c:20504 #8 0x0105a309 in x_write_glyphs (start=0x3461120, len=5) at xdisp.c:21913 #9 0x0115f93a in update_window_line (w=0x313da00, vpos=7, mouse_face_overwritten_p=0x82ef7c) at dispnew.c:4594 #10 0x0115fedc in update_window (w=0x313da00, force_p=0) at dispnew.c:4310 #11 0x01162596 in update_window_tree (w=0x313da00, force_p=0) at dispnew.c:4003 #12 0x011624fc in update_window_tree (w=0x313d800, force_p=0) at dispnew.c:4001 #13 0x01163d7c in update_frame (f=0x2e42200, force_p=0, inhibit_hairy_id_p=0) at dispnew.c:3930 #14 0x01048abf in redisplay_internal (preserve_echo_area=) at xdisp.c:11906 #15 0x0108b8b9 in read_char (commandflag=1, nmaps=2, maps=0x82fb70, prev_event=47896577, used_mouse_menu=0x82fc34, end_time=0x0) at keyboard.c:2649 #16 0x0108ff0a in read_key_sequence (keybuf=0x82fcd4, bufsize=30, prompt=47896577, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9343 #17 0x01093061 in command_loop_1 () at keyboard.c:1621 #18 0x010191e6 in internal_condition_case (bfun=0x1092dd3 , handlers=47960329, hfun=0x108a056 ) at eval.c:1511 #19 0x010894fb in command_loop_2 () at keyboard.c:1338 #20 0x01019290 in internal_catch (tag=47956401, func=0x10894d8 , arg=47896577) at eval.c:1247 #21 0x01089e9b in command_loop () at keyboard.c:1317 #22 0x0108a1ef in recursive_edit_1 () at keyboard.c:942 #23 0x0108a35a in Frecursive_edit () at keyboard.c:1004 #24 0x01002cdc in main (argc=1, argv=0xa941c0) at emacs.c:1728 This is a backtrace after C-c in the DejaVu Sans Mono case: Quit (expect signal SIGINT when the program is resumed) (gdb) thread 1 [Switching to thread 1 (thread 2912.0x24c)]#0 0x7c91e4f4 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll (gdb) bt #0 0x7c91e4f4 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll #1 0x7c91df2c in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\system32\ntdll.dll #2 0x7c809574 in KERNEL32!CreateFileMappingA () from C:\WINDOWS\system32\kernel32.dll #3 0x7e3995f9 in USER32!GetLastInputInfo () from C:\WINDOWS\system32\user32.dll #4 0x7e3996a8 in USER32!MsgWaitForMultipleObjects () from C:\WINDOWS\system32\user32.dll #5 0x01099b18 in sys_select (nfds=1, rfds=0x82f970, wfds=0x0, efds=0x0, timeout=0x82f968) at w32proc.c:1270 #6 0x0106861c in wait_reading_process_output (time_limit=30, microsecs=0, read_kbd=-1, do_display=1, wait_for_cell=47896577, wait_proc=0x0, just_wait_proc=0) at process.c:4816 #7 0x0115966f in sit_for (timeout=240, reading=1, do_display=1) at dispnew.c:6637 #8 0x0108c366 in read_char (commandflag=1, nmaps=2, maps=0x82fb70, prev_event=47896577, used_mouse_menu=0x82fc34, end_time=0x0) at keyboard.c:2892 #9 0x0108ff0a in read_key_sequence (keybuf=0x82fcd4, bufsize=30, prompt=47896577, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9343 #10 0x01093061 in command_loop_1 () at keyboard.c:1621 #11 0x010191e6 in internal_condition_case (bfun=0x1092dd3 , handlers=47960329, hfun=0x108a056 ) at eval.c:1511 #12 0x010894fb in command_loop_2 () at keyboard.c:1338 #13 0x01019290 in internal_catch (tag=47956401, func=0x10894d8 , arg=47896577) at eval.c:1247 #14 0x01089e9b in command_loop () at keyboard.c:1317 #15 0x0108a1ef in recursive_edit_1 () at keyboard.c:942 #16 0x0108a35a in Frecursive_edit () at keyboard.c:1004 #17 0x01002cdc in main (argc=1, argv=0xa941c0) at emacs.c:1728