Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings
@ 2026-06-06 18:20 Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 1/4] package/mpd/S95mpd: avoid unnecessary exit Fiona Klute via buildroot
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Fiona Klute via buildroot @ 2026-06-06 18:20 UTC (permalink / raw)
  To: buildroot
  Cc: Andreas Ziegler, Fiona Klute, Joachim Wiberg,
	Michał Łyszczek

Hi everyone,

this series fixes shellcheck warnings that appear with shellcheck 0.10
(as present in Debian Trixie) and 0.11 (Sid) to prepare for updating
the CI container image to Trixie. With the current image "make
check-package" still passes with the patches applied, so they can be
applied at any point before updating the container image.

Most changes are pretty trivial (the mdnsd init script a little less),
but only OpenRC has runtime tests, so tests from people actually using
the packages would be appreciated.

Best regards,
Fiona

Fiona Klute (4):
  package/mpd/S95mpd: avoid unnecessary exit
  package/mpd/S95mpd: do not wait for exit if sending stop failed
  package/mdnsd/S50mdnsd: rewrite to match current guidelines
  package/openrc/sysv-rcs: fix shellcheck 0.10 warnings

 package/mdnsd/S50mdnsd  | 55 +++++++++++++++++++++++++++--------------
 package/mpd/S95mpd      |  4 +--
 package/openrc/sysv-rcs |  4 +++
 3 files changed, 42 insertions(+), 21 deletions(-)

-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/4] package/mpd/S95mpd: avoid unnecessary exit
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
@ 2026-06-06 18:20 ` Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 2/4] package/mpd/S95mpd: do not wait for exit if sending stop failed Fiona Klute via buildroot
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Fiona Klute via buildroot @ 2026-06-06 18:20 UTC (permalink / raw)
  To: buildroot
  Cc: Andreas Ziegler, Fiona Klute, Joachim Wiberg,
	Michał Łyszczek

The exit status of the last command automatically becomes the exit
status of the script. And if there is no explicit exit shellcheck
accepts unused functions (here: start/stop/... called via variable).

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
 package/mpd/S95mpd | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/package/mpd/S95mpd b/package/mpd/S95mpd
index ac971e04a2..e33654a501 100644
--- a/package/mpd/S95mpd
+++ b/package/mpd/S95mpd
@@ -2,7 +2,6 @@
 #
 # S95mpd	Starts Music Player daemon.
 #
-# shellcheck disable=SC2317 # functions are called via variable
 
 DAEMON="mpd"
 PIDFILE="/var/run/$DAEMON.pid"
@@ -57,5 +56,3 @@ case "$1" in
 		echo "Usage: $0 {start|stop|reload|restart}"
 		exit 1
 esac
-
-exit $?
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/4] package/mpd/S95mpd: do not wait for exit if sending stop failed
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 1/4] package/mpd/S95mpd: avoid unnecessary exit Fiona Klute via buildroot
@ 2026-06-06 18:20 ` Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 3/4] package/mdnsd/S50mdnsd: rewrite to match current guidelines Fiona Klute via buildroot
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Fiona Klute via buildroot @ 2026-06-06 18:20 UTC (permalink / raw)
  To: buildroot
  Cc: Andreas Ziegler, Fiona Klute, Joachim Wiberg,
	Michał Łyszczek

If sending the stop signal failed for whatever reason, waiting for an
existing PID file to disappear is likely to block indefinitely.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
 package/mpd/S95mpd | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/mpd/S95mpd b/package/mpd/S95mpd
index e33654a501..485747e96e 100644
--- a/package/mpd/S95mpd
+++ b/package/mpd/S95mpd
@@ -31,6 +31,7 @@ stop() {
 		echo "OK"
 	else
 		echo "FAIL"
+		return "$status"
 	fi
 	# $DAEMON deletes its PID file on exit, wait for it to be gone
 	while [ -f "$PIDFILE" ]; do
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 3/4] package/mdnsd/S50mdnsd: rewrite to match current guidelines
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 1/4] package/mpd/S95mpd: avoid unnecessary exit Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 2/4] package/mpd/S95mpd: do not wait for exit if sending stop failed Fiona Klute via buildroot
@ 2026-06-06 18:20 ` Fiona Klute via buildroot
  2026-06-06 18:20 ` [Buildroot] [PATCH 4/4] package/openrc/sysv-rcs: fix shellcheck 0.10 warnings Fiona Klute via buildroot
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Fiona Klute via buildroot @ 2026-06-06 18:20 UTC (permalink / raw)
  To: buildroot
  Cc: Andreas Ziegler, Fiona Klute, Joachim Wiberg,
	Michał Łyszczek

With the action function as the last command in the script its return
code automatically becomes that of the script, and without explicit
exit shellcheck does not complain about unused functions.

Also wait for the process to stop in "stop", and simplify restart.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
 package/mdnsd/S50mdnsd | 55 ++++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/package/mdnsd/S50mdnsd b/package/mdnsd/S50mdnsd
