Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_security.sh: Fix bug in tst_disable_selinux()
@ 2026-06-16  9:22 Avinesh Kumar via ltp
  2026-06-16 10:09 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Avinesh Kumar via ltp @ 2026-06-16  9:22 UTC (permalink / raw)
  To: ltp

  tst_disable_selinux() used "cat 0 > $f" which attempts to read a file
  named "0" instead of writing the value 0 to the enforce file. Replace
  with "echo 0 > $f" to correctly disable SELinux enforcing mode.

  Reported by ltp-agent [0]

[0] https://lore.kernel.org/ltp/20260615131754.3990-1-linuxtestproject.agent@gmail.com/

Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
 testcases/lib/tst_security.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 820736c72..ab1dff816 100644
--- a/testcases/lib/tst_security.sh
+++ b/testcases/lib/tst_security.sh
@@ -119,7 +119,7 @@ tst_disable_selinux()
 
 	local f="$(tst_get_enforce)"
 
-	[ -f "$f" ] && cat 0 > $f
+	[ -f "$f" ] && echo 0 > $f
 }
 
 # Get SELinux directory path
-- 
2.54.0


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

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

end of thread, other threads:[~2026-06-16 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16  9:22 [LTP] [PATCH] tst_security.sh: Fix bug in tst_disable_selinux() Avinesh Kumar via ltp
2026-06-16 10:09 ` [LTP] " linuxtestproject.agent
2026-06-16 10:43 ` [LTP] [PATCH] " Andrea Cervesato via ltp
2026-06-16 10:43 ` Andrea Cervesato via ltp

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