Re: [PATCH libgpiod v2 2/4] tools: tests: use "$@" instead of $*

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

 



On Mon, May 27, 2024 at 2:44 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
>
> On Mon, May 27, 2024 at 02:02:34PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > $@ does not break up quoted arguments which is what we want in all cases
> > in the bash test-suite. Use it instead of $*. While at it: prevent
> > globbing with double quotes but allow variable expansion.
> >
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> > ---
> >  tools/gpio-tools-test.bash | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
> > index abb2f5d..dde26b4 100755
> > --- a/tools/gpio-tools-test.bash
> > +++ b/tools/gpio-tools-test.bash
> > @@ -27,10 +27,10 @@ GPIOSIM_APP_NAME="gpio-tools-test"
> >  MIN_KERNEL_VERSION="5.17.4"
> >  MIN_SHUNIT_VERSION="2.1.8"
> >
> > -# Run the command in $* and fail the test if the command succeeds.
> > +# Run the command in $@ and fail the test if the command succeeds.
> >  assert_fail() {
> > -     $* || return 0
> > -     fail " '$*': command did not fail as expected"
> > +     "$@" || return 0
> > +     fail " '$@': command did not fail as expected"
> >  }
> >
>
> Ironically, shellcheck doesn't like the '$@' in the fail string[1], so you
> should use $* there.
>
> It also doesn't like looping on find results in patch 4[2], though that
> is not related to your change, so leave it and I'll fix it later?
>

What does it want here? This looks correct to me? Should we do "$(find...)"?

Bart

> Cheers,
> Kent.
>
> [1] https://www.shellcheck.net/wiki/SC2145
> [2] https://www.shellcheck.net/wiki/SC2044





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux