diff mbox series

Fix failing nss/tst-nss-files-hosts-long.

Message ID 20210709090448.255261-1-stli@linux.ibm.com
State New
Headers show
Series Fix failing nss/tst-nss-files-hosts-long. | expand

Commit Message

Stefan Liebler July 9, 2021, 9:04 a.m. UTC
Sometimes the test nss/tst-nss-files-hosts-long is failing as getent
fails with exit-code 2.

This happens e.g. if tst-reload1 was run just before this test:
make t=nss/tst-reload1 test
make t=nss/tst-nss-files-hosts-long test
Then the test fails as /etc/nsswitch.conf contains "hosts: test2".

If /etc/nsswitch.conf is not present or there is no hosts line,
then it defaults to "hosts: dns [!UNAVAIL=return] files".
I've also observed a case, where dns returns with NSS_STATUS_NOTFOUND
and thus getent also fails with exit-code 2 without searching in
/etc/hosts.

Thus, this patch just uses "hosts: files" in nsswitch.conf.
---
 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

Florian Weimer July 9, 2021, 9:21 a.m. UTC | #1
* Stefan Liebler via Libc-alpha:

> Sometimes the test nss/tst-nss-files-hosts-long is failing as getent
> fails with exit-code 2.
>
> This happens e.g. if tst-reload1 was run just before this test:
> make t=nss/tst-reload1 test
> make t=nss/tst-nss-files-hosts-long test
> Then the test fails as /etc/nsswitch.conf contains "hosts: test2".
>
> If /etc/nsswitch.conf is not present or there is no hosts line,
> then it defaults to "hosts: dns [!UNAVAIL=return] files".
> I've also observed a case, where dns returns with NSS_STATUS_NOTFOUND
> and thus getent also fails with exit-code 2 without searching in
> /etc/hosts.
>
> Thus, this patch just uses "hosts: files" in nsswitch.conf.
> ---
>  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

I think the issue is that nss/tst-reload1 clobbers the test chroot
without indicating so.  A file nss/tst-reload1.root/postclean.req
appears to be missing.

Thanks,
Florian
Stefan Liebler July 12, 2021, 8:47 a.m. UTC | #2
On 09/07/2021 11:21, Florian Weimer wrote:
> * Stefan Liebler via Libc-alpha:
> 
>> Sometimes the test nss/tst-nss-files-hosts-long is failing as getent
>> fails with exit-code 2.
>>
>> This happens e.g. if tst-reload1 was run just before this test:
>> make t=nss/tst-reload1 test
>> make t=nss/tst-nss-files-hosts-long test
>> Then the test fails as /etc/nsswitch.conf contains "hosts: test2".
>>
>> If /etc/nsswitch.conf is not present or there is no hosts line,
>> then it defaults to "hosts: dns [!UNAVAIL=return] files".
>> I've also observed a case, where dns returns with NSS_STATUS_NOTFOUND
>> and thus getent also fails with exit-code 2 without searching in
>> /etc/hosts.
>>
>> Thus, this patch just uses "hosts: files" in nsswitch.conf.
>> ---
>>  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
> 
> I think the issue is that nss/tst-reload1 clobbers the test chroot
> without indicating so.  A file nss/tst-reload1.root/postclean.req
> appears to be missing.
> 
> Thanks,
> Florian
> 

I've just send a v2 patch with the postclean.req:
https://sourceware.org/pipermail/libc-alpha/2021-July/128919.html

Thanks,
Stefan
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