qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] configure: Remove spurious [] from tr


From: Eric Blake
Subject: Re: [PATCH] configure: Remove spurious [] from tr
Date: Thu, 12 Aug 2021 08:54:12 -0500
User-agent: NeoMutt/20210205-687-0ed190

On Thu, Aug 12, 2021 at 02:05:36PM +0100, Dr. David Alan Gilbert wrote:
> Indeed it's not; there's LOTS of warnings; although most of them are
> probably irrelevant; there are also two others at the error level:
> 
> In configure line 4406:
>         if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; 
> then
>                                                        ^-- SC1087: Use braces 
> when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
> 
> which is probably just needing the ${emu} to shut it up.

Yep. ${var[idx]} is a bashism, but our configure is /bin/sh and not
bash, and we don't want an array access, so using ${emu}[ to shut up
the checker is the right action.

> 
> In configure line 4464:
> if !(GIT="$git" "$source_path/scripts/git-submodule.sh" 
> "$git_submodules_action" "$git_submodules"); then
>     ^-- SC1035: You are missing a required space after the !.
> 
> which hmm I've not quite got my head around yet; but maybe that one is
> real.

In bash, !() is an extended glob when using 'shopt -s extglob' - but
we aren't using bash, and we _don't_ want extended glob (execute the
command formed from the set of all filenames in the current working
directory that do not match the contents inside (...), which is likely
to not be a valid command).  When the bash extension is not in use,
'if !()' is the same as 'if ! ()', checking if the exit status of the
subshell is non-zero.  Adding the space ensures we don't trigger an
unintended bash extglob, but would still waste the effort on a
subshell.  So I would suggest we fix the line to:

if ! GIT="$git" "$source_path..".."..$git_submodules"; then

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]