diff mbox series

Fix failing nss/tst-nss-files-hosts-long with local resolver

Message ID 20210902225639.509231-1-aurelien@aurel32.net
State New
Headers show
Series Fix failing nss/tst-nss-files-hosts-long with local resolver | expand

Commit Message

Aurelien Jarno Sept. 2, 2021, 10:56 p.m. UTC
When a local resolver like unbound is listening on the IPv4 loopback
address 127.0.0.1, the nss/tst-nss-files-hosts-long test fails. This is
due to:
- the default resolver in the absence of resolv.conf being 127.0.0.1
- the default DNS NSS database configuration in the absence of
  nsswitch.conf being 'hosts: dns [!UNAVAIL=return] file'

This causes the requests for 'test4' and 'test6' to first be sent to the
local resolver, which responds with NXDOMAIN in the likely case those
records do no exist. In turn that causes the access to /etc/hosts to be
skipped, which is the purpose of that test.

Fix that by providing a simple nsswitch.conf file forcing access to
/etc/hosts for that test. I have tested that the only changed result in
the testsuite is that test.
---
 nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf

Comments

DJ Delorie Sept. 3, 2021, 3:27 a.m. UTC | #1
Aurelien Jarno <aurelien@aurel32.net> writes:
> Fix that by providing a simple nsswitch.conf file forcing access to
> /etc/hosts for that test. I have tested that the only changed result in
> the testsuite is that test.

LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>

>  nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf | 1 +
>  1 file changed, 1 insertion(+)
>  create mode 100644 nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
>
> diff --git a/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
> new file mode 100644
> index 0000000000..5b0c6a4199
> --- /dev/null
> +++ b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
> @@ -0,0 +1 @@
> +hosts: files
diff mbox series

Patch

diff --git a/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
new file mode 100644
index 0000000000..5b0c6a4199
--- /dev/null
+++ b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
@@ -0,0 +1 @@ 
+hosts: files