Subject: bug#7172: emacs 23.2; xml.el: xml-parse-file hangs when DOCTYPE element names contain _ (underscore)

From: Glenn Morris <[email-masked]>
Date: Thu, 07 Oct 2010 20:39:54 -0400

Jose Marino wrote:

> Attaching strace to the running emacs process prints:
> brk(0x267b000)                          = 0x267b000

A much more useful thing to do in such cases is to
M-x toggle-debug-on-quit
beforehand, then interrupt Emacs with C-g when it hangs. Resulting backtrace:

Debugger entered--Lisp error: (quit)
  looking-at("<!ATTLIST[ 	\n
]*\\([[:alpha:]:_][-[:digit:].[:alpha:]:_]*\\)[ 	\n
]*\\(\\(?:[ 	\n
]*[[:alpha:]:_][-[:digit:].[:alpha:]:_]*[ 	\n
]*\\(?:CDATA\\|\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|ENTITIES\\|NMTOKEN\\|NMTOKENS\\)\\|\\(?:NOTATION[ 	\n
]([ 	\n
]*[[:alpha:]:_][-[:digit:].[:alpha:]:_]*\\(?:[ 	\n
]*|[ 	\n
]*[[:alpha:]:_][-[:digit:].[:alpha:]:_]*\\)*[ 	\n
]*)\\)\\|\\(?:\\(?:NOTATION[ 	\n
]([ 	\n
]*[[:alpha:]:_][-[:digit:].[:alpha:]:_]*\\(?:[ 	\n
]*|[ 	\n
]*[[:alpha:]:_][-[:digit:].[:alpha:]:_]*\\)*[ 	\n
]*)\\)\\|\\(?:([ 	\n
]*[-[:digit:].[:alpha:]:_]+\\(?:[ 	\n
]*|[ 	\n
]*[-[:digit:].[:alpha:]:_]+\\)*[ 	\n
])\\)\\)\\)[ 	\n
]*\\(?:#REQUIRED\\|#IMPLIED\\|\\(?:#FIXED[ 	\n
]\\)*\\(?:\"\\(?:[^&\"]\\|\\(?:&[[:alpha:]:_][-[:digit:].[:alpha:]:_]*;\\|\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)\\)\\)*\"\\|'\\(?:[^&']\\|\\(?:&[[:alpha:]:_][-[:digit:].[:alpha:]:_]*;\\|\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)\\)\\)*'\\)\\)\\)\\)*[ 	\n
]*>")
  xml-parse-dtd(nil)
  xml-parse-tag(nil nil)
  xml-parse-tag(nil nil)
  xml-parse-region(1 116 #<buffer  *temp*> nil nil)
  xml-parse-file("example-bad.xml")

That certainly is a regexp.