unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10405: 24.0.92; XML parser -- problem handling comments
@ 2011-12-30  0:44 Alex Harsanyi
  2012-01-09 15:47 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Harsanyi @ 2011-12-30  0:44 UTC (permalink / raw)
  To: 10405

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)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10405: 24.0.92; XML parser -- problem handling comments
  2011-12-30  0:44 bug#10405: 24.0.92; XML parser -- problem handling comments Alex Harsanyi
@ 2012-01-09 15:47 ` Michael Albinus
  2012-01-27  8:47   ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2012-01-09 15:47 UTC (permalink / raw)
  To: Mark A. Hershberger; +Cc: Alex Harsanyi, 10405

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@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)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10405: 24.0.92; XML parser -- problem handling comments
  2012-01-09 15:47 ` Michael Albinus
@ 2012-01-27  8:47   ` Chong Yidong
  2012-01-27 14:25     ` Mark A. Hershberger
  2012-02-08  8:22     ` Michael Albinus
  0 siblings, 2 replies; 5+ messages in thread
From: Chong Yidong @ 2012-01-27  8:47 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Mark A. Hershberger, Alex Harsanyi, 10405

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10405: 24.0.92; XML parser -- problem handling comments
  2012-01-27  8:47   ` Chong Yidong
@ 2012-01-27 14:25     ` Mark A. Hershberger
  2012-02-08  8:22     ` Michael Albinus
  1 sibling, 0 replies; 5+ messages in thread
From: Mark A. Hershberger @ 2012-01-27 14:25 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Alex Harsanyi, Michael Albinus, 10405

Chong Yidong <cyd@gnu.org> writes:

> Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10405: 24.0.92; XML parser -- problem handling comments
  2012-01-27  8:47   ` Chong Yidong
  2012-01-27 14:25     ` Mark A. Hershberger
@ 2012-02-08  8:22     ` Michael Albinus
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2012-02-08  8:22 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 10405-done, Mark A. Hershberger, Alex Harsanyi

Chong Yidong <cyd@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-08  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30  0:44 bug#10405: 24.0.92; XML parser -- problem handling comments Alex Harsanyi
2012-01-09 15:47 ` Michael Albinus
2012-01-27  8:47   ` Chong Yidong
2012-01-27 14:25     ` Mark A. Hershberger
2012-02-08  8:22     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).