Backport #7764

REXML -- Malformed comment

Added by Leandro A about 1 year ago. Updated about 1 year ago.

[ruby-core:51784]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

I'm getting the following trying to parse the attached xml:

C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:95:in `rescue in parse': #<REXML::ParseException: Malformed comment (REXML::ParseException)
Line: 181
Position: 7663
Last 80 unconsumed characters:

C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:346:in pull_event'
C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:183:in
pull'
C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:22:in parse'
C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/document.rb:231:in
build'
C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/document.rb:43:in initialize'
install.rb:74:in
new'
install.rb:74:in `'
...
Malformed comment
Line: 181
Position: 7663
Last 80 unconsumed characters:

Line: 181
Position: 7663
Last 80 unconsumed characters:
from C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/parsers/treeparser.rb:20:in parse'
from C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/document.rb:231:in
build'
from C:/dev/tools/ruby193/lib/ruby/1.9.1/rexml/document.rb:43:in initialize'
from install.rb:74:in
new'
from install.rb:74:in `'

Line 74 of install.rb is:

doc = REXML::Document.new(File.new('settings.xml'))

settings.xml Magnifier (9.87 KB) Leandro A, 02/01/2013 03:41 AM

History

#1 Updated by Kouhei Sutou about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport93
  • Status changed from Open to Assigned
  • Assignee set to Usaku NAKAMURA

This problem had been fixed in trunk at r33210. (See #5278)
Usa-san, could you backport the fix?

I've confirmed the change (without ChangeLog change) can be applied to ruby19_3 branch without conflict. And make test-all is still passed.

#2 Updated by Kouhei Sutou about 1 year ago

There is a workaround for the problem.

The problem is caused by a line that ends with "-" in comment. In your XML, there is a problem line at 163:

 | the build process. Profiles provided in the settings.xml are intended to provide local machine-

If you put " " (a space) after "machine-", the problem can be avoided. ("machine-" -> "machine- ")

#3 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Assigned to Closed

fixed at r39113.

Also available in: Atom PDF