diff mbox series

[kvm-unit-tests,RFC,03/17] shellcheck: Fix SC2295

Message ID 20240405090052.375599-4-npiggin@gmail.com (mailing list archive)
State New, archived
Headers show
Series add shellcheck support | expand

Commit Message

Nicholas Piggin April 5, 2024, 9 a.m. UTC
SC2295 (info): Expansions inside ${..} need to be quoted separately,
  otherwise they match as patterns.

Doesn't appear to be a bug since the match string does not include
patterns.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 run_tests.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Jones April 5, 2024, 2:15 p.m. UTC | #1
On Fri, Apr 05, 2024 at 07:00:35PM +1000, Nicholas Piggin wrote:
>   SC2295 (info): Expansions inside ${..} need to be quoted separately,
>   otherwise they match as patterns.
> 
> Doesn't appear to be a bug since the match string does not include
> patterns.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  run_tests.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/run_tests.sh b/run_tests.sh
> index 9067e529e..116188e92 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -99,7 +99,7 @@ else
>          local testname="$1"
>          CR=$'\r'
>          while read -r line; do
> -            line="${line%$CR}"
> +            line="${line%"$CR"}"
>              case "${line:0:4}" in
>                  PASS)
>                      echo "ok TEST_NUMBER - ${testname}: ${line#??????}" >&3
> -- 
> 2.43.0
>

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
diff mbox series

Patch

diff --git a/run_tests.sh b/run_tests.sh
index 9067e529e..116188e92 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -99,7 +99,7 @@  else
         local testname="$1"
         CR=$'\r'
         while read -r line; do
-            line="${line%$CR}"
+            line="${line%"$CR"}"
             case "${line:0:4}" in
                 PASS)
                     echo "ok TEST_NUMBER - ${testname}: ${line#??????}" >&3