Bug 56513 - gem-rxml некорректно работает если установлен пакет gem-strscan
Summary: gem-rxml некорректно работает если установлен пакет gem-strscan
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: gem-rexml (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: admsasha@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-20 15:07 MSK by Куницкий Дмитрий
Modified: 2025-10-20 15:07 MSK (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Куницкий Дмитрий 2025-10-20 15:07:16 MSK
Стенды: Обновленные до Sisyphus:
p11 workstation K x86-64
p11 workstation x86-64
p11 education kde x86-64
p11 education XFCE x86-64
p11 server minimal x86-64


Шаги воспроизведения:
1) Установить пакеты
# apt-get install -y gem-strscan gem-rexml

2) Создать тестовый скрипт который 
$ cat > test.rb <<EOF
require "rexml/document"
file = File.new( "books.xml" )
doc = REXML::Document.new file
doc.root.children.each do |child|
  p [child, child.class]
end
p doc.root.class
p doc.root.xpath
p doc.root.texts.first
p doc.root.texts.first.xpath
EOF

3)Скачать XML-файл для проверки
$ wget https://www.w3schools.com/xml/books.xml

4) Запустить тестовый скрипт:
$ ruby test.rb

Реальный результат:
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:529:in `rescue in pull_event': #<TypeError: wrong argument type String (expected Regexp)> (REXML::ParseException)
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/source.rb:269:in `scan_until'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/source.rb:269:in `read_until'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:508:in `pull_event'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:249:in `pull'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb:21:in `parse'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:468:in `build'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:105:in `initialize'
test.rb:3:in `new'
test.rb:3:in `<main>'
...
Exception parsing
Line: 1
Position: 4
Last 80 unconsumed characters:
file
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:437:in `pull_event'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:249:in `pull'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb:21:in `parse'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:468:in `build'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:105:in `initialize'
from test.rb:3:in `new'
from test.rb:3:in `<main>'
/usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/source.rb:269:in `scan_until': wrong argument type String (expected Regexp) (TypeError)
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/source.rb:269:in `read_until'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:508:in `pull_event'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/baseparser.rb:249:in `pull'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/parsers/treeparser.rb:21:in `parse'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:468:in `build'
from /usr/lib/ruby/gemie/gems/rexml-3.4.4/lib/rexml/document.rb:105:in `initialize'
from test.rb:3:in `new'
from test.rb:3:in `<main>'

Ожидаемый результат:
 ["\n\n", REXML::Text]
[<book category='cooking'> ... , REXML::Element]
["\n\n", REXML::Text]
[<book category='children'> ... , REXML::Element]
["\n\n", REXML::Text]
[<book category='web'> ... , REXML::Element]
["\n\n", REXML::Text]
[<book category='web' cover='paperback'> ... , REXML::Element]
["\n\n", REXML::Text]
REXML::Element
"/bookstore"
"\n\n"
"/bookstore/text()"