App 19843 output: [599f0f62-257a-49a9-bf49-2d9cd67a9566] Started POST "/issues.xml?key=hidden" for hidden at 2022-06-14 14:47:42 +0000
App 19843 output: You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install
App 19843 output: [599f0f62-257a-49a9-bf49-2d9cd67a9566] LoadError (cannot load such file -- rexml/document):
App 19843 output: [599f0f62-257a-49a9-bf49-2d9cd67a9566] zeitwerk (2.6.0) lib/zeitwerk/kernel.rb:35:in `require'
rexml used to be a a requirement of Rails as it is used as the default backend of ActiveSupport::XmlMini. This backend is used e.g. when parsing XML payloads of API requests.
In Ruby <= 2.7, the rexml library was included in the Ruby standard library. As such, it was still present and available even when not directly required. Starting with Ruby 3.0 however, rexml was converted into a bundled gem. As such, it is necessary to define it as a dependency in bundler (either explicitly or transitive via other dependencies). Now, if Redmine is installed with its test group (which is the default), rexml is installed as transitive dependency to rubocop and is thus available.
However, if bundler is configured with
bundle config --without test
on Ruby >= 3.0, rexml is not installed and is hidden by bundler, even if it's present as a bundled gem in Ruby. This results in ActiveSupport::XmlMini trying to load rexml fir its default backkend and failing.
We have two ways to resolve this:
we could add a strict rexml dependency to the Gemfile, effectively re-introducing the previous rails dependency:
gem"rexml",require: false
Alternatively, we could switch to a different backend. As Redmine already depends on nokogiri, we could thus switch the XmlMini backend to nokogiri in an initializer, e.g. config/initializers/30-redmine.rb:
ActiveSupport::XmlMini.backend='Nokogiri'
This likely has the added benefit of (much) faster XML parsing and generation.
we could add a strict rexml dependency to the Gemfile, effectively re-introducing the previous rails dependency: [...]
Alternatively, we could switch to a different backend. As Redmine already depends on nokogiri, we could thus switch the XmlMini backend to nokogiri in an initializer, e.g. config/initializers/30-redmine.rb: [...] This likely has the added benefit of (much) faster XML parsing and generation.
I would prefer the first approach. This is because the fix should be backported to 5.0-stable branch and delivered in 5.0.2, but I think switching a backend to Nokogiri is a somewhat big change for the maintenance release.
I would prefer the first approach. This is because the fix should be backported to 5.0-stable branch and delivered in 5.0.2, but I think switching a backend to Nokogiri is a somewhat big change for the maintenance release.
In that case, I would be in favor of adding the rexml gem as a dependency for Ruby >= 3.0 on 5.0-stable only, i.e. to add the following patch in 5.0-stable:
For trunk, we should instead opt to set the XmlMini backend to "Nokogiri" and get rid of rexml entirely. This avoids the usage of multiple different XML engines and the associated potential security issues due to different update-policies here.