Project

General

Profile

Actions

Bug #13081

closed

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

Bug #13081: resolv.rb may be the cause of the rubygems bug on Windows

Added by kozo2 (Kozo Nishida) almost 9 years ago. Updated over 8 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) almost 9 years ago Actions #1 [ruby-dev:49925]

Seems the registry is broken.

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago Actions #2 [ruby-dev:49927]

s/repository/registry/

Updated by kou (Kouhei Sutou) almost 9 years ago Actions #3 [ruby-dev:49932]

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) almost 9 years ago Actions #4 [ruby-dev:49933]

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) almost 9 years ago Actions #5 [ruby-dev:49943]

I think that to warn and ignore is nice.

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago Actions #6

  • Status changed from Open to Closed

Applied in changeset r57265.


win32/resolv.rb: ad hoc workaround

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago Actions #7 [ruby-dev:49946]

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

Updated by usa (Usaku NAKAMURA) almost 9 years ago Actions #8 [ruby-dev:49947]

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) over 8 years ago Actions #9 [ruby-dev:49983]

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)

Updated by usa (Usaku NAKAMURA) over 8 years ago Actions #10

  • 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) over 8 years ago Actions #11 [ruby-dev:50044]

  • 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) over 8 years ago Actions #12 [ruby-dev:50051]

  • 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) over 8 years ago Actions #13 [ruby-dev:50112]

  • 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: PDF Atom