[前][次][番号順一覧][スレッド一覧]

ruby-changes:45192

From: nobu <ko1@a...>
Date: Wed, 4 Jan 2017 17:21:18 +0900 (JST)
Subject: [ruby-changes:45192] nobu:r57265 (trunk): win32/resolv.rb: ad hoc workaround

nobu	2017-01-04 17:21:14 +0900 (Wed, 04 Jan 2017)

  New Revision: 57265

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57265

  Log:
    win32/resolv.rb: ad hoc workaround
    
    * ext/win32/lib/win32/resolv.rb (Win32::Resolv::SZ): an ad hoc
      workaround for broken registry.  SearchList and other registry
      values must be REG_SZ, or Windows ignores anything in those
      values otherwise.  [ruby-dev:49924] [Bug #13081]
      https://github.com/rubygems/rubygems/issues/1700

  Modified files:
    trunk/ext/win32/lib/win32/resolv.rb
Index: ext/win32/lib/win32/resolv.rb
===================================================================
--- ext/win32/lib/win32/resolv.rb	(revision 57264)
+++ ext/win32/lib/win32/resolv.rb	(revision 57265)
@@ -60,6 +60,21 @@ module Win32 https://github.com/ruby/ruby/blob/trunk/ext/win32/lib/win32/resolv.rb#L60
 # Windows NT
 #====================================================================
   module Resolv
+    module SZ
+      refine Registry do
+        # ad hoc workaround for broken registry
+        def read_s(key)
+          type, str = read(key)
+          unless type == Registry::REG_SZ
+            warn "Broken registry, #{name}\\#{key} was #{Registry.type2name(type)}, ignored"
+            return String.new
+          end
+          str
+        end
+      end
+    end
+    using SZ
+
     TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
 
     class << self

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]