From: Eli Zaretskii <eliz@gnu.org>
To: Vadim K <vadimsks@gmail.com>, Alan Mackenzie <acm@muc.de>
Cc: 11841@debbugs.gnu.org
Subject: bug#11841: 24.1; emacs hangs when opening cpp file with mixed eol styles
Date: Mon, 02 Jul 2012 19:42:11 +0300 [thread overview]
Message-ID: <83lij25d3w.fsf@gnu.org> (raw)
In-Reply-To: <CACwrxC5dLkYhsmyXxfyKBK-Pnmbwk12pyL0Kuqv=6fhFOf+0LA@mail.gmail.com>
> Date: Sun, 1 Jul 2012 20:51:43 -0400
> From: Vadim K <vadimsks@gmail.com>
>
> 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 <eval_sub>,
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 <eval_sub>,
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 <eval_sub>,
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 <funcall_nil>) 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 <Ffuncall>,
nargs=2, args=0x88bcf0, handlers=54007858,
hfun=0x1158ec5 <safe_eval_handler>) 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 <redisplay_window_0>, arg=56188421, handlers=53992294,
hfun=0x117d706 <redisplay_window_error>) 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 <command_loop_1>,
handlers=54058490, hfun=0x1004ce0 <cmd_error>) 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 <command_loop_2>, 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)
next prev parent reply other threads:[~2012-07-02 16:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-02 0:51 bug#11841: 24.1; emacs hangs when opening cpp file with mixed eol styles Vadim K
2012-07-02 16:42 ` Eli Zaretskii [this message]
2012-07-02 18:22 ` Stefan Monnier
2012-07-07 21:10 ` Alan Mackenzie
2012-07-07 21:53 ` Stefan Monnier
2012-07-08 2:58 ` Eli Zaretskii
2012-07-08 14:50 ` Stefan Monnier
2012-07-08 15:34 ` Alan Mackenzie
2012-07-08 23:07 ` Stefan Monnier
2012-07-15 17:02 ` Alan Mackenzie
2012-07-15 22:56 ` Stefan Monnier
2012-07-20 21:10 ` Alan Mackenzie
2012-07-22 9:54 ` Stefan Monnier
2012-07-25 20:58 ` Vadim K
2012-12-11 19:24 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lij25d3w.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=11841@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=vadimsks@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.