All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: kvm-riscv@lists.infradead.org
Subject: [kvm-unit-tests RFC PATCH 00/17] add shellcheck support
Date: Fri,  5 Apr 2024 19:00:32 +1000	[thread overview]
Message-ID: <20240405090052.375599-1-npiggin@gmail.com> (raw)

I foolishly promised Andrew I would look into shellcheck, so here
it is.

https://gitlab.com/npiggin/kvm-unit-tests/-/tree/powerpc?ref_type=heads

This is on top of the "v8 migration, powerpc improvements" series. For
now the patches are a bit raw but it does get down to zero[*] shellcheck
warnings while still passing gitlab CI.

[*] Modulo the relatively few cases where they're disabled or
suppressed.

I'd like comments about what should be enabled and disabled? There are
quite a lot of options. Lots of changes don't fix real bugs AFAIKS, so
there's some taste involved.

Could possibly be a couple of bugs, including in s390x specific. Any
review of those to confirm or deny bug is appreciated. I haven't tried
to create reproducers for them.

I added a quick comment on each one whether it looks like a bug or
harmless but I'm not a bash guru so could easily be wrong. I would
possibly pull any real bug fixes to the front of the series and describe
them as proper fix patches, and leave the other style / non-bugfixes in
the brief format.  shellcheck has a very good wiki explaining each issue
so there is not much point in rehashing that in the changelog.

One big thing kept disabled for now is the double-quoting to prevent
globbing and splitting warning that is disabled. That touches a lot of
code and we're very inconsistent about quoting variables today, but it's
not completely trivial because there are quite a lot of places that does
rely on splitting for invoking commands with arguments. That would need
some rework to avoid sprinkling a lot of warning suppressions around.
Possibly consistently using arrays for argument lists would be the best
solution?

Thanks,
Nick

Nicholas Piggin (17):
  Add initial shellcheck checking
  shellcheck: Fix SC2223
  shellcheck: Fix SC2295
  shellcheck: Fix SC2094
  shellcheck: Fix SC2006
  shellcheck: Fix SC2155
  shellcheck: Fix SC2235
  shellcheck: Fix SC2119, SC2120
  shellcheck: Fix SC2143
  shellcheck: Fix SC2013
  shellcheck: Fix SC2145
  shellcheck: Fix SC2124
  shellcheck: Fix SC2294
  shellcheck: Fix SC2178
  shellcheck: Fix SC2048
  shellcheck: Fix SC2153
  shellcheck: Suppress various messages

 .shellcheckrc           | 32 +++++++++++++++++++++++++
 Makefile                |  4 ++++
 README.md               |  2 ++
 arm/efi/run             |  4 ++--
 riscv/efi/run           |  4 ++--
 run_tests.sh            | 11 +++++----
 s390x/run               |  8 +++----
 scripts/arch-run.bash   | 52 ++++++++++++++++++++++++++++-------------
 scripts/common.bash     |  5 +++-
 scripts/mkstandalone.sh |  4 +++-
 scripts/runtime.bash    | 14 +++++++----
 scripts/s390x/func.bash |  2 +-
 12 files changed, 106 insertions(+), 36 deletions(-)
 create mode 100644 .shellcheckrc

-- 
2.43.0



WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Piggin <npiggin@gmail.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
	"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: [kvm-unit-tests RFC PATCH 00/17] add shellcheck support
Date: Fri,  5 Apr 2024 19:00:32 +1000	[thread overview]
Message-ID: <20240405090052.375599-1-npiggin@gmail.com> (raw)

I foolishly promised Andrew I would look into shellcheck, so here
it is.

https://gitlab.com/npiggin/kvm-unit-tests/-/tree/powerpc?ref_type=heads

This is on top of the "v8 migration, powerpc improvements" series. For
now the patches are a bit raw but it does get down to zero[*] shellcheck
warnings while still passing gitlab CI.

[*] Modulo the relatively few cases where they're disabled or
suppressed.

I'd like comments about what should be enabled and disabled? There are
quite a lot of options. Lots of changes don't fix real bugs AFAIKS, so
there's some taste involved.

