GNU bug report logs - #10405
24.0.92; XML parser -- problem handling comments

Previous Next

Package: emacs;

Reported by: Alex Harsanyi <harsanyi <at> mac.com>

Date: Fri, 30 Dec 2011 00:48:02 UTC

Severity: normal

Tags: patch

Found in version 24.0.92

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10405 in the body.
You can then email your comments to 10405 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10405; Package emacs. (Fri, 30 Dec 2011 00:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Harsanyi <harsanyi <at> mac.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 30 Dec 2011 00:48:02 GMT) Full text and rfc822 format available.

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

From: Alex Harsanyi <harsanyi <at> mac.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.92; XML parser -- problem handling comments
Date: Fri, 30 Dec 2011 08:44:13 +0800
There seems to be a bug in `xml-parse-tag' when handling comments.  To
reproduce it, create a buffer containing the following text on a single line:

    <!-- hello --><outer><inner></inner></outer>

Trying to parse this using 

   M-: (xml-parse-region (point-min) (point-max)) 

will return:

   ((inner nil))

instead of:

   ((outer nil (inner nil)))

Inserting a space or newline after the end comment tag (-->) seems to
avoid this bug.

The patch below fixes the problem, but I'm not sure if it is the correct
fix (I just copied the code from the part that handles processing
instructions, that start with <?):

=== modified file 'lisp/xml.el'
*** lisp/xml.el	2011-11-20 03:48:53 +0000
--- lisp/xml.el	2011-12-30 00:39:42 +0000
***************
*** 421,427 ****
       ;;  skip comments
       ((looking-at "<!--")
        (search-forward "-->")
!       nil)
       ;;  end tag
       ((looking-at "</")
        '())
--- 421,428 ----
       ;;  skip comments
       ((looking-at "<!--")
        (search-forward "-->")
!       (skip-syntax-forward " ")
!       (xml-parse-tag parse-dtd xml-ns))
       ;;  end tag
       ((looking-at "</")
        '())




In GNU Emacs 24.0.92.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
of 2011-12-30 on karinji-2.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x b * x m l * <return> < ! - - SPC h e l l o SPC 
- - > < o u t e r > < i n n e r > < / i n n e r > / 
<backspace> < / o u t e r > <return> <up> s-: s-( s-: 
s-: M-: e <backspace> x <backspace> ( x m o <backspace> 
l - p a s e <backspace> <backspace> r s e - r e g i 
o n SPC ( p o i n t - m i n ) SPC ( p o i n t ) <backspace> 
- m a x ) ) <return> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <return> M-: <up> <return> 
<backspace> SPC M-: <up> <return> <right> <left> <backspace> 
M-: <down> <up> <return> <left> <right> <right> <right> 
<right> <right> <right> <right> <right> M-x r e p o 
<tab> r t <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Starting new Ispell process [default] ...
Spell-checking *xml* using aspell with default dictionary...done
Spell-checking *xml* using aspell with default dictionary...done
Spell-checking *xml* using aspell with default dictionary...done
((inner nil))
((outer nil (inner nil))) [2 times]
goto-history-element: End of history; no default available
((inner nil))
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug help-mode easymenu view xml regexp-opt ispell time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind ns
multi-tty emacs)




Added tag(s) patch. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Fri, 30 Dec 2011 09:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10405; Package emacs. (Mon, 09 Jan 2012 15:48:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Mark A. Hershberger <mah <at> everybody.org>
Cc: 10405 <at> debbugs.gnu.org, Alex Harsanyi <harsanyi <at> mac.com>
Subject: Re: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Mon, 09 Jan 2012 16:47:18 +0100
Hi Mark,

I don't know whether you still care about xml.el. If yes, yould you
please go through this bug report? For my eyes, the proposed patch from
Alex looks OK, but you might know it better.

Thanks, and best regards, Michael.

Alex Harsanyi <harsanyi <at> mac.com> writes:

> There seems to be a bug in `xml-parse-tag' when handling comments.  To
> reproduce it, create a buffer containing the following text on a single line:
>
>     <!-- hello --><outer><inner></inner></outer>
>
> Trying to parse this using 
>
>    M-: (xml-parse-region (point-min) (point-max)) 
>
> will return:
>
>    ((inner nil))
>
> instead of:
>
>    ((outer nil (inner nil)))
>
> Inserting a space or newline after the end comment tag (-->) seems to
> avoid this bug.
>
> The patch below fixes the problem, but I'm not sure if it is the correct
> fix (I just copied the code from the part that handles processing
> instructions, that start with <?):
>
> === modified file 'lisp/xml.el'
> *** lisp/xml.el	2011-11-20 03:48:53 +0000
> --- lisp/xml.el	2011-12-30 00:39:42 +0000
> ***************
> *** 421,427 ****
>        ;;  skip comments
>        ((looking-at "<!--")
>         (search-forward "-->")
> !       nil)
>        ;;  end tag
>        ((looking-at "</")
>         '())
> --- 421,428 ----
>        ;;  skip comments
>        ((looking-at "<!--")
>         (search-forward "-->")
> !       (skip-syntax-forward " ")
> !       (xml-parse-tag parse-dtd xml-ns))
>        ;;  end tag
>        ((looking-at "</")
>         '())
>
>
>
>
> In GNU Emacs 24.0.92.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
> of 2011-12-30 on karinji-2.local
> Windowing system distributor `Apple', version 10.3.1038
> configured using `configure  '--with-ns''
>
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: en_AU.UTF-8
>   value of $XMODIFIERS: nil
>   locale-coding-system: utf-8-unix
>   default enable-multibyte-characters: t
>
> Major mode: Fundamental
>
> Minor modes in effect:
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> C-x b * x m l * <return> < ! - - SPC h e l l o SPC 
> - - > < o u t e r > < i n n e r > < / i n n e r > / 
> <backspace> < / o u t e r > <return> <up> s-: s-( s-: 
> s-: M-: e <backspace> x <backspace> ( x m o <backspace> 
> l - p a s e <backspace> <backspace> r s e - r e g i 
> o n SPC ( p o i n t - m i n ) SPC ( p o i n t ) <backspace> 
> - m a x ) ) <return> <right> <right> <right> <right> 
> <right> <right> <right> <right> <right> <right> <right> 
> <right> <right> <right> <return> M-: <up> <return> 
> <backspace> SPC M-: <up> <return> <right> <left> <backspace> 
> M-: <down> <up> <return> <left> <right> <right> <right> 
> <right> <right> <right> <right> <right> M-x r e p o 
> <tab> r t <tab> <return>
>
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
> Starting new Ispell process [default] ...
> Spell-checking *xml* using aspell with default dictionary...done
> Spell-checking *xml* using aspell with default dictionary...done
> Spell-checking *xml* using aspell with default dictionary...done
> ((inner nil))
> ((outer nil (inner nil))) [2 times]
> goto-history-element: End of history; no default available
> ((inner nil))
> Making completion list...
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort gnus-util mail-extr message format-spec rfc822 mml mml-sec
> mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
> ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
> emacsbug help-mode easymenu view xml regexp-opt ispell time-date tooltip
> ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
> image fringe lisp-mode register page menu-bar rfn-eshadow timer select
> scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
> georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
> korean japanese hebrew greek romanian slovak czech european ethiopic
> indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
> abbrev minibuffer loaddefs button faces cus-face files text-properties
> overlay sha1 md5 base64 format env code-pages mule custom widget
> hashtable-print-readable backquote make-network-process dbusbind ns
> multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10405; Package emacs. (Fri, 27 Jan 2012 08:49:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "Mark A. Hershberger" <mah <at> everybody.org>, 10405 <at> debbugs.gnu.org,
	Alex Harsanyi <harsanyi <at> mac.com>
Subject: Re: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Fri, 27 Jan 2012 16:47:19 +0800
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Hi Mark,
>
> I don't know whether you still care about xml.el. If yes, yould you
> please go through this bug report? For my eyes, the proposed patch from
> Alex looks OK, but you might know it better.

I've committed the patch to the trunk, so that it can be in the next
Emacs 24 pretest.  Mark, please feel free to weigh in if you prefer a
different fix.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10405; Package emacs. (Fri, 27 Jan 2012 14:26:02 GMT) Full text and rfc822 format available.

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

From: mah <at> everybody.org (Mark A. Hershberger)
To: Chong Yidong <cyd <at> gnu.org>
Cc: 10405 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
	Alex Harsanyi <harsanyi <at> mac.com>
Subject: Re: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Fri, 27 Jan 2012 09:25:08 -0500
Chong Yidong <cyd <at> gnu.org> writes:

> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
>> Hi Mark,
>>
>> I don't know whether you still care about xml.el. If yes, yould you
>> please go through this bug report? For my eyes, the proposed patch from
>> Alex looks OK, but you might know it better.
>
> I've committed the patch to the trunk, so that it can be in the next
> Emacs 24 pretest.  Mark, please feel free to weigh in if you prefer a
> different fix.

Thank you very much.  My time has been consumed with my work for
Wikimedia.

Mark.

-- 
http://hexmode.com/

War begins by calling for the annihilation of the Other,
    but ends ultimately in self-annihilation.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 08 Feb 2012 08:24:01 GMT) Full text and rfc822 format available.

Notification sent to Alex Harsanyi <harsanyi <at> mac.com>:
bug acknowledged by developer. (Wed, 08 Feb 2012 08:24:02 GMT) Full text and rfc822 format available.

Message #21 received at 10405-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 10405-done <at> debbugs.gnu.org, "Mark A. Hershberger" <mah <at> everybody.org>,
	Alex Harsanyi <harsanyi <at> mac.com>
Subject: Re: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Wed, 08 Feb 2012 09:22:40 +0100
Chong Yidong <cyd <at> gnu.org> writes:

> I've committed the patch to the trunk, so that it can be in the next
> Emacs 24 pretest.

I mark the bug as closed. Alex, feel free to reopen if it doesn't work
for you.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Mar 2012 12:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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