Skip to contentSkip to conversation

selftests: cgroup: preserve command arguments in with_stress.sh

PATCH Applied Ren Tamura 2 participants 2 messages Sep 30

Subsystems (2)
lore
Share & tools
lore

Ren Tamura

author
#0 lore raw

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.

Fixes 1a99fcc035fb ("selftests: cgroup: Run test_core under interfering stress")
Assisted-by LLM

---
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
index e28c35008f5b7a0f66654b10d8fccf4678120f6e..a95fb387464460ba24775a3e947a91875b743bc9 100755
@@ -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

maintainer Applied
#1 lore raw

Applied to cgroup/for-7.4 with the Fixes tag dropped and the subject capitalized.

Thanks.

--
tejun