index 803ac12a8e..a3d8835918 100644
--- a/package/mdnsd/S50mdnsd
+++ b/package/mdnsd/S50mdnsd
@@ -1,5 +1,4 @@
 #!/bin/sh
-# shellcheck disable=SC2317  # Don't warn about unreachable commands in this file
 
 DAEMON=mdnsd
 MDNSD=/usr/sbin/$DAEMON
@@ -12,43 +11,63 @@ MDNSD_ARGS=""
 # shellcheck source=/dev/null
 [ -r "$CFGFILE" ] && . "$CFGFILE"
 
-# shellcheck disable=SC2086
 start() {
-	[ -n "$1" ] || printf 'Starting %s: ' "$DAEMON"
-	start-stop-daemon -S -q -p "$PIDFILE" -x "$MDNSD" -- $MDNSD_ARGS
+	printf 'Starting %s: ' "$DAEMON"
+	# shellcheck disable=SC2086 # we need word splitting
+	start-stop-daemon --start --pidfile "$PIDFILE" \
+		--exec "$MDNSD" -- $MDNSD_ARGS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
 }
 
 stop() {
-	[ -n "$1" ] || printf 'Stopping %s: ' "$DAEMON"
-	start-stop-daemon -K -q -p "$PIDFILE" -x "$MDNSD"
+	printf "Stopping %s: " "$DAEMON"
+	start-stop-daemon --stop --pidfile "$PIDFILE" \
+		--exec "$MDNSD"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+		return "$status"
+	fi
+	# mdnsd deletes its PID file on exit, wait for it to be gone
+	while [ -f "$PIDFILE" ]; do
+		sleep 0.1
+	done
+	return "$status"
 }
 
 restart() {
-	printf 'Restarting %s: ' "$DAEMON"
-	stop  silent
-	start silent
+	stop
+	start
 }
 
 # SIGHUP reloads /etc/mdns.d/*.service
 reload() {
 	printf 'Reloading %s: ' "$DAEMON"
-	start-stop-daemon -K -s HUP -q -p "$PIDFILE" -x "$MDNSD"
+	start-stop-daemon --stop --signal HUP -q --pidfile "$PIDFILE" \
+		--exec "$MDNSD"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
 }
 
 case "$1" in
 	start|stop|restart|reload)
 		"$1"
-		status=$?
-		if [ "$status" -eq 0 ]; then
-			echo "OK"
-		else
-			echo "FAIL"
-		fi
 		;;
 	*)
 		echo "Usage: $0 {start|stop|restart|reload}"
 		exit 1
 		;;
 esac
-
-exit "$status"
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 4/4] package/openrc/sysv-rcs: fix shellcheck 0.10 warnings
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
                   ` (2 preceding siblings ...)
  2026-06-06 18:20 ` [Buildroot] [PATCH 3/4] package/mdnsd/S50mdnsd: rewrite to match current guidelines Fiona Klute via buildroot
