This is the mail archive of the
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: <email@example.com/bugzilla/>
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 :
> 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 (
> 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
(1) What is the default without nsswitch.conf?
We define DEFAULT_CONFIG in the source file that is used to define the service.
19 #define DATABASE_NAME hosts
20 #define DEFAULT_CONFIG "dns [!UNAVAIL=return] files"
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
- 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.