tst_security.sh: quote variables in selinux helper functions
PATCH 1/1 tst_security.sh: quote variables in selinux helper functions
From: Avinesh Kumar <[email protected]>
Quote variables in tst_disable_selinux() and tst_update_selinux_state() to follow shell quoting best practices.
--- testcases/lib/tst_security.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/lib/tst_security.sh +4 -4
@@ -119,7 +119,7 @@ tst_disable_selinux() local f="$(tst_get_enforce)" - [ -f "$f" ] && echo 0 > $f + [ -f "$f" ] && echo 0 > "$f" } # Get SELinux directory path
@@ -147,8 +147,8 @@ tst_update_selinux_state() [ -n "$dir" ] || return 1 # Toggle enforce to trigger SELinux state measurement - orig_val=$(cat $dir/enforce) + orig_val=$(cat "$dir/enforce") val=$((1 - orig_val)) - echo $val > $dir/enforce - echo $orig_val > $dir/enforce + echo "$val" > "$dir/enforce" + echo "$orig_val" > "$dir/enforce" }
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
Quoted 1 line · Avinesh Kumar
tst_security.sh: quote variables in selinux helper functions
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
Quoted 27 lines · Avinesh Kumar via ltp
From: Avinesh Kumar <[email protected]>
Quote variables in
tst_disable_selinux()andtst_update_selinux_state()to follow shell quoting best practices.Fixes cc9206e612b2 ("tst_security.sh: Use enforce toggle to trigger SELinux measurement")Suggested-by Petr Vorel <[email protected]>Signed-off-by Avinesh Kumar <[email protected]>--- testcases/lib/tst_security.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)testcases/lib/tst_security.sh +1
-1@@ -119,7 +119,7 @@ tst_disable_selinux() local f="$(tst_get_enforce)" - [ -f "$f" ] && echo 0 > $f + [ -f "$f" ] && echo 0 > "$f" } # Get SELinux directory path
testcases/lib/tst_security.sh tst_update_selinux_state() · line 153
Quoted 10 lines
testcases/lib/tst_security.sh +3
-3@@ -147,8 +147,8 @@ tst_update_selinux_state() [ -n "$dir" ] || return 1 # Toggle enforce to trigger SELinux state measurement - orig_val=$(cat $dir/enforce) + orig_val=$(cat "$dir/enforce") val=$((1 - orig_val)) - echo $val > $dir/enforce - echo $orig_val > $dir/enforce + echo "$val" > "$dir/enforce" + echo "$orig_val" > "$dir/enforce"
Thanks.
Quoted 7 lines
testcases/lib/tst_security.sh +0
-0}Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Li Wang
AppliedMerged, thanks!
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp