[LTP] [PATCH] tst_security.sh: Fix bug in tst_disable_selinux()

Avinesh Kumar avinesh.kumar@suse.com
Tue Jun 16 11:22:59 CEST 2026


  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



More information about the ltp mailing list