with_stress.sh invokes the requested command through unquoted $*. This
subjects the arguments to word splitting and pathname expansion:
arguments containing whitespace are split, empty arguments disappear,
and literal wildcard characters can expand to filenames.

Invoke the command through "$@" so that the command name and each
argument are passed as supplied by the caller.

Fixes: 1a99fcc035fb ("selftests: cgroup: Run test_core under interfering 
stress")
Assisted-by: LLM
Signed-off-by: Ren Tamura <[email protected]>
---
Validation (2026-09-24, mainline 62f4c998b297): ran both versions of the
actual wrapper under Bash on Linux with a fixture mount listing and no
stress workers. The argument boundaries, empty argument and literal
wildcard are preserved after the change:

    Input:  ["two words", "", "*.txt"]
    Before: ["two", "words", "match.txt"]
    After:  ["two words", "", "*.txt"]

Ordinary arguments and the child command's nonzero exit status are
unchanged.

LLM assistance: finding small cgroup fixes, drafting code and commit
messages, and preparing validation.

 tools/testing/selftests/cgroup/with_stress.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/with_stress.sh 
b/tools/testing/selftests/cgroup/with_stress.sh
index 
e28c35008f5b7a0f66654b10d8fccf4678120f6e..a95fb387464460ba24775a3e947a91875b743bc9
 100755
--- a/tools/testing/selftests/cgroup/with_stress.sh
+++ b/tools/testing/selftests/cgroup/with_stress.sh
@@ -87,7 +87,7 @@ time=0
 start=$(date +%s)
 
 while [ $time -lt $duration ] ; do
-       $*
+       "$@"
        rc=$?
        [ $rc -eq 0 ] || break
        time=$(($(date +%s) - $start))

base-commit: 551c722f40809618230001baccf219193e22fc5a

Reply via email to