Project

General

Profile

loofah error on module:HTML4 after migration

Added by Aukfood Aukfood 4 months ago

Hello,

I migrate an old version of redmine (3.4) on same linux distribution (Debian 10) with same version of ruby 2.5.

So I think data with rsync, database with dump sql. After I done

gem install bundler -v 1.17.0
bundle _1.17.0_ install --without development test

So when I done a test : bundle exec ruby bin/rails server -b $IP webrick -e production I have an error with loofah :

     4: from ..../redmine/vendor/bundle/ruby/2.5.0/gems/loofah-2.21.1/lib/loofah.rb:36:in `<top (required)>'
     3: from ..../redmine/vendor/bundle/ruby/2.5.0/gems/loofah-2.21.1/lib/loofah.rb:36:in `require_relative'
     2: from ..../redmine/vendor/bundle/ruby/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:3:in `<top (required)>'
     1: from ..../redmine/vendor/bundle/ruby/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:4:in `<module:Loofah>'
..../redmine/vendor/bundle/ruby/2.5.0/gems/loofah-2.21.1/lib/loofah/html4/document.rb:10:in `<module:HTML4>': uninitialized constant Nokogiri::HTML4 (NameError)

Where is my mistake on transfer procedure ?

Best regards


Replies (4)

RE: loofah error on module:HTML4 after migration - Added by Holger Just 4 months ago

This is caused by an incompatibility of various gems with your Ruby versions and temporary bugs in dependency announcements of the loofah gem (a HTML sanitizing gem which is a dependency of rails-html-sanitizer).

In loofah version 2.21.2, a bug was fixed where they erroneously allowed it to be installed with a too-old version of nokogiri (an HTML/XML parser). Bundler thus likely selected the previous version on its update as it thought that it satisfied the dependencies. As Redmine 3.4 is quite outdated, you will likely run into several such issues as some dependencies may not work with newer Ruby versions and the mechanisms to restrict gems by supported Ruby version were not very robust back then.

You can likely fix this locally by creating a new file called Gemfile.local besides Redmine's existing Gemfile and add the following content to it:

gem "loofah", "< 2.21.0" 

Then, you can run bundle update again.

Note though that Redmine 3.4 is quite outdated and has several known security issues. As such, you should schedule an update to at least Redmine 5.0 rather sooner than later.

RE: loofah error on module:HTML4 after migration - Added by Aukfood Aukfood 4 months ago

holger mareck thanks it's works

Yes we know that version is outsated, we have a long work to upgrade from 3.4 to 4.2 and after to 5.

Thanks for you're help

RE: loofah error on module:HTML4 after migration - Added by Holger Just 4 months ago

I'm glad hat this worked, When updating to a newer Redmine (and Ruby) version, just make sure to remove this entry in the Gemfile.local again.

    (1-4/4)