Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions
@ 2026-06-30 18:08 Avinesh Kumar via ltp
  2026-06-30 19:58 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Avinesh Kumar via ltp @ 2026-06-30 18:08 UTC (permalink / raw)
  To: ltp

From: Avinesh Kumar <avinesh.kumar@suse.com>

Quote variables in tst_disable_selinux() and tst_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 <pvorel@suse.cz>
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
---
 testcases/lib/tst_security.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 03b744fb3d42..a7dd9de63339 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" ] && 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"
 }
-- 
2.54.0


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

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

* Re: [LTP] tst_security.sh: quote variables in selinux helper functions
  2026-06-30 18:08 [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions Avinesh Kumar via ltp
@ 2026-06-30 19:58 ` linuxtestproject.agent
  2026-06-30 22:52 ` [LTP] [PATCH] " Wei Gao via ltp
  2026-07-01  5:37 ` Li Wang
  2 siblings, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-06-30 19:58 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

On Tue, Jun 30, 2026, Avinesh Kumar wrote:
> 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

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

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

* Re: [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions
  2026-06-30 18:08 [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions Avinesh Kumar via ltp
  2026-06-30 19:58 ` [LTP] " linuxtestproject.agent
@ 2026-06-30 22:52 ` Wei Gao via ltp
  2026-07-01  5:37 ` Li Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Gao via ltp @ 2026-06-30 22:52 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

On Tue, Jun 30, 2026 at 08:08:54PM +0200, Avinesh Kumar via ltp wrote:
> From: Avinesh Kumar <avinesh.kumar@suse.com>
> 
> Quote variables in tst_disable_selinux() and tst_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 <pvorel@suse.cz>
> Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
> ---
>  testcases/lib/tst_security.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
> index 03b744fb3d42..a7dd9de63339 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" ] && 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"
Thanks.
Reviewed-by: Wei Gao <wegao@suse.com>

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

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

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

* Re: [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions
  2026-06-30 18:08 [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions Avinesh Kumar via ltp
  2026-06-30 19:58 ` [LTP] " linuxtestproject.agent
  2026-06-30 22:52 ` [LTP] [PATCH] " Wei Gao via ltp
@ 2026-07-01  5:37 ` Li Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Li Wang @ 2026-07-01  5:37 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Merged, thanks!

-- 
Regards,
Li Wang

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

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

end of thread, other threads:[~2026-07-01  5:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 18:08 [LTP] [PATCH] tst_security.sh: quote variables in selinux helper functions Avinesh Kumar via ltp
2026-06-30 19:58 ` [LTP] " linuxtestproject.agent
2026-06-30 22:52 ` [LTP] [PATCH] " Wei Gao via ltp
2026-07-01  5:37 ` Li Wang

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