All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configure: Remove spurious [] from tr
@ 2021-08-12 11:09 Dr. David Alan Gilbert (git)
  2021-08-12 11:58 ` Peter Maydell
  2021-08-12 17:49 ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2021-08-12 11:09 UTC (permalink / raw)
  To: qemu-devel, eblake, philmd

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

ShellCheck points out that tr '[a-z]' actually replaces the []'s
and only the a-z is needed.

Remove the spurious [] - although in this use it will make no
difference.

Fixes: bb55b712e8dc4d4eb515144d5c26798fea178cba
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 9a79a004d7..5bb8c2a59d 100755
--- a/configure
+++ b/configure
@@ -4549,7 +4549,7 @@ if test "$gprof" = "yes" ; then
 fi
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do
-    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
+    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr 'a-z' 'A-Z')
     echo "$def=y" >> $config_host_mak
 done
 if test "$alsa" = "yes" ; then
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 11:09 [PATCH] configure: Remove spurious [] from tr Dr. David Alan Gilbert (git)
@ 2021-08-12 11:58 ` Peter Maydell
  2021-08-12 13:05   ` Dr. David Alan Gilbert
  2021-08-12 17:49 ` Paolo Bonzini
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2021-08-12 11:58 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git)
  Cc: Philippe Mathieu-Daudé, Eric Blake, QEMU Developers

On Thu, 12 Aug 2021 at 12:11, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> ShellCheck points out that tr '[a-z]' actually replaces the []'s
> and only the a-z is needed.
>
> Remove the spurious [] - although in this use it will make no
> difference.
>
> Fixes: bb55b712e8dc4d4eb515144d5c26798fea178cba
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 9a79a004d7..5bb8c2a59d 100755
> --- a/configure
> +++ b/configure
> @@ -4549,7 +4549,7 @@ if test "$gprof" = "yes" ; then
>  fi
>  echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
>  for drv in $audio_drv_list; do
> -    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
> +    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr 'a-z' 'A-Z')
>      echo "$def=y" >> $config_host_mak
>  done
>  if test "$alsa" = "yes" ; then
> -

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

(Is this the only thing shellcheck complains about in configure?
I'm guessing not...)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 11:58 ` Peter Maydell
@ 2021-08-12 13:05   ` Dr. David Alan Gilbert
  2021-08-12 13:54     ` Eric Blake
  2021-08-12 17:51     ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Dr. David Alan Gilbert @ 2021-08-12 13:05 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Philippe Mathieu-Daudé, Eric Blake, QEMU Developers

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On Thu, 12 Aug 2021 at 12:11, Dr. David Alan Gilbert (git)
> <dgilbert@redhat.com> wrote:
> >
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > ShellCheck points out that tr '[a-z]' actually replaces the []'s
> > and only the a-z is needed.
> >
> > Remove the spurious [] - although in this use it will make no
> > difference.
> >
> > Fixes: bb55b712e8dc4d4eb515144d5c26798fea178cba
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  configure | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 9a79a004d7..5bb8c2a59d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -4549,7 +4549,7 @@ if test "$gprof" = "yes" ; then
> >  fi
> >  echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
> >  for drv in $audio_drv_list; do
> > -    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
> > +    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr 'a-z' 'A-Z')
> >      echo "$def=y" >> $config_host_mak
> >  done
> >  if test "$alsa" = "yes" ; then
> > -
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks.

> (Is this the only thing shellcheck complains about in configure?
> I'm guessing not...)

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.

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.


  https://www.shellcheck.net/wiki/SC1035 -- You are missing a required space ...
  https://www.shellcheck.net/wiki/SC1087 -- Use braces when expanding arrays,...

Dave

> thanks
> -- PMM
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 13:05   ` Dr. David Alan Gilbert
@ 2021-08-12 13:54     ` Eric Blake
  2021-08-12 17:51     ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Blake @ 2021-08-12 13:54 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Peter Maydell, Philippe Mathieu-Daudé, QEMU Developers

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 11:09 [PATCH] configure: Remove spurious [] from tr Dr. David Alan Gilbert (git)
  2021-08-12 11:58 ` Peter Maydell
@ 2021-08-12 17:49 ` Paolo Bonzini
  2021-08-12 17:54   ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2021-08-12 17:49 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, eblake, philmd

On 12/08/21 13:09, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> ShellCheck points out that tr '[a-z]' actually replaces the []'s
> and only the a-z is needed.
> 
> Remove the spurious [] - although in this use it will make no
> difference.
> 
> Fixes: bb55b712e8dc4d4eb515144d5c26798fea178cba
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>   configure | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 9a79a004d7..5bb8c2a59d 100755
> --- a/configure
> +++ b/configure
> @@ -4549,7 +4549,7 @@ if test "$gprof" = "yes" ; then
>   fi
>   echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
>   for drv in $audio_drv_list; do
> -    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
> +    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr 'a-z' 'A-Z')
>       echo "$def=y" >> $config_host_mak
>   done
>   if test "$alsa" = "yes" ; then
> 

Do we want this in 6.1?  For the next release I'm moving all audio stuff 
to meson anyway. :)

Paolo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 13:05   ` Dr. David Alan Gilbert
  2021-08-12 13:54     ` Eric Blake
@ 2021-08-12 17:51     ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2021-08-12 17:51 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, Peter Maydell
  Cc: Eric Blake, Philippe Mathieu-Daudé, QEMU Developers

On 12/08/21 15:05, Dr. David Alan Gilbert wrote:
> 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.

Trying

! (echo abc); echo $?
!(echo abc); echo $?

both work in bash, but the latter fails with zsh:

abc
1
ff:2: no matches found: !(echo abc)

Paolo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] configure: Remove spurious [] from tr
  2021-08-12 17:49 ` Paolo Bonzini
@ 2021-08-12 17:54   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 7+ messages in thread
From: Dr. David Alan Gilbert @ 2021-08-12 17:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: philmd, eblake, qemu-devel

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> On 12/08/21 13:09, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > ShellCheck points out that tr '[a-z]' actually replaces the []'s
> > and only the a-z is needed.
> > 
> > Remove the spurious [] - although in this use it will make no
> > difference.
> > 
> > Fixes: bb55b712e8dc4d4eb515144d5c26798fea178cba
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >   configure | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure b/configure
> > index 9a79a004d7..5bb8c2a59d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -4549,7 +4549,7 @@ if test "$gprof" = "yes" ; then
> >   fi
> >   echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
> >   for drv in $audio_drv_list; do
> > -    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
> > +    def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr 'a-z' 'A-Z')
> >       echo "$def=y" >> $config_host_mak
> >   done
> >   if test "$alsa" = "yes" ; then
> > 
> 
> Do we want this in 6.1?  For the next release I'm moving all audio stuff to
> meson anyway. :)

Bah! Not bothered; I just tripped over ShellCheck and that
looked like a trivial one.

Dave

> Paolo
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-12 17:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 11:09 [PATCH] configure: Remove spurious [] from tr Dr. David Alan Gilbert (git)
2021-08-12 11:58 ` Peter Maydell
2021-08-12 13:05   ` Dr. David Alan Gilbert
2021-08-12 13:54     ` Eric Blake
2021-08-12 17:51     ` Paolo Bonzini
2021-08-12 17:49 ` Paolo Bonzini
2021-08-12 17:54   ` Dr. David Alan Gilbert

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.