Project

General

Profile

Actions

Bug #13081

closed

resolv.rb may be the cause of the rubygems bug on Windows

Added by kozo2 (Kozo Nishida) over 7 years ago. Updated almost 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
[ruby-dev:49924]

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

Seems the registry is broken.

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

s/repository/registry/

Updated by kou (Kouhei Sutou) over 7 years ago

How about ignoring the registry value if its type is not expected type?

Index: resolv.rb
===================================================================
--- resolv.rb	(revision 57233)
+++ resolv.rb	(working copy)
@@ -75,8 +75,10 @@
         nameserver = get_dns_server_list
         Registry::HKEY_LOCAL_MACHINE.open(TCPIP_NT) do |reg|
           begin
-            slist = reg.read_s('SearchList')
-            search = slist.split(/,\s*/) unless slist.empty?
+            type, slist = reg.read('SearchList')
+            if type == Registory::REG_SZ
+              search = slist.split(/,\s*/) unless slist.empty?
+            end
           rescue Registry::Error
           end

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

Yes, Windows seems to ignore the value when it is not REG_SZ, too.
But I wonder if it is desirable to ignore such broken registry silently.

Updated by usa (Usaku NAKAMURA) over 7 years ago

I think that to warn and ignore is nice.

Actions #6

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Closed

Applied in changeset r57265.


win32/resolv.rb: ad hoc workaround

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

All registry read operations should warn and return an empty string, instead of TypeError?

Updated by usa (Usaku NAKAMURA) over 7 years ago

Of course, only for this case.
We can not assume the use case of a registry value generally, as you know.

Updated by kozo2 (Kozo Nishida) about 7 years ago

Nobuyoshi Nakada wrote:

Applied in changeset r57265.


win32/resolv.rb: ad hoc workaround

How can I reflect this update to our local Ruby+Windows environment?

(of course this fails.)

C:\Ruby23\bin>gem update --system
ERROR:  While executing gem ... (TypeError)
    Type mismatch (expect [1] but 3 present)
Actions #10

Updated by usa (Usaku NAKAMURA) about 7 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED

Updated by usa (Usaku NAKAMURA) about 7 years ago

  • Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONE, 2.3: REQUIRED, 2.4: REQUIRED

ruby_2_2 r58119 merged revision(s) 57265,57266.

Updated by nagachika (Tomoyuki Chikanaga) about 7 years ago

  • Backport changed from 2.2: DONE, 2.3: REQUIRED, 2.4: REQUIRED to 2.2: DONE, 2.3: DONE, 2.4: REQUIRED

ruby_2_3 r58172 merged revision(s) 57265,57266.

Updated by nagachika (Tomoyuki Chikanaga) almost 7 years ago

  • Backport changed from 2.2: DONE, 2.3: DONE, 2.4: REQUIRED to 2.2: DONE, 2.3: DONE, 2.4: DONE

ruby_2_4 r58630 merged revision(s) 57265,57266.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0