Re: [PATCH] tst_security.sh: quote variables in selinux helper functions
Wei Gao via ltp <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 30, 2026 at 08:08:54PM +0200, Avinesh Kumar via ltp wrote: > From: Avinesh Kumar <avinesh.kumar-IBi9RG/[email protected]> > > 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 <[email protected]> > Signed-off-by: Avinesh Kumar <avinesh.kumar-IBi9RG/[email protected]> > --- > 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-IBi9RG/[email protected]> > } > -- > 2.54.0 > > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp -- Mailing list info: https://lists.linux.it/listinfo/ltp