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#11841: 24.1; emacs hangs when opening cpp file with mixed eol styles Date: Mon, 02 Jul 2012 19:42:11 +0300 Message-ID: <83lij25d3w.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1341247368 7324 80.91.229.3 (2 Jul 2012 16:42:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2012 16:42:48 +0000 (UTC) Cc: 11841@debbugs.gnu.org To: Vadim K , Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 02 18:42:45 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sljhz-0000XQ-2t for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2012 18:42:43 +0200 Original-Received: from localhost ([::1]:35153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sljhy-00019c-3p for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2012 12:42:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sljht-00019A-TQ for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2012 12:42:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sljho-0004CM-GW for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2012 12:42:37 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sljhh-0004AS-MH; Mon, 02 Jul 2012 12:42:25 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sljm9-0000bK-Ln; Mon, 02 Jul 2012 12:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 02 Jul 2012 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11841 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 11841-submit@debbugs.gnu.org id=B11841.13412476182300 (code B ref 11841); Mon, 02 Jul 2012 16:47:01 +0000 Original-Received: (at 11841) by debbugs.gnu.org; 2 Jul 2012 16:46:58 +0000 Original-Received: from localhost ([127.0.0.1]:42875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sljm5-0000b2-LM for submit@debbugs.gnu.org; Mon, 02 Jul 2012 12:46:58 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:36001) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sljm2-0000au-G6 for 11841@debbugs.gnu.org; Mon, 02 Jul 2012 12:46:56 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0M6J00000KX8TA00@a-mtaout23.012.net.il> for 11841@debbugs.gnu.org; Mon, 02 Jul 2012 19:42:16 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6J000X2L2FJBC0@a-mtaout23.012.net.il>; Mon, 02 Jul 2012 19:42:16 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61497 Archived-At: > Date: Sun, 1 Jul 2012 20:51:43 -0400 > From: Vadim K > > Emacs hangs forever with 100% cpu usage when I'm trying to open a > specific cpp file (see attached bad.cpp). The bad.cpp file has > Windows end of line style (0D 0A) everywhere except in the line next > to the last one. Inconsistent EOL format is not the problem, it is just the trigger. The problem seems to be that the C Mode is unable to process a buffer where some lines end in a ^M^J (a.k.a. CRLF) instead of a mere LF (newline). To see that, make the EOL format of the test file consistently CRLF, then do this: emacs -Q M-x find-file-literally RET bad.cpp RET M-x normal-mode Emacs will hang. I attached a debugger and produced the backtrace below. By doing "finish" until it hanged, I found out that it infloops inside c-backward-sws. HTH. #0 0x010e6192 in Fforward_comment (count=-4) at syntax.c:2257 2257 count1 = XINT (count); (gdb) bt #0 0x010e6192 in Fforward_comment (count=-4) at syntax.c:2257 #1 0x01036fa0 in Ffuncall (nargs=2, args=0x8890b4) at eval.c:2820 #2 0x011217b8 in exec_byte_code (bytestr=55905377, vector=56389925, maxdepth=28, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #3 0x01037ec9 in funcall_lambda (fun=54714693, nargs=0, arg_vector=0x889318) at eval.c:3052 #4 0x010373a7 in Ffuncall (nargs=1, args=0x889314) at eval.c:2869 #5 0x011217b8 in exec_byte_code (bytestr=78719425, vector=56727821, maxdepth=12, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #6 0x01037ec9 in funcall_lambda (fun=56418309, nargs=0, arg_vector=0x889568) at eval.c:3052 #7 0x010373a7 in Ffuncall (nargs=1, args=0x889564) at eval.c:2869 #8 0x011217b8 in exec_byte_code (bytestr=56747153, vector=56729493, maxdepth=20, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #9 0x01120d72 in Fbyte_code (bytestr=56747153, vector=56729493, maxdepth=20) at bytecode.c:423 #10 0x01035176 in eval_sub (form=54295206) at eval.c:2173 #11 0x010326cb in internal_catch (tag=54281082, func=0x103479b , arg=54295206) at eval.c:1090 #12 0x0112200c in exec_byte_code (bytestr=56747425, vector=54052669, maxdepth=24, args_template=54007834, nargs=0, args=0x0) at bytecode.c:965 #13 0x01037ec9 in funcall_lambda (fun=54716845, nargs=2, arg_vector=0x889af8) at eval.c:3052 #14 0x010373a7 in Ffuncall (nargs=3, args=0x889af4) at eval.c:2869 #15 0x011217b8 in exec_byte_code (bytestr=56796849, vector=79242501, maxdepth=36, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #16 0x01120d72 in Fbyte_code (bytestr=56796849, vector=79242501, maxdepth=36) at bytecode.c:423 #17 0x01035176 in eval_sub (form=54249310) at eval.c:2173 #18 0x010326cb in internal_catch (tag=54280842, func=0x103479b , arg=54249310) at eval.c:1090 #19 0x0112200c in exec_byte_code (bytestr=56814689, vector=56344581, maxdepth=108, args_template=54007834, nargs=0, args=0x0) at bytecode.c:965 #20 0x01037ec9 in funcall_lambda (fun=54717941, nargs=3, arg_vector=0x88a0e8) at eval.c:3052 #21 0x010373a7 in Ffuncall (nargs=4, args=0x88a0e4) at eval.c:2869 #22 0x011217b8 in exec_byte_code (bytestr=57055425, vector=56474525, maxdepth=24, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #23 0x01120d72 in Fbyte_code (bytestr=57055425, vector=56474525, maxdepth=24) at bytecode.c:423 #24 0x01035176 in eval_sub (form=57289462) at eval.c:2173 #25 0x010326cb in internal_catch (tag=55802314, func=0x103479b , arg=57289462) at eval.c:1090 #26 0x0112200c in exec_byte_code (bytestr=57055489, vector=54719949, maxdepth=8, args_template=54007834, nargs=0, args=0x0) at bytecode.c:965 #27 0x01037ec9 in funcall_lambda (fun=56474701, nargs=0, arg_vector=0x88a668) at eval.c:3052 #28 0x010373a7 in Ffuncall (nargs=1, args=0x88a664) at eval.c:2869 #29 0x011217b8 in exec_byte_code (bytestr=79061969, vector=79266485, maxdepth=20, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #30 0x01037ec9 in funcall_lambda (fun=79266565, nargs=1, arg_vector=0x88a8c8) at eval.c:3052 #31 0x010373a7 in Ffuncall (nargs=2, args=0x88a8c4) at eval.c:2869 #32 0x011217b8 in exec_byte_code (bytestr=20931777, vector=20932029, maxdepth=36, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #33 0x01037ec9 in funcall_lambda (fun=20931749, nargs=3, arg_vector=0x88ab38) at eval.c:3052 #34 0x010373a7 in Ffuncall (nargs=4, args=0x88ab34) at eval.c:2869 #35 0x011217b8 in exec_byte_code (bytestr=20927449, vector=20927621, maxdepth=20, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #36 0x01037ec9 in funcall_lambda (fun=20927405, nargs=3, arg_vector=0x88ad98) at eval.c:3052 #37 0x010373a7 in Ffuncall (nargs=4, args=0x88ad94) at eval.c:2869 #38 0x011217b8 in exec_byte_code (bytestr=79036049, vector=78949733, maxdepth=16, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #39 0x01037ec9 in funcall_lambda (fun=78949797, nargs=3, arg_vector=0x88aff8) at eval.c:3052 #40 0x010373a7 in Ffuncall (nargs=4, args=0x88aff4) at eval.c:2869 #41 0x011217b8 in exec_byte_code (bytestr=20925777, vector=20925829, maxdepth=16, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #42 0x01037ec9 in funcall_lambda (fun=20925717, nargs=2, arg_vector=0x88b38c) at eval.c:3052 #43 0x010373a7 in Ffuncall (nargs=3, args=0x88b388) at eval.c:2869 #44 0x01035f49 in funcall_nil (nargs=3, args=0x88b388) at eval.c:2337 #45 0x010363b2 in run_hook_with_args (nargs=3, args=0x88b388, funcall=0x1035f31 ) at eval.c:2526 #46 0x01035fc1 in Frun_hook_with_args (nargs=3, args=0x88b388) at eval.c:2387 #47 0x01036d0c in Ffuncall (nargs=4, args=0x88b384) at eval.c:2802 #48 0x011217b8 in exec_byte_code (bytestr=20397313, vector=20941677, maxdepth=16, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #49 0x01120d72 in Fbyte_code (bytestr=20397313, vector=20941677, maxdepth=16) at bytecode.c:423 #50 0x01035176 in eval_sub (form=20941630) at eval.c:2173 #51 0x01032c02 in internal_lisp_condition_case (var=54191898, bodyform=20941630, handlers=20941702) at eval.c:1287 #52 0x01122073 in exec_byte_code (bytestr=20941241, vector=20941405, maxdepth=32, args_template=54007834, nargs=0, args=0x0) at bytecode.c:980 #53 0x01037ec9 in funcall_lambda (fun=20941213, nargs=2, arg_vector=0x88b968) at eval.c:3052 #54 0x010373a7 in Ffuncall (nargs=3, args=0x88b964) at eval.c:2869 #55 0x011217b8 in exec_byte_code (bytestr=20940809, vector=20940933, maxdepth=40, args_template=54007834, nargs=0, args=0x0) at bytecode.c:784 #56 0x01037ec9 in funcall_lambda (fun=20940781, nargs=1, arg_vector=0x88bcf4) at eval.c:3052 #57 0x010373a7 in Ffuncall (nargs=2, args=0x88bcf0) at eval.c:2869 #58 0x0103304a in internal_condition_case_n (bfun=0x103693f , nargs=2, args=0x88bcf0, handlers=54007858, hfun=0x1158ec5 ) at eval.c:1455 #59 0x01158f61 in safe_call (nargs=2, args=0x88bcf0) at xdisp.c:2411 #60 0x01158fa3 in safe_call1 (fn=55803050, arg=2008) at xdisp.c:2430 #61 0x0115c003 in handle_fontified_prop (it=0x88c9d0) at xdisp.c:3594 #62 0x0115b0b5 in handle_stop (it=0x88c9d0) at xdisp.c:3158 #63 0x01169ddb in next_element_from_buffer (it=0x88c9d0) at xdisp.c:7836 #64 0x01165b23 in get_next_display_element (it=0x88c9d0) at xdisp.c:6501 #65 0x011910d0 in display_line (it=0x88c9d0) at xdisp.c:19224 #66 0x01186bbf in try_window (window=56188421, pos=..., flags=1) at xdisp.c:16217 #67 0x01184448 in redisplay_window (window=56188421, just_this_one_p=0) at xdisp.c:15743 #68 0x0117d759 in redisplay_window_0 (window=56188421) at xdisp.c:13813 #69 0x01032e1c in internal_condition_case_1 ( bfun=0x117d727 , arg=56188421, handlers=53992294, hfun=0x117d706 ) at eval.c:1371 #70 0x0117d6f6 in redisplay_windows (window=56188421) at xdisp.c:13793 #71 0x0117b62f in redisplay_internal () at xdisp.c:13366 #72 0x0117880e in redisplay () at xdisp.c:12575 #73 0x0100884a in read_char (commandflag=1, nmaps=2, maps=0x88fa00, prev_event=54007834, used_mouse_menu=0x88fb2c, end_time=0x0) at keyboard.c:2452 #74 0x0101c5f6 in read_key_sequence (keybuf=0x88fc30, bufsize=30, prompt=54007834, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9338 #75 0x01005aca in command_loop_1 () at keyboard.c:1450 #76 0x01032d0c in internal_condition_case (bfun=0x10054d8 , handlers=54058490, hfun=0x1004ce0 ) at eval.c:1333 #77 0x0100511c in command_loop_2 (ignore=54007834) at keyboard.c:1155 #78 0x010326cb in internal_catch (tag=54048322, func=0x10050f9 , arg=54007834) at eval.c:1090 #79 0x010050d4 in command_loop () at keyboard.c:1134 #80 0x0100469e in recursive_edit_1 () at keyboard.c:754 #81 0x010049c0 in Frecursive_edit () at keyboard.c:818 #82 0x010027eb in main (argc=2, argv=0xce1938) at emacs.c:1693 Lisp Backtrace: "forward-comment" (0x8890b8) "c-backward-sws" (0x889318) "c-at-macro-vsemi-p" (0x889568) "byte-code" (0x889740) "c-crosses-statement-barrier-p" (0x889af8) "byte-code" (0x889ce0) "c-beginning-of-statement-1" (0x88a0e8) "byte-code" (0x88a2c0) "c-beginning-of-decl-1" (0x88a668) "c-font-lock-enclosing-decls" (0x88a8c8) "font-lock-fontify-keywords-region" (0x88ab38) "font-lock-default-fontify-region" (0x88ad98) "c-font-lock-fontify-region" (0x88aff8) "font-lock-fontify-region" (0x88b38c) "run-hook-with-args" (0x88b388) "byte-code" (0x88b560) "jit-lock-fontify-now" (0x88b968) "jit-lock-function" (0x88bcf4)