Skip to contentSkip to conversation

tst_security.sh: Fix bug in tst_disable_selinux()

PATCH Applied Avinesh Kumar via ltp 2 participants 4 messages Jun 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_security.sh: Fix bug in tst_disable_selinux()

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/[email protected]/

---
 testcases/lib/tst_security.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_security.sh +1 -1
index 820736c72..ab1dff816 100644
@@ -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
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Avinesh,

Quoted 1 line · Avinesh Kumar

tst_security.sh: Fix bug in tst_disable_selinux()

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp