]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: quote reference to array to iterate over empty string
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Nov 2023 10:27:02 +0000 (11:27 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Nov 2023 14:44:04 +0000 (15:44 +0100)
This patch restores coverage for non-interval set backend.

Use "${FLAGS[@]}" in loop, otherwise empty string is skipped in the
iteration. This snippet:

  FLAGS=("")
  available_flags FLAGS "single"

  for flags in "${FLAGS[@]}" ; do
          echo $flags
  done

... now shows the empty string:

  # bash test.sh

  interval

Fixes: ed927baa4fd8 ("tests: shell: skip pipapo set backend in transactions/30s-stress")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/transactions/30s-stress

index ef3e1d3e3e4be129ab080e19e83645893f0f37cf..e92b922660b828ae84e72420c547477d413f8984 100755 (executable)
@@ -324,7 +324,7 @@ random_elem()
 
                        FLAGS=("")
                        available_flags FLAGS $key
-                       for flags in ${FLAGS[@]} ; do
+                       for flags in "${FLAGS[@]}" ; do
                                cnt=$((cnt+1))
                                if [ $f -ne fkr ] ;then
                                        f=$((f+1))