Could possibly be a couple of bugs, including in s390x specific. Any
review of those to confirm or deny bug is appreciated. I haven't tried
to create reproducers for them.

I added a quick comment on each one whether it looks like a bug or
harmless but I'm not a bash guru so could easily be wrong. I would
possibly pull any real bug fixes to the front of the series and describe
them as proper fix patches, and leave the other style / non-bugfixes in
the brief format.  shellcheck has a very good wiki explaining each issue
so there is not much point in rehashing that in the changelog.

One big thing kept disabled for now is the double-quoting to prevent
globbing and splitting warning that is disabled. That touches a lot of
code and we're very inconsistent about quoting variables today, but it's
not completely trivial because there are quite a lot of places that does
rely on splitting for invoking commands with arguments. That would need
some rework to avoid sprinkling a lot of warning suppressions around.
Possibly consistently using arrays for argument lists would be the best
solution?

Thanks,
Nick

Nicholas Piggin (17):
  Add initial shellcheck checking
  shellcheck: Fix SC2223
  shellcheck: Fix SC2295
  shellcheck: Fix SC2094
  shellcheck: Fix SC2006
  shellcheck: Fix SC2155
  shellcheck: Fix SC2235
  shellcheck: Fix SC2119, SC2120
  shellcheck: Fix SC2143
  shellcheck: Fix SC2013
  shellcheck: Fix SC2145
  shellcheck: Fix SC2124
  shellcheck: Fix SC2294
  shellcheck: Fix SC2178
  shellcheck: Fix SC2048
  shellcheck: Fix SC2153
  shellcheck: Suppress various messages

 .shellcheckrc           | 32 +++++++++++++++++++++++++
 Makefile                |  4 ++++
 README.md               |  2 ++
 arm/efi/run             |  4 ++--
 riscv/efi/run           |  4 ++--
 run_tests.sh            | 11 +++++----
 s390x/run               |  8 +++----
 scripts/arch-run.bash   | 52 ++++++++++++++++++++++++++++-------------
 scripts/common.bash     |  5 +++-
 scripts/mkstandalone.sh |  4 +++-
 scripts/runtime.bash    | 14 +++++++----
 scripts/s390x/func.bash |  2 +-
 12 files changed, 106 insertions(+), 36 deletions(-)
 create mode 100644 .shellcheckrc

-- 
2.43.0


             reply	other threads:[~2024-04-05  9:00 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  9:00 Nicholas Piggin [this message]
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  9:00   ` Nicholas Piggin
2024-04-05 14:12   ` Andrew Jones
2024-04-05 14:12     ` Andrew Jones
2024-04-06  6:39     ` Nicholas Piggin
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  9:00   ` Nicholas Piggin
2024-04-05 14:14   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:15   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:17   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:17   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:20   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:24   ` Andrew Jones
2024-04-05 14:24     ` Andrew Jones
2024-04-06  6:41     ` Nicholas Piggin
2024-04-06  6:41       ` Nicholas Piggin
2024-04-05  9:00 ` [kvm-unit-tests RFC PATCH 08/17] shellcheck: Fix SC2119, SC2120 Nicholas Piggin
2024-04-05  9:00   ` Nicholas Piggin
2024-04-05 14:28   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:29   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:31   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:35   ` Andrew Jones
2024-04-05 14:35     ` Andrew Jones
2024-04-06  6:47     ` Nicholas Piggin
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  9:00   ` Nicholas Piggin
2024-04-05 14:37   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:38   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:40   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:40   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:42   ` Andrew Jones
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  9:00   ` Nicholas Piggin
2024-04-05 14:55   ` Andrew Jones
2024-04-05 14:55     ` Andrew Jones
2024-04-06  6:31     ` Nicholas Piggin
2024-04-06  6:31       ` Nicholas Piggin
2024-04-06  7:30       ` Andrew Jones
2024-04-06  7:30         ` Andrew Jones
2024-04-06 10:56     ` Nicholas Piggin
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-05 13:59   ` Andrew Jones
2024-04-06  6:34   ` Nicholas Piggin
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=20240405090052.375599-1-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=kvm-riscv@lists.infradead.org \
    /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 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.