ruby-changes:46048
From: usa <ko1@a...>
Date: Sun, 26 Mar 2017 03:22:41 +0900 (JST)
Subject: [ruby-changes:46048] usa:r58119 (ruby_2_2): merge revision(s) 57265, 57266: [Backport #13081]
usa 2017-03-26 03:22:34 +0900 (Sun, 26 Mar 2017) New Revision: 58119 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58119 Log: merge revision(s) 57265,57266: [Backport #13081] 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 win32/registry.rb: registry type names * ext/win32/lib/win32/registry.rb (Win32::Registry#read): show registry type names instead of numeric values. Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ext/win32/lib/win32/registry.rb branches/ruby_2_2/ext/win32/lib/win32/resolv.rb branches/ruby_2_2/version.h Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 58118) +++ ruby_2_2/version.h (revision 58119) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.7" #define RUBY_RELEASE_DATE "2017-03-26" -#define RUBY_PATCHLEVEL 451 +#define RUBY_PATCHLEVEL 452 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_2/ext/win32/lib/win32/registry.rb =================================================================== --- ruby_2_2/ext/win32/lib/win32/registry.rb (revision 58118) +++ ruby_2_2/ext/win32/lib/win32/registry.rb (revision 58119) @@ -641,7 +641,9 @@ For detail, see the MSDN[http://msdn.mic https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/win32/lib/win32/registry.rb#L641 def read(name, *rtype) type, data = API.QueryValue(@hkey, name) unless rtype.empty? or rtype.include?(type) - raise TypeError, "Type mismatch (expect #{rtype.inspect} but #{type} present)" + raise TypeError, "Type mismatch (expect [#{ + rtype.map{|t|Registry.type2name(t)}.join(', ')}] but #{ + Registry.type2name(type)} present)" end case type when REG_SZ, REG_EXPAND_SZ @@ -657,7 +659,7 @@ For detail, see the MSDN[http://msdn.mic https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/win32/lib/win32/registry.rb#L659 when REG_QWORD [ type, API.unpackqw(data) ] else - raise TypeError, "Type #{type} is not supported." + raise TypeError, "Type #{Registry.type2name(type)} is not supported." end end @@ -680,7 +682,7 @@ For detail, see the MSDN[http://msdn.mic https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/win32/lib/win32/registry.rb#L682 when REG_EXPAND_SZ Registry.expand_environ(data) else - raise TypeError, "Type #{type} is not supported." + raise TypeError, "Type #{Registry.type2name(type)} is not supported." end end @@ -753,7 +755,7 @@ For detail, see the MSDN[http://msdn.mic https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/win32/lib/win32/registry.rb#L755 when REG_QWORD data = API.packqw(data.to_i) else - raise TypeError, "Unsupported type #{type}" + raise TypeError, "Unsupported type #{Registry.type2name(type)}" end API.SetValue(@hkey, name, type, data, data.bytesize + termsize) end Index: ruby_2_2/ext/win32/lib/win32/resolv.rb =================================================================== --- ruby_2_2/ext/win32/lib/win32/resolv.rb (revision 58118) +++ ruby_2_2/ext/win32/lib/win32/resolv.rb (revision 58119) @@ -45,6 +45,21 @@ if info.unpack('V5')[4] == 2 # VER_PLAT https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/win32/lib/win32/resolv.rb#L45 # Windows NT #==================================================================== module_eval <<-'__EOS__', __FILE__, __LINE__+1 + 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 Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r57265-57266 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/