File: support-connection-timeout-fix.patch

package info (click to toggle)
ruby-dalli 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ruby: 9,447; sh: 19; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 1,648 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: Drop memoization of connect_timeout support check
 The supports_connect_timeout? method was memoized at class level, so it only
 checked TCPSocket#initialize parameters once. When socksify or resolv-replace
 override TCPSocket#initialize without supporting **kwargs, the memoized true
 value causes Dalli to pass {connect_timeout: sec} as a positional Hash
 instead of using the fallback Timeout.timeout block, leading to TypeError: no
 implicit conversion of Hash into String during socket creation.
Author: Simon Quigley <tsimonq2@debian.org>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-02-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/dalli/socket.rb
+++ b/lib/dalli/socket.rb
@@ -110,10 +110,7 @@ module Dalli
       # socksify or resolv-replace, which don't support keyword arguments.
       # rubocop:disable ThreadSafety/ClassInstanceVariable
       def self.supports_connect_timeout?
-        return @supports_connect_timeout if defined?(@supports_connect_timeout)
-
-        @supports_connect_timeout = RUBY_VERSION >= '3.0' &&
-                                    ::TCPSocket.instance_method(:initialize).parameters == TCPSOCKET_NATIVE_PARAMETERS
+        RUBY_VERSION >= '3.0' && ::TCPSocket.instance_method(:initialize).parameters == TCPSOCKET_NATIVE_PARAMETERS
       end
       # rubocop:enable ThreadSafety/ClassInstanceVariable
 
--- a/test/test_socket.rb
+++ b/test/test_socket.rb
@@ -26,6 +26,7 @@ describe 'Dalli::Socket::TCP' do
     end
 
     it 'caches the result' do
+      skip
       # First call
       result1 = Dalli::Socket::TCP.supports_connect_timeout?