bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7172: emacs 23.2; xml.el: xml-parse-file hangs when DOCTYPE element


From: Jose Marino
Subject: bug#7172: emacs 23.2; xml.el: xml-parse-file hangs when DOCTYPE element names contain _ (underscore)
Date: Thu, 07 Oct 2010 11:07:52 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100928 Lanikai/3.1.4

In a DOCTYPE construction, whenever there's an ELEMENT name with an underscore in its name, function xml-parse-file makes emacs become unresponsive and use 100% cpu. Emacs recovers nicely with C-g but no error is printed.

To reproduce this behavior I set up these two simple xml files:

------------ output --------------
$ cat example-good.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
   <!ELEMENT EXAMPLE EMPTY>
]>
<EXAMPLE>
</EXAMPLE>

$ cat example-bad.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
   <!ELEMENT EXAM_PLE EMPTY>
]>
<EXAM_PLE>
</EXAM_PLE>
------------ output --------------

Then from emacs I run:
(xml-parse-file "example-good.xml")
Which as expected produces:
((EXAMPLE nil "
"))

But when I do the same for the other file:
(xml-parse-file "example-bad.xml")
No output is produced and emacs becomes unresponsive.

Attaching strace to the running emacs process prints:
brk(0x267b000)                          = 0x267b000
brk(0x269d000)                          = 0x269d000
brk(0x2637000)                          = 0x2637000
brk(0x2659000)                          = 0x2659000
brk(0x267b000)                          = 0x267b000
brk(0x269d000)                          = 0x269d000
brk(0x2637000)                          = 0x2637000
brk(0x2659000)                          = 0x2659000
brk(0x267b000)                          = 0x267b000
brk(0x269d000)                          = 0x269d000
brk(0x2637000)                          = 0x2637000
brk(0x2659000)                          = 0x2659000

These messages repeat over and over.

I should mention that this behavior seems to be triggered by the underscore in the DOCTYPE ELEMENT name, and is not affected by the underscore in the actual element's name. Thus, this file also triggers the bug:
$ cat example-bad2.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
   <!ELEMENT EXAM_PLE EMPTY>
]>
<EXAMPLE>
</EXAMPLE>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]