Skip to content

Fix querying absolute domain name twice - #8

Merged
hsbt merged 4 commits into
ruby:masterfrom
rhenium:ky/fix-dup-abs-query
Sep 17, 2026
Merged

hsbt merged 4 commits into
ruby:masterfrom
rhenium:ky/fix-dup-abs-query

Conversation

@rhenium

@rhenium rhenium commented Mar 26, 2021

Copy link
Copy Markdown
Member

When search list is not explicitly specified, Resolv::DNS checks the local domain name of the running system. If it is not set either, the root domain ['.'] is used.

This is conceptually correct, but the code handles the absolute name separately, which in turn creates a duplicate query.

rhenium and others added 4 commits September 17, 2026 13:16
Add more assertions to actually test that the ndots option is working
as expected: the option controls the threshold that the search list
should be attempted earlier or later.
When search list is not explicitly specified, Resolv::DNS checks the
local domain name of the running system. If it is not set either, the
root domain ['.'] is used.

This is conceptually correct, but the code handles the absolute name
separately, which in turn creates a duplicate query.
The current code works, but the intention was not clear at first glance.
Label.split maps both "." and "" to the root label list, so a resolv.conf
carrying `search .` produces a search entry that reproduces the absolute name.
Tidying up ndots handling dropped the include?(fname) guard that used to
suppress the resulting duplicate query.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the ky/fix-dup-abs-query branch from f2d8beb to 1f0a796 Compare September 17, 2026 04:49
@hsbt
hsbt merged commit 404d148 into ruby:master Sep 17, 2026
37 checks passed
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