public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Andrew Jones" <andrew.jones@linux.dev>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Alexandru Elisei" <alexandru.elisei@arm.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
	"Nico Böhr" <nrb@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Shaoqin Huang" <shahuang@redhat.com>,
	"Nikos Nikoleris" <nikos.nikoleris@arm.com>,
	"Nadav Amit" <namit@vmware.com>,
	"David Woodhouse" <dwmw@amazon.co.uk>,
	"Ricardo Koller" <ricarkol@google.com>,
	rminmin <renmm6@chinaunicom.cn>, "Gavin Shan" <gshan@redhat.com>,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
	"Sean Christopherson" <seanjc@google.com>,
	kvm@vger.kernel.org, kvmarm@lists.linux.dev,
	kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests RFC PATCH 07/17] shellcheck: Fix SC2235
Date: Sat, 06 Apr 2024 16:41:12 +1000	[thread overview]
Message-ID: <D0CU26801BXH.1ZO7Z28QAJ0V1@gmail.com> (raw)
In-Reply-To: <20240405-a578a48a6cad5c42abe5943c@orel>

On Sat Apr 6, 2024 at 12:24 AM AEST, Andrew Jones wrote:
> On Fri, Apr 05, 2024 at 07:00:39PM +1000, Nicholas Piggin wrote:
> >   SC2235 (style): Use { ..; } instead of (..) to avoid subshell
> >   overhead.
> > 
> > No bug identified. Overhead is pretty irrelevant.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >  scripts/arch-run.bash | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> > index ae4b06679..d1edd1d69 100644
> > --- a/scripts/arch-run.bash
> > +++ b/scripts/arch-run.bash
> > @@ -580,15 +580,15 @@ kvm_available ()
> >  		return 1
> >  
> >  	[ "$HOST" = "$ARCH_NAME" ] ||
> > -		( [ "$HOST" = aarch64 ] && [ "$ARCH" = arm ] ) ||
> > -		( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
> > +		{ [ "$HOST" = aarch64 ] && [ "$ARCH" = arm ] ; } ||
> > +		{ [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] ; }
> >  }
> >  
> >  hvf_available ()
> >  {
> >  	[ "$(sysctl -n kern.hv_support 2>/dev/null)" = "1" ] || return 1
> >  	[ "$HOST" = "$ARCH_NAME" ] ||
> > -		( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
> > +		{ [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] ; }
> >  }
>
> This one is a bit ugly. Most developers are used to seeing expressions
> like
>
>   a || (b && c)
>
> not 
>
>  a || { b && c ; }
>
> I'm inclined to add SC2235 to the ignore list...

I'm sure it's a good warning for bash scripts that do a lot of
computation and have these in hot loops. But I _think_ none of
our scripts are like that so I would be okay with disabling
the warning. I'll do that unless someone disagrees.

Thanks,
Nick

  reply	other threads:[~2024-04-06  6:41 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  9:00 [kvm-unit-tests RFC PATCH 00/17] add shellcheck support Nicholas Piggin
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 01/17] Add initial shellcheck checking Nicholas Piggin
2024-04-05 14:12   ` Andrew Jones
2024-04-06  6:39     ` Nicholas Piggin
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 02/17] shellcheck: Fix SC2223 Nicholas Piggin
2024-04-05 14:14   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 03/17] shellcheck: Fix SC2295 Nicholas Piggin
2024-04-05 14:15   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 04/17] shellcheck: Fix SC2094 Nicholas Piggin
2024-04-05 14:17   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 05/17] shellcheck: Fix SC2006 Nicholas Piggin
2024-04-05 14:17   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 06/17] shellcheck: Fix SC2155 Nicholas Piggin
2024-04-05 14:20   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 07/17] shellcheck: Fix SC2235 Nicholas Piggin
2024-04-05 14:24   ` Andrew Jones
2024-04-06  6:41     ` Nicholas Piggin [this message]
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 08/17] shellcheck: Fix SC2119, SC2120 Nicholas Piggin
2024-04-05 14:28   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 09/17] shellcheck: Fix SC2143 Nicholas Piggin
2024-04-05 14:29   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 10/17] shellcheck: Fix SC2013 Nicholas Piggin
2024-04-05 14:31   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 11/17] shellcheck: Fix SC2145 Nicholas Piggin
2024-04-05 14:35   ` Andrew Jones
2024-04-06  6:47     ` Nicholas Piggin
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 12/17] shellcheck: Fix SC2124 Nicholas Piggin
2024-04-05 14:37   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 13/17] shellcheck: Fix SC2294 Nicholas Piggin
2024-04-05 14:38   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 14/17] shellcheck: Fix SC2178 Nicholas Piggin
2024-04-05 14:40   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 15/17] shellcheck: Fix SC2048 Nicholas Piggin
2024-04-05 14:40   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 16/17] shellcheck: Fix SC2153 Nicholas Piggin
2024-04-05 14:42   ` Andrew Jones
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 17/17] shellcheck: Suppress various messages Nicholas Piggin
2024-04-05 14:55   ` Andrew Jones
2024-04-06  6:31     ` Nicholas Piggin
2024-04-06  7:30       ` Andrew Jones
2024-04-06 10:56     ` Nicholas Piggin
2024-04-05 13:59 ` [kvm-unit-tests RFC PATCH 00/17] add shellcheck support Andrew Jones
2024-04-06  6:34   ` Nicholas Piggin

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=D0CU26801BXH.1ZO7Z28QAJ0V1@gmail.com \
    --to=npiggin@gmail.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andrew.jones@linux.dev \
    --cc=david@redhat.com \
    --cc=dwmw@amazon.co.uk \
    --cc=eric.auger@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=gshan@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-s390@vger.kernel.org \
    --cc=namit@vmware.com \
    --cc=nikos.nikoleris@arm.com \
    --cc=nrb@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=renmm6@chinaunicom.cn \
    --cc=ricarkol@google.com \
    --cc=seanjc@google.com \
    --cc=shahuang@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox