Public bug reported:

As of the time of writing, these are the current excuses for ruby-redis:

ruby-redis (4.8.0-2 to 5.3.0-1)

    Migration status for ruby-redis (4.8.0-2 to 5.3.0-1): BLOCKED: 
Rejected/violates migration policy/introduces a regression
    Issues preventing migration:
    autopkgtest for ruby-gitlab-labkit/0.34.0-2: amd64: No test results, arm64: 
No test results, armhf: No test results, ppc64el: No test results, s390x: No 
test results
    autopkgtest for ruby-rollout/2.5.0-1: amd64: Regression ♻ , arm64: 
Regression ♻ , armhf: Regression ♻ , ppc64el: Regression ♻ , s390x: Regression ♻
    Additional info:
    124 days old 

ruby-rollout's autopkgtest fails due to the following error:

106s LoadError:
106s   cannot load such file -- redis/connection/registry
106s # ./spec/spec_helper.rb:3:in `<top (required)>'
106s # ./spec/rollout/logging_spec.rb:1:in `<top (required)>'
106s 
106s An error occurred while loading ./spec/rollout_spec.rb. - Did you mean?
106s                     rspec ./spec/rollout/logging_spec.rb
106s 
106s Failure/Error: require 'fakeredis'

Which actually originates in ruby-fakeredis:

An error occurred while loading ./spec/bitop_command_spec.rb. - Did you mean?
                    rspec ./spec/compatibility_spec.rb

Failure/Error: require 'redis/connection/registry'

LoadError:
  cannot load such file -- redis/connection/registry
# ./lib/redis/connection/memory.rb:2:in `<top (required)>'
# ./lib/fakeredis.rb:2:in `<top (required)>'
# ./spec/spec_helper.rb:7:in `<top (required)>'
# ./spec/bitop_command_spec.rb:1:in `<top (required)>'

--------------------

At this point, it seemed clear that there are two options:
 - Update ruby-fakeredis to be compatible with the new ruby-redis version.
 - Remove ruby-fakeredis to allow ruby-redis in.

I did do a bit of investigation with the first point; while my Ruby is
slightly rusty, I have done projects with it before. Here's how far I
was able to get:

--- a/lib/redis/connection/memory.rb
+++ b/lib/redis/connection/memory.rb
@@ -1,6 +1,9 @@
 require 'set'
-require 'redis/connection/registry'
-require 'redis/connection/command_helper'
+begin
+  require 'redis/connection/registry'
+rescue LoadError
+  # Registry module removed in redis-rb 5 – skip requiring it
+end
 require "fakeredis/command_executor"
 require "fakeredis/expiring_hash"
 require "fakeredis/sort_method"
@@ -17,7 +20,29 @@ class Redis
     DEFAULT_REDIS_VERSION = '3.3.5'
 
     class Memory
-      include Redis::Connection::CommandHelper
+      # Redis::Connection::CommandHelper was removed in redis-rb 5.
+      # Define build_command here to replace it:
+      def build_command(args)
+        cmd_parts = [nil]  # placeholder for total count
+        args.each do |arg|
+          if arg.is_a?(Array)
+            arg.each do |sub|
+              sub = sub.to_s
+              cmd_parts << "$#{sub.bytesize}"
+              cmd_parts << sub
+            end
+          else
+            arg = arg.to_s
+            cmd_parts << "$#{arg.bytesize}"
+            cmd_parts << arg
+          end
+        end
+        # Prefix with argument count and append CRLF
+        cmd_parts[0] = "*#{(cmd_parts.length - 1) / 2}"
+        cmd_parts << ""  # empty segment for trailing CRLF
+        cmd_parts.join("\r\n")
+      end
+
       include FakeRedis
       include SortMethod
       include TransactionCommands
@@ -1599,4 +1624,4 @@ class Redis
 end
 
 # FIXME this line should be deleted as explicit enabling is better
-Redis::Connection.drivers << Redis::Connection::Memory
+Redis::Connection.drivers << Redis::Connection::Memory if 
Redis::Connection.respond_to?(:drivers)
--- a/lib/fakeredis.rb
+++ b/lib/fakeredis.rb
@@ -5,7 +5,16 @@ module FakeRedis
   Redis = ::Redis
 
   def self.enable
-    Redis::Connection.drivers << Redis::Connection::Memory unless enabled?
+    unless Redis::Connection.respond_to?(:drivers)
+      class << Redis
+        alias_method :new_without_fakeredis, :new
+        def new(*args, **kwargs)
+          # Default to Memory driver if none specified
+          kwargs[:driver] ||= Redis::Connection::Memory
+          new_without_fakeredis(*args, **kwargs)
+        end
+      end
+    end
   end
 
   def self.enabled?
@@ -32,3 +41,14 @@ module FakeRedis
     disable
   end
 end
+
+unless Redis::Connection.respond_to?(:drivers)
+  class << Redis
+    alias_method :new_without_fakeredis, :new
+    def new(*args, **kwargs)
+      # Force the use of the in‑memory connection if no driver is provided.
+      kwargs[:driver] ||= Redis::Connection::Memory
+      new_without_fakeredis(*args, **kwargs)
+    end
+  end
+end

-------------------

That resulted in *456* test failures. Either there's a glaring problem
with my patch, or it needs much more of an update.

Given this information, I'm inclined to go with removal of ruby-
fakeredis and reverse dependencies:

$ reverse-depends src:ruby-fakeredis
$ reverse-depends -b src:ruby-fakeredis
Reverse-Build-Depends
=====================
* ruby-feature                  (for ruby-fakeredis)
* ruby-rollout                  (for ruby-fakeredis)

$ reverse-depends -b src:ruby-feature
No reverse dependencies found
$ reverse-depends src:ruby-feature
No reverse dependencies found
$ reverse-depends -b src:ruby-rollout
No reverse dependencies found
$ reverse-depends src:ruby-rollout
No reverse dependencies found

Let me know what you think.

** Affects: ruby-fakeredis (Ubuntu)
     Importance: Critical
         Status: Triaged

** Affects: ruby-feature (Ubuntu)
     Importance: Critical
         Status: Triaged

** Affects: ruby-redis (Ubuntu)
     Importance: Critical
         Status: In Progress

** Affects: ruby-rollout (Ubuntu)
     Importance: Critical
         Status: Triaged


** Tags: autopkgtest ftbfs update-excuse

** Also affects: ruby-redis (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: ruby-feature (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: ruby-rollout (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: ruby-feature (Ubuntu)
       Status: New => Triaged

** Changed in: ruby-feature (Ubuntu)
   Importance: Undecided => Critical

** Changed in: ruby-redis (Ubuntu)
       Status: New => In Progress

** Changed in: ruby-redis (Ubuntu)
   Importance: Undecided => Critical

** Changed in: ruby-rollout (Ubuntu)
       Status: New => Triaged

** Changed in: ruby-rollout (Ubuntu)
   Importance: Undecided => Critical

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2100973

Title:
  [p-m] Please remove ruby-fakeredis to let ruby-redis 5 in

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ruby-fakeredis/+bug/2100973/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to