This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug manual/25156] discrepancy between NSS documentation and actual behaviour/code if nsswitch.conf is absent
- From: "carlos at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 04 Nov 2019 21:49:36 +0000
- Subject: [Bug manual/25156] discrepancy between NSS documentation and actual behaviour/code if nsswitch.conf is absent
- Auto-submitted: auto-generated
- References: <bug-25156-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=25156
Carlos O'Donell <carlos at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |carlos at redhat dot com
--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Jan Hacker from comment #0)
> I raised this topic in https://github.com/golang/go/issues/35305 :
>
> https://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-
> Configuration-File.html
> states that, in absence of /etc/nsswitch.conf, ...:
> "For the hosts and networks databases the default value is dns
> [!UNAVAIL=return] files."
>
> In contrast,
> https://sourceware.org/git/?p=glibc.git;a=blob;f=nss/nsswitch.c#l157 seems
> to use "files" exclusively, if no /etc/nsswitch.conf is present.
>
> Could you please confirm that the manual (
> https://sourceware.org/git/?p=glibc.git;a=blob;f=manual/nss.texi;
> h=821469a78a298b83c60ed66884fe08e98bb741e0;hb=HEAD#l327 ) is outdated and
> does not reflect current/actual behaviour (of using "files" exclusively in
> absence of nsswitch.conf) ... and if so, update the manual?
>
> Furthermore, the
> https://sourceware.org/git/?p=glibc.git;a=blob;f=nss/nsswitch.conf#l60 uses
> "hosts: files dns" as default.
> I wonder whether it's a good idea to provide a default nsswitch.conf (which
> uses "hosts: files dns"), while nsswitch.c effectively uses only "files" as
> "default" if nsswitch.conf is absent. Wouldn't "files dns" be a more
> user-friendly default in code, as it would match the example/default
> nsswitch.conf?
(1) What is the default without nsswitch.conf?
We define DEFAULT_CONFIG in the source file that is used to define the service.
nss/hosts-lookup.c:
19 #define DATABASE_NAME hosts
20 #define DEFAULT_CONFIG "dns [!UNAVAIL=return] files"
21
22 #include "XXX-lookup.c"
So here we define it in a way that matches the manual.
Then the lookup uses a DEFAULT_CONFIG which is non-NULL and so the code you
quoted is never used for hosts.
(2) What *should* the default be?
I think it should probably be adjusted to "files dns" as we use in modern day
distributions.
In summary:
- I think we're only talking about (2) in this case, but if you have observed
(1) to be wrong, then please say so and provide some debugging details.
--
You are receiving this mail because:
You are on the CC list for the bug.