mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests: cgroup: preserve command arguments in with_stress.sh
@ 2026-09-30  6:03 Ren Tamura
  2026-09-30 23:47 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Ren Tamura @ 2026-09-30  6:03 UTC (permalink / raw)
  To: tj; +Cc: hannes, mkoutny, shuah, cgroups, linux-kselftest, linux-kernel

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 <ren.tamura.oss@gmail.com>
---
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

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

* Re: [PATCH] selftests: cgroup: preserve command arguments in with_stress.sh
  2026-09-30  6:03 [PATCH] selftests: cgroup: preserve command arguments in with_stress.sh Ren Tamura
@ 2026-09-30 23:47 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-09-30 23:47 UTC (permalink / raw)
  To: Ren Tamura; +Cc: hannes, mkoutny, shuah, cgroups, linux-kselftest, linux-kernel

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

Thanks.

--
tejun

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

end of thread, other threads:[~2026-09-30 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30  6:03 [PATCH] selftests: cgroup: preserve command arguments in with_stress.sh Ren Tamura
2026-09-30 23:47 ` Tejun Heo

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

all inboxes | Powered by JetHome®