Backport #7961

1.9.3-p392 REXML::Text.unnomralize bug

Added by Anonymous about 1 year ago. Updated about 1 year ago.

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

Description

Hello everyone,
there is a bug introduced with p392 in parsing special characters with
REXML.
Here is the sample code to reproduce the bug:

REXML::Text.unnormalize('&')

it produces following error:

NameError: uninitialized constant REXML::Text::Document
from
/home/ubuntu/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/rexml/text.rb:386:in
block in unnormalize'
from
/home/ubuntu/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/rexml/text.rb:384:in
gsub'
from
/home/ubuntu/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/rexml/text.rb:384:in
`unnormalize'
from (irb):6

the workaround is to require "rexml/document" manually, but since its being
referenced from REXML::Text it should be required there.

Thank you and best regards,
Robert

Associated revisions

Revision 39977
Added by Usaku NAKAMURA about 1 year ago

merge revision(s) 39509,39511: [Backport #7961]

* lib/rexml/document.rb: move entity_expansion_limit accessor to ...

* lib/rexml/rexml.rb: ... here to make rexml/text independent from
  REXML::Document. It causes circular require.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
  deprecated.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
  deprecated.

* lib/rexml/text.rb: add missing require "rexml/rexml" for
  REXML.entity_expansion_limit.
  Reported by Robert Ulejczyk. Thanks!!!  [Bug #7961]

* lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
  REXML.entity_expansion_text_limit.

History

#1 Updated by Usaku NAKAMURA about 1 year ago

  • Category set to lib
  • Status changed from Open to Assigned
  • Assignee set to Kouhei Sutou
  • Target version set to 2.1.0
  • ruby -v set to 1.9.3 p392

trunk, 2.0.0 and 1.9.3 all have same problem.

#2 Updated by Kouhei Sutou about 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39509.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/rexml/document.rb: move entityexpansionlimit accessor to ...
  • lib/rexml/rexml.rb: ... here to make rexml/text independent from REXML::Document. It causes circular require.
  • lib/rexml/document.rb (REXML::Document.entityexpansionlimit): deprecated.
  • lib/rexml/document.rb (REXML::Document.entityexpansionlimit=): deprecated.
  • lib/rexml/text.rb: add missing require "rexml/rexml" for REXML.entityexpansionlimit. Reported by Robert Ulejczyk. Thanks!!! [Bug #7961]

#3 Updated by Kouhei Sutou about 1 year ago

Here are related commits: r39509, r39510, r39511 and r39528.

#4 Updated by Usaku NAKAMURA about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Category deleted (lib)
  • Status changed from Closed to Assigned
  • Assignee changed from Kouhei Sutou to Tomoyuki Chikanaga
  • Target version deleted (2.1.0)

I'm planning to backport only r39509 to ruby193.
How about ruby
200, chikanaga-san?

#5 Updated by Tomoyuki Chikanaga about 1 year ago

I want to merge r39509 and r39511 to ruby20_0.

#6 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r39952.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39509,39511: [Backport #7961]

* lib/rexml/document.rb: move entity_expansion_limit accessor to ...

* lib/rexml/rexml.rb: ... here to make rexml/text independent from
  REXML::Document. It causes circular require.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
  deprecated.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
  deprecated.

* lib/rexml/text.rb: add missing require "rexml/rexml" for
  REXML.entity_expansion_limit.
  Reported by Robert Ulejczyk. Thanks!!!  [Bug #7961]

* lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
  REXML.entity_expansion_text_limit.

#7 Updated by Tomoyuki Chikanaga about 1 year ago

  • Project changed from Backport200 to Backport93
  • Status changed from Closed to Assigned
  • Assignee changed from Tomoyuki Chikanaga to Usaku NAKAMURA

#8 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r39977.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39509,39511: [Backport #7961]

* lib/rexml/document.rb: move entity_expansion_limit accessor to ...

* lib/rexml/rexml.rb: ... here to make rexml/text independent from
  REXML::Document. It causes circular require.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit):
  deprecated.

* lib/rexml/document.rb (REXML::Document.entity_expansion_limit=):
  deprecated.

* lib/rexml/text.rb: add missing require "rexml/rexml" for
  REXML.entity_expansion_limit.
  Reported by Robert Ulejczyk. Thanks!!!  [Bug #7961]

* lib/rexml/document.rb: move entity_expansion_text_limit accessor to ...

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):

* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit=):
  REXML.entity_expansion_text_limit.

Also available in: Atom PDF