]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Avoid shellcheck warning SC2045
authorMartin Schwenke <martin@meltin.net>
Mon, 5 Aug 2019 00:28:52 +0000 (10:28 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 14 Aug 2019 09:11:35 +0000 (09:11 +0000)
SC2045 Iterating over ls output is fragile. Use globs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/run_tests.sh

index e0e399ca9fa5fb3c6b069ccb7d4acf8975bbcc5e..27f9b1d18781903f868c71b144d2ae45a7404458 100755 (executable)
@@ -217,7 +217,11 @@ find_and_run_one_test ()
 
     if [ -d "$f" ] ; then
        local i
-       for i in $(ls "${f%/}/"*".sh" 2>/dev/null) ; do
+       for i in "${f%/}/"*".sh" ; do
+           # Only happens if test removed (unlikely) or empty directory
+           if [ ! -f "$i" ] ; then
+               break
+           fi
            run_one_test "$i"
            if $exit_on_fail && [ $status -ne 0 ] ; then
                break