All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>
Subject: [PATCH 2/5] configure: Add braces to clarify intent of $emu[[:space:]]
Date: Wed, 20 Jul 2022 16:26:28 +0100	[thread overview]
Message-ID: <20220720152631.450903-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20220720152631.450903-1-peter.maydell@linaro.org>

In shell script syntax, $var[something] is not special for variable
expansion: $emu is expanded.  However, as it can look as if it were
intended to be an array element access (the correct syntax for which
is ${var[something]}), shellcheck recommends using explicit braces
around ${var} to clarify the intended expansion.

This fixes the warning:

In ./configure line 2346:
        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
                                                              ^-- SC1087: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is our only 'error' level shellcheck warning, so it seems
worth suppressing even though it's not wrong as written.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index dec6f030346..a56c3d921be 100755
--- a/configure
+++ b/configure
@@ -2343,7 +2343,7 @@ if test -n "$target_cc" &&
     # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
     # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
     for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
-        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
+        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*${emu}[[:space:]]*$"; then
             ld_i386_emulation="$emu"
             break
         fi
-- 
2.25.1



  parent reply	other threads:[~2022-07-20 15:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 15:26 [PATCH 0/5] configure: fix some non-portabilities Peter Maydell
2022-07-20 15:26 ` [PATCH 1/5] configure: Add missing POSIX-required space Peter Maydell
2022-07-20 15:30   ` Thomas Huth
2022-07-20 16:01   ` Dr. David Alan Gilbert
2022-07-20 15:26 ` Peter Maydell [this message]
2022-07-20 15:36   ` [PATCH 2/5] configure: Add braces to clarify intent of $emu[[:space:]] Thomas Huth
2022-07-21  6:24   ` Markus Armbruster
2022-07-21  8:28     ` Peter Maydell
2022-07-20 15:26 ` [PATCH 3/5] configure: Don't use bash-specific string-replacement syntax Peter Maydell
2022-07-20 15:57   ` Thomas Huth
2022-07-20 16:29   ` Eric Blake
2022-07-20 17:32     ` Peter Maydell
2022-07-20 18:37       ` Eric Blake
2022-07-20 15:26 ` [PATCH 4/5] configure: Drop dead code attempting to use -msmall-data on alpha hosts Peter Maydell
2022-07-20 15:38   ` Thomas Huth
2022-07-20 15:26 ` [PATCH 5/5] configure: Avoid '==' bashism Peter Maydell
2022-07-20 15:39   ` Thomas Huth
2022-07-26 12:41 ` [PATCH 0/5] configure: fix some non-portabilities Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220720152631.450903-3-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.