Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: Romain Naour <romain.naour@gmail.com>,
	Anisse Astier <anisse@astier.eu>,
	Adam Duskett <aduskett@gmail.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH/master 2/7] g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh
Date: Sat, 11 Sep 2021 21:49:57 +0200	[thread overview]
Message-ID: <20210911194957.GV1053080@scaer> (raw)
In-Reply-To: <016fa6ef-0efa-030b-3e27-c2e7ff6db844@mind.be>

Arnout, All,

On 2021-09-11 20:57 +0200, Arnout Vandecappelle spake thusly:
> On 03/09/2021 18:20, Adam Duskett wrote:
> >   - Add double quotes to prevent globbing and word splitting.
> >   - Add indentations of continuation lines.
> >   - Disable SC2181 and SC2016 as we explicitly do not want the variables
> >     expanded in the echo.
> > 
> > Signed-off-by: Adam Duskett <aduskett@gmail.com>
> > ---
> >  .../g-ir-scanner-qemuwrapper.in                  | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/package/gobject-introspection/g-ir-scanner-qemuwrapper.in b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
> > index ec066062e2..5ece75d0a4 100644
> > --- a/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
> > +++ b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
> > @@ -1,18 +1,20 @@
> > -#!/usr/bin/env bash
> > +#!/usr/bin/env sh
> >  
> > -# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel
> > +# Pass -r to qemu-user as to trick glibc into not erroring out if the host kernel
> >  # is older than the target kernel.
> >  # Use a modules directory which does not exist so we don't load random things
> >  # which may then get deleted (or their dependencies) and potentially segfault
> >  GOI_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH:+${GIR_EXTRA_LIBS_PATH}:}.libs:$(dirname "$0")/../lib:$(dirname "$0")/../../lib"
> > -GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \
> > +GIO_MODULE_DIR="$(dirname "$0")/../lib/gio/modules-dummy" \
> >  @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \
> > --L $(dirname $0)/../../ \
> > --E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \
> > -"$@"
> > +    -L "$(dirname "$0")/../../" \
> > +    -E LD_LIBRARY_PATH="${GOI_LIBRARY_PATH}" \
> > +    "$@"
> >  
> > -if [[ $? -ne 0 ]]; then
> > +# shellcheck disable=SC2181
> 
>  Instead of adding an exception, we could just do the right thing:
> 
> if ! @QEMU_USER@ -r ... \
>     ... \
> then
>     ...
> 
>  But since I wasn't going to test this change, I left it as is.

I also considered it when Adam and I discussed this patch on IRC, but I
side with him to keep the code as-is, but forgot to explain why so that
he could add that to the commit log.

So for the posterity, here is my reasonning:

    Continuation lines in a condition are ugly and make an if-then-else
    condition harder to grok, so we prefer adding an SC2181 exception as
    it leaves the code more readable.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2021-09-11 19:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 16:20 [Buildroot] [PATCH/master 0/7] Qemu and gobject-introspection fixes Adam Duskett
2021-09-03 16:20 ` [Buildroot] [PATCH/master 1/7] g-ir-scanner-qemuwrapper.in: Fix latent bug in Adam Duskett
2021-09-03 22:27   ` Thomas Petazzoni
2021-09-11 18:55   ` Arnout Vandecappelle
2021-09-03 16:20 ` [Buildroot] [PATCH/master 2/7] g-ir-scanner-qemuwrapper.in: Fix shellcheck warnings, switch to sh Adam Duskett
2021-09-11 18:57   ` Arnout Vandecappelle
2021-09-11 19:49     ` Yann E. MORIN [this message]
2021-09-03 16:20 ` [Buildroot] [PATCH/master 3/7] g-ir-scanner.in: " Adam Duskett
2021-09-11 19:00   ` Arnout Vandecappelle
2021-09-03 16:20 ` [Buildroot] [PATCH/master 4/7] g-ir-scanner-lddwrapper.in: " Adam Duskett
2021-09-11 19:00   ` Arnout Vandecappelle
2021-09-03 16:20 ` [Buildroot] [PATCH/master 5/7] g-ir-compiler.in: " Adam Duskett
2021-09-11 19:01   ` Arnout Vandecappelle
2021-09-03 16:20 ` [Buildroot] [PATCH/master 6/7] package/qemu: add BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS string Adam Duskett
2021-09-03 22:37   ` Thomas Petazzoni
2021-09-10 17:42     ` Adam Duskett
2021-09-11 19:39       ` Arnout Vandecappelle
2021-09-11 19:42         ` Arnout Vandecappelle
2021-09-03 16:20 ` [Buildroot] [PATCH/master 7/7] package/gobject-introspection: Add QEMU_USERMODE_ARGS support Adam Duskett
2021-09-11 19:47   ` Arnout Vandecappelle
2021-09-03 22:27 ` [Buildroot] [PATCH/master 0/7] Qemu and gobject-introspection fixes Thomas Petazzoni
2021-09-03 23:09   ` Adam Duskett
2021-09-04  7:49     ` Thomas Petazzoni

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=20210911194957.GV1053080@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=aduskett@gmail.com \
    --cc=anisse@astier.eu \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=romain.naour@gmail.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