Skip to content

Fix Resolv#initialize signature: array of resolvers + use_ipv6:#2960

Merged
ksss merged 1 commit into
ruby:masterfrom
zonuexe:fix/widen-resolv-sigs
May 21, 2026
Merged

Fix Resolv#initialize signature: array of resolvers + use_ipv6:#2960
ksss merged 1 commit into
ruby:masterfrom
zonuexe:fix/widen-resolv-sigs

Conversation

@zonuexe
Copy link
Copy Markdown
Contributor

@zonuexe zonuexe commented May 20, 2026

Resolv#initialize took ?Resolv::Hosts | Resolv::DNS resolvers, which is wrong on two counts, both visible in this file's own RD doc (new(resolvers=..., use_ipv6: ...)):

  • resolvers is the resolver list, not a single resolver — Ruby's implementation iterates it (@resolvers.each). Passing one resolver object fails at runtime. It accepts an Array of resolver objects, a Hash (used as DNS-resolver configuration, per the doc), or nil.
  • the use_ipv6: keyword was missing from the signature entirely.

See https://github.com/ruby/ruby/blob/v4.0.5/lib/resolv.rb#L82-L100

`Resolv#initialize` took `?Resolv::Hosts | Resolv::DNS resolvers`,
which is wrong on two counts, both visible in this file's own RD doc
(`new(resolvers=..., use_ipv6: ...)`):

- `resolvers` is the resolver *list*, not a single resolver — Ruby's
  implementation iterates it (`@resolvers.each`). Passing one resolver
  object fails at runtime. It accepts an Array of resolver objects, a
  Hash (used as DNS-resolver configuration, per the doc), or nil.
- the `use_ipv6:` keyword was missing from the signature entirely.
@ksss ksss added this to the RBS 4.1 milestone May 21, 2026
@ksss
Copy link
Copy Markdown
Collaborator

ksss commented May 21, 2026

👍

@ksss ksss merged commit fa84359 into ruby:master May 21, 2026
24 of 25 checks passed
@zonuexe zonuexe deleted the fix/widen-resolv-sigs branch May 21, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants