Project

General

Profile

Actions

Defect #41860

closed

FrozenError when using SQLite3 gem version 2.0.0 or later

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The version of the SQLite3 gem currently used in Redmine is the outdated 1.7.x. However, when updating to version 2.0.0 or later, several tests fail due to FrozenError, as shown in the attached details.

diff --git a/Gemfile b/Gemfile
index 71412a11b..229f014af 100644
--- a/Gemfile
+++ b/Gemfile
@@ -75,7 +75,7 @@ if File.exist?(database_file)
       when /postgresql/
         gem 'pg', '~> 1.5.3'
       when /sqlite3/
-        gem 'sqlite3', '~> 1.7.0'
+        gem 'sqlite3', '~> 2.3.0'
       when /sqlserver/
         gem 'tiny_tds', '~> 2.1.2'
         gem 'activerecord-sqlserver-adapter', '~> 7.2.0'
$ bin/rails about
About your application's environment
Rails version             7.2.2
Ruby version              ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]
RubyGems version          3.5.22
Rack version              3.1.8
Middleware                ActionDispatch::HostAuthorization, Rack::ContentLength, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root          /Users/maeda/redmines/redmine-trunk
Environment               development
Database adapter          sqlite3
Database schema version   20241103184550

Files


Related issues

Blocks Redmine - Patch #41865: Update SQLite3 gem to 2.4ClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA about 1 month ago

  • Target version set to 6.0.2

The following patch will fix the issue.

Setting the target version to 6.0.2.

diff --git a/app/models/wiki_content_version.rb b/app/models/wiki_content_version.rb
index 78e056649..79941bf41 100644
--- a/app/models/wiki_content_version.rb
+++ b/app/models/wiki_content_version.rb
@@ -77,20 +77,19 @@ class WikiContentVersion < ApplicationRecord
   def text
     @text ||= begin
       str = case compression
             when 'gzip'
               Zlib::Inflate.inflate(data)
             else
               # uncompressed data
               data
             end
-      str.force_encoding("UTF-8")
-      str
+      (+str).force_encoding('UTF-8')
     end
   end

   def project
     page.project
   end

   def attachments
     page.nil? ? [] : page.attachments
Actions #2

Updated by Go MAEDA about 1 month ago

Actions #3

Updated by Go MAEDA about 1 month ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r23308.

Actions #4

Updated by Go MAEDA about 1 month ago

  • Status changed from Resolved to Closed

Merged the fix into the 6.0-stable branch in r23314.

Actions

Also available in: Atom PDF