GNU bug report logs - #11841
24.1; emacs hangs when opening cpp file with mixed eol styles

Previous Next

Packages: emacs, cc-mode;

Reported by: Vadim K <vadimsks <at> gmail.com>

Date: Mon, 2 Jul 2012 04:34:02 UTC

Severity: important

Merged with 11891, 13046

Found in versions 23.4, 24.1

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 11841 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 11841 <at> debbugs.gnu.org, Vadim K <vadimsks <at> gmail.com>
Subject: Re: bug#11841: 24.1;	emacs hangs when opening cpp file with mixed
	eol styles
Date: Sat, 7 Jul 2012 21:10:11 +0000
Hi, Eli.

On Mon, Jul 02, 2012 at 07:42:11PM +0300, Eli Zaretskii wrote:
> > Date: Sun, 1 Jul 2012 20:51:43 -0400
> > From: Vadim K <vadimsks <at> 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);
[ ..... ]

> Lisp Backtrace:
> "forward-comment" (0x8890b8)
> "c-backward-sws" (0x889318)
[ .... ]

Just as an observation, (forward-comment -1) doesn't move back over a ^M.
I think it should.  This might be the cause of the observed bad
behaviour.

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 12 years and 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.