diff mbox series

[1/1] isofs.sh: Use nobody user

Message ID 20240830113913.49675-1-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/1] isofs.sh: Use nobody user | expand

Commit Message

Petr Vorel Aug. 30, 2024, 11:39 a.m. UTC
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>
---
This should replace
https://patchwork.ozlabs.org/project/ltp/patch/20240829065933.21902-1-wegao@suse.com/

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

Patch

diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index d1a362d979..d849a9acbf 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_USER" ] || 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