Skip to contentSkip to conversation

shellcheck: post-merge fixups

PATCH In review Nicholas Piggin 2 participants 6 messages May 3, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover shellcheck: post-merge fixups

Thomas noticed a couple of issues after merge (did you report at least one before merge and I didn't notice? -- apologies if yes).

Thanks,
Nick

Nicholas Piggin (2):
shellcheck: Fix shellcheck target with out of tree build
shellcheck: Suppress SC2209 quoting warning in config.mak

 Makefile  | 2 +-
 configure | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 shellcheck: Fix shellcheck target with out of tree build

Prepend source directory to script names, and include source directory in shellcheck search path.

Fixes ddfdcc3929aef ("Add initial shellcheck checking")
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 6240d8dfa..b0f7ad08b 100644
@@ -143,7 +143,7 @@ cscope:
 
 .PHONY: shellcheck
 shellcheck:
-	shellcheck -a run_tests.sh */run */efi/run scripts/mkstandalone.sh
+	shellcheck -P $(SRCDIR) -a $(SRCDIR)/run_tests.sh $(SRCDIR)/*/run $(SRCDIR)/*/efi/run $(SRCDIR)/scripts/mkstandalone.sh
 
 .PHONY: tags
 tags:
Signature · 1 line
2.43.0
Tested-by on v1 1/2
#2 lore raw

Re: [kvm-unit-tests PATCH 1/2] shellcheck: Fix shellcheck target with out of tree build

Quoted 14 lines · Nicholas Piggin

Prepend source directory to script names, and include source directory in shellcheck search path.

Fixes ddfdcc3929aef ("Add initial shellcheck checking")
---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 6240d8dfa..b0f7ad08b 100644

Makefile cscope: · line 149

Quoted 8 lines
Makefile +1 -1
@@ -143,7 +143,7 @@ cscope:
 
  .PHONY: shellcheck
  shellcheck:
-	shellcheck -a run_tests.sh */run */efi/run scripts/mkstandalone.sh
+	shellcheck -P $(SRCDIR) -a $(SRCDIR)/run_tests.sh $(SRCDIR)/*/run $(SRCDIR)/*/efi/run $(SRCDIR)/scripts/mkstandalone.sh
 
  .PHONY: tags
  tags:
#3 lore raw

PATCH 2/2 shellcheck: Suppress SC2209 quoting warning in config.mak

In reply to Nicholas Piggin

It's not necessary to quote strings in simple command variables like this where the pattern makes the intention quite clear.

config.mak is also included as Makefile, and in that case the quotes do slightly change behaviour (the quotes are used when invoking the command), and is not the typical Makefile style.

---
 configure | 2 ++
 1 file changed, 2 insertions(+)
configure +2 -0
index a8520a35f..0e0a28825 100755
@@ -420,6 +420,8 @@ ln -sf "$asm" lib/asm
 cat <<EOF > config.mak
 # Shellcheck does not see these are used
 # shellcheck disable=SC2034
+# Shellcheck can give pointless quoting warnings for some commands
+# shellcheck disable=SC2209
 SRCDIR=$srcdir
 PREFIX=$prefix
 HOST=$host
Signature · 1 line
2.43.0
Tested-by on v1 2/2
#4 lore raw

Re: [kvm-unit-tests PATCH 2/2] shellcheck: Suppress SC2209 quoting warning in config.mak

Quoted 17 lines · Nicholas Piggin

It's not necessary to quote strings in simple command variables like this where the pattern makes the intention quite clear.

config.mak is also included as Makefile, and in that case the quotes do slightly change behaviour (the quotes are used when invoking the command), and is not the typical Makefile style.

---
  configure | 2 ++
  1 file changed, 2 insertions(+)
configure +0 -0
index a8520a35f..0e0a28825 100755

configure ln -sf "$asm" lib/asm · line 427

Quoted 8 lines
configure +2 -0
@@ -420,6 +420,8 @@ ln -sf "$asm" lib/asm
  cat <<EOF > config.mak
  # Shellcheck does not see these are used
  # shellcheck disable=SC2034
+# Shellcheck can give pointless quoting warnings for some commands
+# shellcheck disable=SC2209
  SRCDIR=$srcdir
  PREFIX=$prefix
  HOST=$host
#5 lore raw
In reply to Nicholas Piggin
Quoted 2 lines · Nicholas Piggin

Thomas noticed a couple of issues after merge (did you report at least one before merge and I didn't notice? -- apologies if yes).

No worries, I just started testing at the same time as Drew pushed the patches to the master branch.

Quoted 10 lines

Thanks,
Nick

Nicholas Piggin (2):
shellcheck: Fix shellcheck target with out of tree build
shellcheck: Suppress SC2209 quoting warning in config.mak

  Makefile  | 2 +-
  configure | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)

Thanks! Fixes applied.

Thomas