diff mbox series

Ensure that nsswitch.conf for nss/tst-reload[12] are really synced.

Message ID 20210310152250.3777297-1-stli@linux.ibm.com
State Dropped
Headers show
Series Ensure that nsswitch.conf for nss/tst-reload[12] are really synced. | expand

Commit Message

Stefan Liebler March 10, 2021, 3:22 p.m. UTC
Both tests, nss/tst-reload1 and nss/tst-reload2 are test-container
tests and both provide a root directory for the container.

Unfortunately on a fresh git clone, all the nsswitch files have
the same size of 40bytes and timestamp:
nss/tst-reload1.root/etc/nsswitch.conf2
nss/tst-reload2.root/etc/nsswitch.conf
nss/tst-reload2.root/subdir/etc/nsswitch.conf
nss/tst-reload1.root/etc/nsswitch.conf

After running tst-reload1, the <objpfx>/testroot.root/etc/nsswitch.conf
file has the content of nss/tst-reload1.root/etc/nsswitch.conf2.

Rerunning with "make t=nss/tst-reload1 test" leads to fails
as nsswitch.conf is not synced by test-container.c.

Therefore this patch just adds different comments to those files
to ensure that test-container.c is always syncing them.
---
 nss/tst-reload1.root/etc/nsswitch.conf  | 4 ++++
 nss/tst-reload1.root/etc/nsswitch.conf2 | 3 +++
 nss/tst-reload2.root/etc/nsswitch.conf  | 2 ++
 3 files changed, 9 insertions(+)

Comments

H.J. Lu March 10, 2021, 4:26 p.m. UTC | #1
On Wed, Mar 10, 2021 at 8:06 AM Stefan Liebler via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Both tests, nss/tst-reload1 and nss/tst-reload2 are test-container
> tests and both provide a root directory for the container.
>
> Unfortunately on a fresh git clone, all the nsswitch files have
> the same size of 40bytes and timestamp:
> nss/tst-reload1.root/etc/nsswitch.conf2
> nss/tst-reload2.root/etc/nsswitch.conf
> nss/tst-reload2.root/subdir/etc/nsswitch.conf
> nss/tst-reload1.root/etc/nsswitch.conf
>
> After running tst-reload1, the <objpfx>/testroot.root/etc/nsswitch.conf
> file has the content of nss/tst-reload1.root/etc/nsswitch.conf2.
>
> Rerunning with "make t=nss/tst-reload1 test" leads to fails
> as nsswitch.conf is not synced by test-container.c.
>
> Therefore this patch just adds different comments to those files
> to ensure that test-container.c is always syncing them.
> ---
>  nss/tst-reload1.root/etc/nsswitch.conf  | 4 ++++
>  nss/tst-reload1.root/etc/nsswitch.conf2 | 3 +++
>  nss/tst-reload2.root/etc/nsswitch.conf  | 2 ++
>  3 files changed, 9 insertions(+)
>
> diff --git a/nss/tst-reload1.root/etc/nsswitch.conf b/nss/tst-reload1.root/etc/nsswitch.conf
> index 606d8f51d6..56248fc8a3 100644
> --- a/nss/tst-reload1.root/etc/nsswitch.conf
> +++ b/nss/tst-reload1.root/etc/nsswitch.conf
> @@ -1,3 +1,7 @@
> +# This nsswitch.conf file should be synced by test-container.c while starting
> +# tst-reload1.  Ensure that the size differs compared to the other
> +# nsswitch.conf[2] files of tst-reload1 or tst-reload2.  Otherwise
> +# test-container.c won't sync it.
>  passwd:        test1
>  group: test1
>  hosts: test1
> diff --git a/nss/tst-reload1.root/etc/nsswitch.conf2 b/nss/tst-reload1.root/etc/nsswitch.conf2
> index 2e93977efb..762dcc3f36 100644
> --- a/nss/tst-reload1.root/etc/nsswitch.conf2
> +++ b/nss/tst-reload1.root/etc/nsswitch.conf2
> @@ -1,3 +1,6 @@
> +# This nsswitch.conf will be used while running tst-reload2.
> +# Ensure that the size differs compared to the other nsswitch.conf[2] files of
> +# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
>  passwd:        test2
>  group: test2
>  hosts: test2
> diff --git a/nss/tst-reload2.root/etc/nsswitch.conf b/nss/tst-reload2.root/etc/nsswitch.conf
> index 688a589519..fbe057480f 100644
> --- a/nss/tst-reload2.root/etc/nsswitch.conf
> +++ b/nss/tst-reload2.root/etc/nsswitch.conf
> @@ -1,3 +1,5 @@
> +# Ensure that the size differs compared to the other nsswitch.conf[2] files of
> +# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
>  passwd: test1
>  group: test2
>  hosts: files
> --
> 2.28.0
>

Does this fix

https://sourceware.org/bugzilla/show_bug.cgi?id=27537

If yes, please mention it in the commit log.

Thanks.
Stefan Liebler March 11, 2021, 8:25 a.m. UTC | #2
On 3/10/21 5:26 PM, H.J. Lu wrote:
> On Wed, Mar 10, 2021 at 8:06 AM Stefan Liebler via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> Both tests, nss/tst-reload1 and nss/tst-reload2 are test-container
>> tests and both provide a root directory for the container.
>>
>> Unfortunately on a fresh git clone, all the nsswitch files have
>> the same size of 40bytes and timestamp:
>> nss/tst-reload1.root/etc/nsswitch.conf2
>> nss/tst-reload2.root/etc/nsswitch.conf
>> nss/tst-reload2.root/subdir/etc/nsswitch.conf
>> nss/tst-reload1.root/etc/nsswitch.conf
>>
>> After running tst-reload1, the <objpfx>/testroot.root/etc/nsswitch.conf
>> file has the content of nss/tst-reload1.root/etc/nsswitch.conf2.
>>
>> Rerunning with "make t=nss/tst-reload1 test" leads to fails
>> as nsswitch.conf is not synced by test-container.c.
>>
>> Therefore this patch just adds different comments to those files
>> to ensure that test-container.c is always syncing them.
>> ---
>>  nss/tst-reload1.root/etc/nsswitch.conf  | 4 ++++
>>  nss/tst-reload1.root/etc/nsswitch.conf2 | 3 +++
>>  nss/tst-reload2.root/etc/nsswitch.conf  | 2 ++
>>  3 files changed, 9 insertions(+)
>>
>> diff --git a/nss/tst-reload1.root/etc/nsswitch.conf b/nss/tst-reload1.root/etc/nsswitch.conf
>> index 606d8f51d6..56248fc8a3 100644
>> --- a/nss/tst-reload1.root/etc/nsswitch.conf
>> +++ b/nss/tst-reload1.root/etc/nsswitch.conf
>> @@ -1,3 +1,7 @@
>> +# This nsswitch.conf file should be synced by test-container.c while starting
>> +# tst-reload1.  Ensure that the size differs compared to the other
>> +# nsswitch.conf[2] files of tst-reload1 or tst-reload2.  Otherwise
>> +# test-container.c won't sync it.
>>  passwd:        test1
>>  group: test1
>>  hosts: test1
>> diff --git a/nss/tst-reload1.root/etc/nsswitch.conf2 b/nss/tst-reload1.root/etc/nsswitch.conf2
>> index 2e93977efb..762dcc3f36 100644
>> --- a/nss/tst-reload1.root/etc/nsswitch.conf2
>> +++ b/nss/tst-reload1.root/etc/nsswitch.conf2
>> @@ -1,3 +1,6 @@
>> +# This nsswitch.conf will be used while running tst-reload2.
>> +# Ensure that the size differs compared to the other nsswitch.conf[2] files of
>> +# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
>>  passwd:        test2
>>  group: test2
>>  hosts: test2
>> diff --git a/nss/tst-reload2.root/etc/nsswitch.conf b/nss/tst-reload2.root/etc/nsswitch.conf
>> index 688a589519..fbe057480f 100644
>> --- a/nss/tst-reload2.root/etc/nsswitch.conf
>> +++ b/nss/tst-reload2.root/etc/nsswitch.conf
>> @@ -1,3 +1,5 @@
>> +# Ensure that the size differs compared to the other nsswitch.conf[2] files of
>> +# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
>>  passwd: test1
>>  group: test2
>>  hosts: files
>> --
>> 2.28.0
>>
> 
> Does this fix
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=27537
> 
> If yes, please mention it in the commit log.
> 
> Thanks.
> 

I'm getting the same output as mentioned in the bugzilla:
$ cd <builddir>
$ rm -f testroot.root/etc/nsswitch.conf
$ make t=nss/tst-reload1 test
PASS: nss/tst-reload1
$ cat testroot.root/etc/nsswitch.conf
passwd:	test2
group:	test2
hosts:	test2

$ make t=nss/tst-reload2 test
tst-reload2.c:112: numeric comparison failure
   left: 5 (0x5); from: pw->pw_uid
  right: 1234 (0x4d2); from: 1234
error: tst-reload2.c:130: not true: pw->pw_uid != 2468
tst-reload2.c:136: numeric comparison failure
   left: 5 (0x5); from: pw->pw_uid
  right: 1234 (0x4d2); from: 1234
error: tst-reload2.c:146: not true: he != NULL
error: 4 test failures

$ cat testroot.root/etc/nsswitch.conf
passwd:	test2
group:	test2
hosts:	test2

According to tst-reload2.c and current nsswitch.conf, it is using
pwd_table2, which is PWD_N (5, "test1"). According to the
nss/tst-reload2.root/etc/nsswitch.conf, it should use PWD_N (1234,
"test1") of pwd_table1.

Thus, yes, I assume this is the same issue.

Bye,
Stefan
diff mbox series

Patch

diff --git a/nss/tst-reload1.root/etc/nsswitch.conf b/nss/tst-reload1.root/etc/nsswitch.conf
index 606d8f51d6..56248fc8a3 100644
--- a/nss/tst-reload1.root/etc/nsswitch.conf
+++ b/nss/tst-reload1.root/etc/nsswitch.conf
@@ -1,3 +1,7 @@ 
+# This nsswitch.conf file should be synced by test-container.c while starting
+# tst-reload1.  Ensure that the size differs compared to the other
+# nsswitch.conf[2] files of tst-reload1 or tst-reload2.  Otherwise
+# test-container.c won't sync it.
 passwd:	test1
 group:	test1
 hosts:	test1
diff --git a/nss/tst-reload1.root/etc/nsswitch.conf2 b/nss/tst-reload1.root/etc/nsswitch.conf2
index 2e93977efb..762dcc3f36 100644
--- a/nss/tst-reload1.root/etc/nsswitch.conf2
+++ b/nss/tst-reload1.root/etc/nsswitch.conf2
@@ -1,3 +1,6 @@ 
+# This nsswitch.conf will be used while running tst-reload2.
+# Ensure that the size differs compared to the other nsswitch.conf[2] files of
+# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
 passwd:	test2
 group:	test2
 hosts:	test2
diff --git a/nss/tst-reload2.root/etc/nsswitch.conf b/nss/tst-reload2.root/etc/nsswitch.conf
index 688a589519..fbe057480f 100644
--- a/nss/tst-reload2.root/etc/nsswitch.conf
+++ b/nss/tst-reload2.root/etc/nsswitch.conf
@@ -1,3 +1,5 @@ 
+# Ensure that the size differs compared to the other nsswitch.conf[2] files of
+# tst-reload1 or tst-reload2.  Otherwise test-container.c won't sync it.
 passwd: test1
 group: test2
 hosts: files