From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#11841: 24.1; emacs hangs when opening cpp file with mixed eol styles Date: Sat, 7 Jul 2012 21:10:11 +0000 Message-ID: <20120707211010.GA13024@acm.acm> References: <83lij25d3w.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1341695647 9955 80.91.229.3 (7 Jul 2012 21:14:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 7 Jul 2012 21:14:07 +0000 (UTC) Cc: 11841@debbugs.gnu.org, Vadim K To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 07 23:14:06 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 1SncKL-0002np-KA for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jul 2012 23:14:05 +0200 Original-Received: from localhost ([::1]:54793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SncKK-0004BW-G3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Jul 2012 17:14:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SncKH-0004BB-Eg for bug-gnu-emacs@gnu.org; Sat, 07 Jul 2012 17:14:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SncKF-00006r-SH for bug-gnu-emacs@gnu.org; Sat, 07 Jul 2012 17:14:01 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SncKC-000062-V0; Sat, 07 Jul 2012 17:13:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SncP8-0006HF-9E; Sat, 07 Jul 2012 17:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 07 Jul 2012 21:19:02 +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.134169592424104 (code B ref 11841); Sat, 07 Jul 2012 21:19:02 +0000 Original-Received: (at 11841) by debbugs.gnu.org; 7 Jul 2012 21:18:44 +0000 Original-Received: from localhost ([127.0.0.1]:55243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SncOp-0006Gi-8m for submit@debbugs.gnu.org; Sat, 07 Jul 2012 17:18:43 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:55200 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SncOm-0006Ga-Fa for 11841@debbugs.gnu.org; Sat, 07 Jul 2012 17:18:41 -0400 Original-Received: (qmail 32150 invoked by uid 3782); 7 Jul 2012 21:13:33 -0000 Original-Received: from acm.muc.de (pD951A77C.dip.t-dialin.net [217.81.167.124]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 07 Jul 2012 23:13:31 +0200 Original-Received: (qmail 828 invoked by uid 1000); 7 Jul 2012 21:10:11 -0000 Content-Disposition: inline In-Reply-To: <83lij25d3w.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:61702 Archived-At: 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 > > 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).