[PATCH] resolv: Avoid duplicate query if search list contains '.' (option 2)
Florian Weimer
fweimer@redhat.com
Fri Jan 9 12:55:01 GMT 2026
* Carlos Peon Costa:
> On Fri, Jan 9, 2026 at 11:40 AM Florian Weimer <fweimer@redhat.com> wrote:
>
>> I think the traditional assumption is that "." in the search list is
>> unsuported and should be removed. I checked the documentation of
>> multiple implementations, and no one seems to document the intended
>> behavior of ".".
>>
>> Are you using "." to suppress search list processing?
>>
>
> Yes, I'm using "." to suppress search list processing. Not setting the
> "search" option implies its default value: the local domain name, so
> there is no trivial configuration to disable search list processing.
Thanks for confirming.
> IMO "." in the search list looks weird and I think an empty search
> list (without failing back to local domain name) should be a valid
> configuration to disable search list processing, but that would break
> default behaviour and probably is not an option.
I think the "." approach has leaked into multiple tools that generate
/etc/resolv.conf by now, so we're probably stuck with it. For example,
systemd does this:
if (ordered_set_isempty(domains))
fputs("search .\n", f); /* Make sure that if the local hostname
is chosen as fqdn this does not
* imply a search domain */
else
write_resolv_conf_search(domains, f);
> IMO unsupporting "." in the search list and keeping supporting setting
> hostnames without dots (which both lead to the same scenario: no
> search list processing) seems unnecessary to me.
I agree. It seems that "." mostly does what some users want.
Regarding your patch, ideally we would have a test case for it that
counts the number of queries the system sends, with various
configurations and functions. I think having a container test with
/etc/resolv.conf in it and that "search ." line would work once we add
support for disabling the search path initialization in
resolv_test_start (new bool field in struct resolv_redirect_config
is probably the way). Unfortunately, I won't have time to work on
this myself in the forseeable future.
Thanks,
Florian
More information about the Libc-alpha
mailing list