Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ktest: Run commands through list-form shell open

run_command() currently uses string-form open():

open(CMD, "$command 2>&1 |")

That delegates parsing to the shell but also mixes the stderr redirection
into the command string. Switch to list-form open() with an explicit sh -c
wrapper so shell syntax errors are captured in the same output stream as
command output. Otherwise, important errors can not be retrieved from the
ktest LOG_FILE.

Cc: John Hawley <warthog9@eaglescrag.net>
Cc: Andrea Righi <arighi@nvidia.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Pedro Falcato <pfalcato@suse.de>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-5-565d412f4925@suse.com
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Ricardo B. Marlière and committed by
Steven Rostedt
fcfc2572 a2de57a3

+4 -1
+4 -1
tools/testing/ktest/ktest.pl
··· 1921 1921 doprint("$command ... "); 1922 1922 $start_time = time; 1923 1923 1924 - $pid = open(CMD, "$command 2>&1 |") or 1924 + $pid = open(CMD, "-|", 1925 + "sh", "-c", 1926 + 'command=$1; shift; exec 2>&1; eval "$command"', 1927 + "sh", $command) or 1925 1928 (fail "unable to exec $command" and return 0); 1926 1929 1927 1930 if (defined($opt{"LOG_FILE"})) {