@ 2026-06-06 18:20 ` Fiona Klute via buildroot
  2026-06-07  6:26 ` [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Andreas Ziegler
  2026-06-17 12:28 ` Marcus Hoffmann via buildroot
  5 siblings, 0 replies; 8+ messages in thread
From: Fiona Klute via buildroot @ 2026-06-06 18:20 UTC (permalink / raw)
  To: buildroot
  Cc: Andreas Ziegler, Fiona Klute, Joachim Wiberg,
	Michał Łyszczek

* Explicitly set shell type. Shellcheck doesn't know OpenRC, but the
  script as such is POSIX shell.
* Override warnings not applicable in context.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
---
 package/openrc/sysv-rcs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/openrc/sysv-rcs b/package/openrc/sysv-rcs
index 1564cbe603..1b24cc3e1a 100755
--- a/package/openrc/sysv-rcs
+++ b/package/openrc/sysv-rcs
@@ -1,5 +1,7 @@
 #!/sbin/openrc-run
+# shellcheck shell=sh
 
+# shellcheck disable=SC2034 # definition for OpenRC
 description="start or stop sysv rc[S,K] scripts"
 
 depend() {
@@ -17,6 +19,8 @@ start() {
 }
 
 stop() {
+    # we need to reverse the order here, sort -r would be no less fragile
+    # shellcheck disable=SC2045
     for i in $(ls -r /etc/init.d/S??*); do
         # Ignore dangling symlinks (if any).
         [ -e "$i" ] || continue
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
                   ` (3 preceding siblings ...)
  2026-06-06 18:20 ` [Buildroot] [PATCH 4/4] package/openrc/sysv-rcs: fix shellcheck 0.10 warnings Fiona Klute via buildroot
@ 2026-06-07  6:26 ` Andreas Ziegler
  2026-06-17 12:28 ` Marcus Hoffmann via buildroot
  5 siblings, 0 replies; 8+ messages in thread
From: Andreas Ziegler @ 2026-06-07  6:26 UTC (permalink / raw)
  To: Fiona Klute; +Cc: buildroot

Hi Fiona, Everyone,

On 2026-06-06 18:20, Fiona Klute wrote:
> Hi everyone,
> 
> this series fixes shellcheck warnings that appear with shellcheck 0.10
> (as present in Debian Trixie) and 0.11 (Sid) to prepare for updating
> the CI container image to Trixie. With the current image "make
> check-package" still passes with the patches applied, so they can be
> applied at any point before updating the container image.
> 
> Most changes are pretty trivial (the mdnsd init script a little less),
> but only OpenRC has runtime tests, so tests from people actually using
> the packages would be appreciated.

The changes to the mpd init script (1, 2) work as intended:
Tested-by: Andreas Ziegler <br025@umbiko.net>

> Best regards,
> Fiona
> 
> Fiona Klute (4):
>   package/mpd/S95mpd: avoid unnecessary exit
>   package/mpd/S95mpd: do not wait for exit if sending stop failed
>   package/mdnsd/S50mdnsd: rewrite to match current guidelines
>   package/openrc/sysv-rcs: fix shellcheck 0.10 warnings

<...>

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings
  2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
                   ` (4 preceding siblings ...)
  2026-06-07  6:26 ` [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Andreas Ziegler
@ 2026-06-17 12:28 ` Marcus Hoffmann via buildroot
  2026-06-18 15:38   ` Joachim Wiberg
  5 siblings, 1 reply; 8+ messages in thread
From: Marcus Hoffmann via buildroot @ 2026-06-17 12:28 UTC (permalink / raw)
  To: Fiona Klute, buildroot, Andreas Ziegler, Joachim Wiberg
  Cc: Michał Łyszczek

Hi Fiona, Andreas, Joachim

On 6/6/26 20:20, Fiona Klute via buildroot wrote:
> Hi everyone,
> 
> this series fixes shellcheck warnings that appear with shellcheck 0.10
> (as present in Debian Trixie) and 0.11 (Sid) to prepare for updating
> the CI container image to Trixie. With the current image "make
> check-package" still passes with the patches applied, so they can be
> applied at any point before updating the container image.
> 
> Most changes are pretty trivial (the mdnsd init script a little less),
> but only OpenRC has runtime tests, so tests from people actually using
> the packages would be appreciated.

It would indeed be nice if we had more runtime tests, so we can make 
such changes more comfortably. Thanks Andreas for testing the mpd 
changes. Do you think you could submit a runtime test for it at some 
point? :)

Joachim, you submitted and are mentioned in the DEVELOPERS file for 
mdns, do you think you can submit a runtime test for it?

https://nightly.buildroot.org/manual.html#_using_the_runtime_tests_framework

> 
> Best regards,
> Fiona
> 
Series applied to master, thanks!

Marcus
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings
  2026-06-17 12:28 ` Marcus Hoffmann via buildroot
@ 2026-06-18 15:38   ` Joachim Wiberg
  0 siblings, 0 replies; 8+ messages in thread
From: Joachim Wiberg @ 2026-06-18 15:38 UTC (permalink / raw)
  To: Marcus Hoffmann; +Cc: buildroot


[-- Attachment #1.1: Type: text/plain, Size: 402 bytes --]

On Wed, 2026-06-17 at 14:28 +0200, Marcus Hoffmann wrote:
> Joachim, you submitted and are mentioned in the DEVELOPERS file for 
> mdnsd, do you think you can submit a runtime test for it?
> 
> https://nightly.buildroot.org/manual.html#_using_the_runtime_tests_framework

Sure, just went on vacation, so this could a fun little project 🙂
I'll see what I can do.

Best regards
 /Joachim


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-06-18 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06 18:20 [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Fiona Klute via buildroot
2026-06-06 18:20 ` [Buildroot] [PATCH 1/4] package/mpd/S95mpd: avoid unnecessary exit Fiona Klute via buildroot
2026-06-06 18:20 ` [Buildroot] [PATCH 2/4] package/mpd/S95mpd: do not wait for exit if sending stop failed Fiona Klute via buildroot
2026-06-06 18:20 ` [Buildroot] [PATCH 3/4] package/mdnsd/S50mdnsd: rewrite to match current guidelines Fiona Klute via buildroot
2026-06-06 18:20 ` [Buildroot] [PATCH 4/4] package/openrc/sysv-rcs: fix shellcheck 0.10 warnings Fiona Klute via buildroot
2026-06-07  6:26 ` [Buildroot] [PATCH 0/4] fix shellcheck 0.10 & 0.11 warnings Andreas Ziegler
2026-06-17 12:28 ` Marcus Hoffmann via buildroot
2026-06-18 15:38   ` Joachim Wiberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox