Emacs total crash on some HTML files

Bug #935925 reported by Mathieu Lemoine on 2012-02-19
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

nxhtml makes emacs crash to the ground if you try to open a file with this inside or to input this in a file:

<div style="foo- {{ var.val|replace({'"': ''}) }}"</div>

Interesting fact: The crash disapear if you remove the single quotes or if you rename the attribute for something else (e.g. class or name).

This is an excerpt from a TWIG template. Of course, the best would be the support for twig as there is already one for smarty.

I cann't M-x nxhtml-report-bug because emacs crash and I have to kill it.

lborgman (lennart-borgman) wrote :

Thanks Mathieu. Since Emacs crashed totally please send an Emacs bug report for this.

If you want to add TWIG support then please do it and send a patch and I will add it to nXhtml.

Changed in nxhtml:
importance: Undecided → High
status: New → In Progress


Disabling the plugin remove the crash, so I think this is something from the plugin itself. I guess the emacs team will simply tell "don't use buggy plugins" or something along the line (which is the only workaround I found since it seems there is no way to disable nxhtml only for *.twig files)...

I don't have time to check the code to add TWIG support, but will add it to my list of things I want to do one day... :P

lborgman (lennart-borgman) wrote :

Then perhaps you can give details so it is possible to reproduce the crash. Please start with emacs and just nXhtml. You can do that from inside Emacs with:

M-x emacs-Q-nxhtml


Just opened emacs, run emacs-Q-nxhtml, didn't seem to do much apart from displaying:
Started 'emacs -Q --debug-init --load /home/mlemoine/.emacs.d/nxhtml/autostart.el' => nil

Quit emacs, run the aforementioned command, open /tmp/foo.html.twig (non-existent file), and type the line of code I inserted in my first post and there you go ! Impossible to go further than the second single quote.

No message, no dump, no quit, no reaction at all.

lborgman (lennart-borgman) wrote :

I just tried it and it does not hang for me. (It is not correctly handled either, but it is a difficult case.)

I am using the version of nXhtml that are in the repository. Could you please try that?

Brian Carlson (abutilize) wrote :

Reproduction is VERY easy with 2.08

$ emacs --version
GNU Emacs 23.1.1
Copyright (C) 2009 Free Software Foundation, Inc.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

emacs -Q -l ~/.elisp/nxhtml/autostart.el

__TRY__ to add a single quote to the css section of the following html input:

--8<------------------ cut here -------------------- start ----------------->8---
<html xmlns="http://www.w3.org/1999/xhtml">
<h1>It works!</h1>
Try to add a single quote inside the style attribute
<span style="background-color: #DDD;">here</span>
--8<------------------ cut here -------------------- end ----------------->8---

This will cause emacs to freeze and push emacs to using 100% CPU

Brian Carlson (abutilize) wrote :

So after a attempting to get web-vcs to download and failing...I grabbed the repository via bzr...

Once I did this, the bug did not appear. So it has gotten fixed somehow since 2.08 was released.

When is the next stable release slated?

lborgman (lennart-borgman) wrote :

Thanks Brian! (I have not had time to fix the web-vcs problem. It is essentially that the format changes now and then on the website. It was more work than I expected to keep things up to date.)

I have not time table, but I think I can release a new version rather soon, since there are no main problems that are new now.

Changed in nxhtml:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers