public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
@ 2024-09-02  6:27 Petr Vorel
  2024-09-02  6:51 ` Wei Gao via ltp
  2024-09-03 10:06 ` Cyril Hrubis
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2024-09-02  6:27 UTC (permalink / raw)
  To: ltp

From: Wei Gao <wegao@suse.com>

Some distros don't have user/group 'bin' (e.g. SUSE SLE-Micro).
Although this user/group is required and created IDcheck.sh.
(This script should be replaced in the future with library call,
but it's still supported).

Replace 'bin' user/group with 'nobody' user (more common on various
Linux distributions). Most of the distros name have 'nobody' user's
group also 'nobody', but at least Debian name it 'nogroup'. Therefore
detect this name with 'id -g -n'.

Reported-by: Wei Gao <wegao@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Correct fallback condition (thanks Wei for the report):
-	[ "$TEST_USER" ] || TEST_GROUP="$TEST_USER"
+	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"

 testcases/kernel/fs/iso9660/isofs.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index d1a362d979..088e062d67 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -13,10 +13,19 @@ TST_NEEDS_CMDS="mount umount"
 TST_NEEDS_TMPDIR=1
 TST_TESTFUNC=do_test
 TST_CNT=3
+TST_SETUP="setup"
 
 MAX_DEPTH=3
 MAX_DIRS=4
 
+TEST_USER='nobody'
+
+setup()
+{
+	TEST_GROUP="$(id -g -n $TEST_USER)"
+	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"
+}
+
 gen_fs_tree()
 {
 	local cur_path="$1"
@@ -92,8 +101,8 @@ do_test()
 			"loop,block=512,unhide" \
 			"loop,block=1024,cruft" \
 			"loop,block=2048,nocompress" \
-			"loop,check=strict,map=off,gid=bin,uid=bin" \
-			"loop,check=strict,map=acorn,gid=bin,uid=bin" \
+			"loop,check=strict,map=off,gid=$TEST_GROUP,uid=$TEST_USER" \
+			"loop,check=strict,map=acorn,gid=$TEST_GROUP,uid=$TEST_USER" \
 			"loop,check=relaxed,map=normal" \
 			"loop,block=512,unhide,session=2"
 		do
-- 
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
  2024-09-02  6:27 [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user Petr Vorel
@ 2024-09-02  6:51 ` Wei Gao via ltp
  2024-09-02  7:16   ` Petr Vorel
  2024-09-03 10:06 ` Cyril Hrubis
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Gao via ltp @ 2024-09-02  6:51 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Mon, Sep 02, 2024 at 08:27:38AM +0200, Petr Vorel wrote:
> From: Wei Gao <wegao@suse.com>
> 
> Some distros don't have user/group 'bin' (e.g. SUSE SLE-Micro).
> Although this user/group is required and created IDcheck.sh.
> (This script should be replaced in the future with library call,
> but it's still supported).
> 
> Replace 'bin' user/group with 'nobody' user (more common on various
> Linux distributions). Most of the distros name have 'nobody' user's
> group also 'nobody', but at least Debian name it 'nogroup'. Therefore
> detect this name with 'id -g -n'.
> 
> Reported-by: Wei Gao <wegao@suse.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Changes v1->v2:
> * Correct fallback condition (thanks Wei for the report):
> -	[ "$TEST_USER" ] || TEST_GROUP="$TEST_USER"
> +	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"
> 
>  testcases/kernel/fs/iso9660/isofs.sh | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
> index d1a362d979..088e062d67 100755
> --- a/testcases/kernel/fs/iso9660/isofs.sh
> +++ b/testcases/kernel/fs/iso9660/isofs.sh
> @@ -13,10 +13,19 @@ TST_NEEDS_CMDS="mount umount"
>  TST_NEEDS_TMPDIR=1
>  TST_TESTFUNC=do_test
>  TST_CNT=3
> +TST_SETUP="setup"
>  
>  MAX_DEPTH=3
>  MAX_DIRS=4
>  
> +TEST_USER='nobody'
> +
> +setup()
> +{
> +	TEST_GROUP="$(id -g -n $TEST_USER)"
> +	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"
If $TEST_GROUP can not be found then this case will failed unless we create new group.
My suggestion is remove above line totally or we start create group for nobody user.
> +}
> +
>  gen_fs_tree()
>  {
>  	local cur_path="$1"
> @@ -92,8 +101,8 @@ do_test()
>  			"loop,block=512,unhide" \
>  			"loop,block=1024,cruft" \
>  			"loop,block=2048,nocompress" \
> -			"loop,check=strict,map=off,gid=bin,uid=bin" \
> -			"loop,check=strict,map=acorn,gid=bin,uid=bin" \
> +			"loop,check=strict,map=off,gid=$TEST_GROUP,uid=$TEST_USER" \
> +			"loop,check=strict,map=acorn,gid=$TEST_GROUP,uid=$TEST_USER" \
>  			"loop,check=relaxed,map=normal" \
>  			"loop,block=512,unhide,session=2"
>  		do
> -- 
> 2.45.2
> 

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
  2024-09-02  6:51 ` Wei Gao via ltp
@ 2024-09-02  7:16   ` Petr Vorel
  2024-09-02  8:00     ` Wei Gao via ltp
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2024-09-02  7:16 UTC (permalink / raw)
  To: Wei Gao; +Cc: ltp

Hi Wei,

> > +TEST_USER='nobody'
> > +
> > +setup()
> > +{
> > +	TEST_GROUP="$(id -g -n $TEST_USER)"
> > +	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"
> If $TEST_GROUP can not be found then this case will failed unless we create new group.
> My suggestion is remove above line totally or we start create group for nobody user.

That check is a fallback if 'id' is not installed but there is requested
nobody:nobody or nobody/nogroup group set by IDcheck.sh or manually.

But sure, I can delete it if we expect id to be installed. I just did not want
to require 'id' for this test when there can be a workaround.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
  2024-09-02  7:16   ` Petr Vorel
@ 2024-09-02  8:00     ` Wei Gao via ltp
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Gao via ltp @ 2024-09-02  8:00 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Mon, Sep 02, 2024 at 09:16:15AM +0200, Petr Vorel wrote:
> Hi Wei,
> 
> > > +TEST_USER='nobody'
> > > +
> > > +setup()
> > > +{
> > > +	TEST_GROUP="$(id -g -n $TEST_USER)"
> > > +	[ "$TEST_GROUP" ] || TEST_GROUP="$TEST_USER"
> > If $TEST_GROUP can not be found then this case will failed unless we create new group.
> > My suggestion is remove above line totally or we start create group for nobody user.
> 
> That check is a fallback if 'id' is not installed but there is requested
> nobody:nobody or nobody/nogroup group set by IDcheck.sh or manually.
Thanks for your explaination. Then no question from my side.

Acked-by: Wei Gao <wegao@suse.com>

> 
> But sure, I can delete it if we expect id to be installed. I just did not want
> to require 'id' for this test when there can be a workaround.
> 
> Kind regards,
> Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
  2024-09-02  6:27 [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user Petr Vorel
  2024-09-02  6:51 ` Wei Gao via ltp
@ 2024-09-03 10:06 ` Cyril Hrubis
  2024-09-03 12:47   ` Petr Vorel
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2024-09-03 10:06 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user
  2024-09-03 10:06 ` Cyril Hrubis
@ 2024-09-03 12:47   ` Petr Vorel
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2024-09-03 12:47 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

thanks for your review, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-09-03 12:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02  6:27 [LTP] [PATCH v2 1/1] isofs.sh: Use nobody user Petr Vorel
2024-09-02  6:51 ` Wei Gao via ltp
2024-09-02  7:16   ` Petr Vorel
2024-09-02  8:00     ` Wei Gao via ltp
2024-09-03 10:06 ` Cyril Hrubis
2024-09-03 12:47   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox