-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wikipedia-kyoto-japanese-english: increase REXML entity expansion limit during XML parsing #198
wikipedia-kyoto-japanese-english: increase REXML entity expansion limit during XML parsing #198
Conversation
…it during XML parsing Using `Datasets::WikipediaKyotoJapaneseEnglish#each` raised an `entity expansion has grown too large (RuntimeError)`. This error occurs because the entity expansion limit in REXML is set by ruby/rexml#187, and `Datasets::WikipediaKyotoJapaneseEnglish#each` exceeds that limit. In Red Datasets, increasing the entity expansion limit is not a problem because we want to handle large datasets. Therefore, we temporarily increase the limit. How to reproduce: ```console $ cd red-datasets && bundle $ bundle exec ruby example/wikipedia-kyoto-japanese-english.rb ... /home/otegami/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/rexml-3.3.4/lib/rexml/parsers/baseparser.rb:560:in `block in unnormalize': entity expansion has grown too large (RuntimeError) ... ```
def with_increased_entity_expansion_text_limit | ||
default_limit = REXML::Security.entity_expansion_text_limit | ||
REXML::Security.entity_expansion_text_limit = ENTITY_EXPANSION_TEXT_LIMIT | ||
yield | ||
ensure | ||
REXML::Security.entity_expansion_text_limit = default_limit | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. We can use this for now but it seems that REXML::Parsers::StreamParser#entity_expansion_text_limit=
should exist for local limitation change. Could you propose it to ruby/rexml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds pretty nice. Sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've proposed it at ruby/rexml#192.
I will fix the test in other PRs. |
We have the same problem in |
Sure I will fix it! |
Can we revert this because the latest REXML fixed this problem? |
…sion limit during XML parsing (red-data-tools#198)" This reverts commit a76b917. REXML has fixed the bug where `REXML::Security.entity_expansion_text_limit` incorrectly calculated text size in both SAX and pull parsers. Therefore, we no longer need to handle this issue within Red Datasets. ref: https://github.com/ruby/rexml/releases/tag/v3.3.5
…sion limit during XML parsing (#198) (#201) This reverts commit a76b917. REXML has fixed the bug where `REXML::Security.entity_expansion_text_limit` incorrectly calculated text size in both SAX and pull parsers. Therefore, we no longer need to handle this issue within Red Datasets. ref: https://github.com/ruby/rexml/releases/tag/v3.3.5
Using
Datasets::WikipediaKyotoJapaneseEnglish#each
raised anentity expansion has grown too large (RuntimeError)
. This error occurs because the entity expansion limit in REXML is set by ruby/rexml#187, andDatasets::WikipediaKyotoJapaneseEnglish#each
exceeds that limit.In Red Datasets, increasing the entity expansion limit is not a problem because we want to handle large datasets.
Therefore, we temporarily increase the limit.
How to reproduce