[LTP] Bug: ROD_SILENT does not preserve its argument list
John.Morin@gd-ms.com
John.Morin@gd-ms.com
Thu Apr 10 23:22:11 CEST 2025
Hello:
Submitting bug against ROD_SILENT.
Sincerely,
* John Morin.
==== Bug in ROD_SILENT ====
Need to quote "$@" in ROD_SILENT so each parameter is individually quoted. Otherwise, the original structure of its arguments is lost.
==== Fix ====
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 718a6b0ca..cfa327a8a 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -153,7 +153,7 @@ ROD_SILENT()
{
local tst_out
- tst_out="$(tst_rod $@ 2>&1)"
+ tst_out=$(tst_rod "$@" 2>&1)
if [ $? -ne 0 ]; then
echo "$tst_out"
tst_brk TBROK "$@ failed"
==== Test showing bug ====
Test "test1" is an LTP tests. The runs the same command using ROD and ROD_SILENT. The command it runs simply greps for string "blah1 blah2" in file data2. When run, ROD passes while ROD_SILENT fails. This is because ROD_SILENT does not preserve quoted arguments.
% cat data2
--- blah1 blah2 blah3 ---
% cat test1
#!/bin/bash
TST_TESTFUNC="do_test"
do_test()
{
ROD grep "blah1 blah2" data2
ROD_SILENT grep "blah1 blah2" data2
tst_res TPASS "pass"
}
. tst_test.sh
tst_run
% ./test1 # Note ROD passes while ROD_SILENT fails
> ./test1
test1 1 TINFO: Running: test1
test1 1 TINFO: Tested kernel: ...
test1 1 TINFO: timeout per run is 0h 5m 0s
--- blah1 blah2 blah3 ---
grep: blah2: No such file or directory
data2:--- blah1 blah2 blah3 ---
test1 1 TBROK: grep blah1 blah2 data2 failed
Summary:
passed 0
failed 0
broken 1
skipped 0
warnings 0
More information about the ltp
mailing list