selftests: cgroup: preserve command arguments in with_stress.sh
PATCH 1/1 selftests: cgroup: preserve command arguments in with_stress.sh
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.
---
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(-)
tools/testing/selftests/cgroup/with_stress.sh +1 -1
@@ -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
Applied to cgroup/for-7.4 with the Fixes tag dropped and the subject capitalized.
Thanks.
--
tejun