package/ssdp-responder bump and check-package fixes
cover package/ssdp-responder bump and check-package fixes
Hi,
here's the upgrade of the ssdpd-responder package to the latest release, as of yesterday. Also included are some stilistic fixes to Config.in and the start script. The latter changes suggested by check-package and shellcheck, fixes based in part on the SMCRoute start script.
Best regards
/Joachim
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/3 package/ssdp-responder: bump to version 1.9
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)
Fixes:
- Workaround for OpenVPN /32 default server setup
- Time-of-check vs time-of-use issue with caching of UUID, found by Coverity Scan, fixed by Raul Porancea
--- package/ssdp-responder/ssdp-responder.hash | 4 ++-- package/ssdp-responder/ssdp-responder.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
package/ssdp-responder/ssdp-responder.hash +2 -2
@@ -1,3 +1,3 @@ # Locally calculated -sha256 7ae49229e7c7a55fed9e36598b12e2173eecef0fffe0a386b6a10fad30f3c79f ssdp-responder-1.8.tar.gz -sha256 e17dc0bc91bf499d8cca5e016c22c6d2a4770e3cc1a43756a7973375a83ddb90 LICENSE +sha256 974c244abd4ba8c87532867a84756182a1460c99072ffb1eb91c5a1f73311d89 ssdp-responder-1.9.tar.gz +sha256 68d6fdc22e337f725fe719bf9ae6d92b1d8d0ca4cff8219b303ab76706670a8d LICENSE
package/ssdp-responder/ssdp-responder.mk +1 -1
@@ -4,7 +4,7 @@ # ################################################################################ -SSDP_RESPONDER_VERSION = 1.8 +SSDP_RESPONDER_VERSION = 1.9 SSDP_RESPONDER_SITE = https://github.com/troglobit/ssdp-responder/releases/download/v$(SSDP_RESPONDER_VERSION) SSDP_RESPONDER_LICENSE = ISC SSDP_RESPONDER_LICENSE_FILES = LICENSE
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Quoted 10 lines · On Mon, 31 Oct 2022 18:46:30 +0100 Joachim Wiberg <[email protected]> wrote:
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)Fixes:
- Workaround for OpenVPN /32 default server setup
- Time-of-check vs time-of-use issue with caching of UUID, found by Coverity Scan, fixed by Raul PoranceaSigned-off-by Joachim Wiberg <[email protected]>
Thanks for the patch! One request below.
Quoted 10 lines
--- package/ssdp-responder/ssdp-responder.hash | 4 ++-- package/ssdp-responder/ssdp-responder.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)package/ssdp-responder/ssdp-responder.hash +0
-0
package/ssdp-responder/ssdp-responder.hash line 3
Quoted 5 lines
package/ssdp-responder/ssdp-responder.hash +2
-2@@ -1,3 +1,3 @@ # Locally calculated -sha256 7ae49229e7c7a55fed9e36598b12e2173eecef0fffe0a386b6a10fad30f3c79f ssdp-responder-1.8.tar.gz -sha256 e17dc0bc91bf499d8cca5e016c22c6d2a4770e3cc1a43756a7973375a83ddb90 LICENSE +sha256 974c244abd4ba8c87532867a84756182a1460c99072ffb1eb91c5a1f73311d89 ssdp-responder-1.9.tar.gz +sha256 68d6fdc22e337f725fe719bf9ae6d92b1d8d0ca4cff8219b303ab76706670a8d LICENSE
The hash of the license file is changed, this should be explained in the commit log (what are the changes, do they require changing the license information in the .mk file).
Silently changing the license file hashes defeats the entire purpose of having hashes for license files, which is precisely to carefully verify what has changed in the license file.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Hi Thomas!
Quoted 4 lines · Thomas Petazzoni
Quoted 2 lines · On Mon, 31 Oct 2022 18:46:30 +0100 Joachim Wiberg <[email protected]> wrote:
Changes:
- Update copyright years (affects LICENSE file hash)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
package/ssdp-responder/ssdp-responder.hash line 3
Quoted 2 lines
package/ssdp-responder/ssdp-responder.hash +1
-1-sha256 e17dc0bc91bf499d8cca5e016c22c6d2a4770e3cc1a43756a7973375a83ddb90 LICENSE +sha256 68d6fdc22e337f725fe719bf9ae6d92b1d8d0ca4cff8219b303ab76706670a8d LICENSEThe hash of the license file is changed, this should be explained in the commit log (what are the changes, do they require changing the license information in the .mk file).
I tried to be as clear as possible about this, even when I did the release upstream. Maybe I should have been extra clear somehow?
Quoted 3 lines
Silently changing the license file hashes defeats the entire purpose of having hashes for license files, which is precisely to carefully verify what has changed in the license file.
Yes, I fully understand.
Best regards
/Joachim
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Quoted 2 lines · On Tue, 01 Nov 2022 08:18:53 +0100 Joachim Wiberg <[email protected]> wrote:
I tried to be as clear as possible about this, even when I did the release upstream. Maybe I should have been extra clear somehow?
All we expect is a short note in the commit log, which clarifies that the submitter of the patch has changed the hash of the license file after properly checking what the changes in the license files are. That's really the complete extent of our expectation :-)
Thanks a lot!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
Acked-byRe: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Thomas, All,
On 2022-11-02 18:06 +0100, Thomas Petazzoni via buildroot spake thusly:
Quoted 8 lines
Quoted 2 lines · On Tue, 01 Nov 2022 08:18:53 +0100 Joachim Wiberg <[email protected]> wrote:
I tried to be as clear as possible about this, even when I did the release upstream. Maybe I should have been extra clear somehow?
All we expect is a short note in the commit log, which clarifies that the submitter of the patch has changed the hash of the license file after properly checking what the changes in the license files are. That's really the complete extent of our expectation :-)
I think you missed the part where Joachim *does* priovide that information in his commit log, copied below:
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)
So, our expectations were met! ;-)
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Quoted 8 lines · On Wed, 2 Nov 2022 22:19:23 +0100 "Yann E. MORIN" <[email protected]>…
I think you missed the part where Joachim *does* priovide that information in his commit log, copied below:
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)So, our expectations were met! ;-)
Sorry about that, I definitely read too quickly, my bad :/
My apologizes Joachim for missing this: it was all good from the start!
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Quoted 8 lines · Thomas Petazzoni
Quoted 6 lines · On Wed, 2 Nov 2022 22:19:23 +0100 "Yann E. MORIN" <[email protected]>…
I think you missed the part where Joachim *does* priovide that information in his commit log, copied below:
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash) So, our expectations were met! ;-)
Thanks Yann! <3
Quoted 3 lines
Sorry about that, I definitely read too quickly, my bad :/ My apologizes Joachim for missing this: it was all good from the start!
No worries, I know how stressful things can get. Was just so confusing from my end :-D
Take care!
/J
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
In reply to Joachim WibergJoachime, All,
On 2022-10-31 18:46 +0100, Joachim Wiberg spake thusly:
Quoted 10 lines
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)Fixes:
- Workaround for OpenVPN /32 default server setup
- Time-of-check vs time-of-use issue with caching of UUID, found by Coverity Scan, fixed by Raul PoranceaSigned-off-by Joachim Wiberg <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 35 lines
--- package/ssdp-responder/ssdp-responder.hash | 4 ++-- package/ssdp-responder/ssdp-responder.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)package/ssdp-responder/ssdp-responder.hash +2
-2@@ -1,3 +1,3 @@ # Locally calculated -sha256 7ae49229e7c7a55fed9e36598b12e2173eecef0fffe0a386b6a10fad30f3c79f ssdp-responder-1.8.tar.gz -sha256 e17dc0bc91bf499d8cca5e016c22c6d2a4770e3cc1a43756a7973375a83ddb90 LICENSE +sha256 974c244abd4ba8c87532867a84756182a1460c99072ffb1eb91c5a1f73311d89 ssdp-responder-1.9.tar.gz +sha256 68d6fdc22e337f725fe719bf9ae6d92b1d8d0ca4cff8219b303ab76706670a8d LICENSEpackage/ssdp-responder/ssdp-responder.mk +1
-1@@ -4,7 +4,7 @@ # ################################################################################ -SSDP_RESPONDER_VERSION = 1.8 +SSDP_RESPONDER_VERSION = 1.9 SSDP_RESPONDER_SITE = https://github.com/troglobit/ssdp-responder/releases/download/v$(SSDP_RESPONDER_VERSION) SSDP_RESPONDER_LICENSE = ISC SSDP_RESPONDER_LICENSE_FILES = LICENSESignature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Joachim, All,
On 2022-11-05 19:45 +0100, Yann E. MORIN spake thusly:
Quoted 5 lines
On 2022-10-31 18:46 +0100, Joachim Wiberg spake thusly:
Quoted 4 lines
Changes:
- New command line options to ssdp-scan
- Update copyright years (affects LICENSE file hash)
Quoted 8 lines
Quoted 6 lines
Fixes:
- Workaround for OpenVPN /32 default server setup
- Time-of-check vs time-of-use issue with caching of UUID, found by Coverity Scan, fixed by Raul PoranceaSigned-off-by Joachim Wiberg <[email protected]>Applied to master, thanks.
s/master/next/
Also, sorry for the typo in your name in my previous reply... :-/
Regards,
Yann E. MORIN.
Quoted 50 lines
Regards,
Yann E. MORIN.Quoted 35 lines
--- package/ssdp-responder/ssdp-responder.hash | 4 ++-- package/ssdp-responder/ssdp-responder.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)package/ssdp-responder/ssdp-responder.hash +2
-2@@ -1,3 +1,3 @@ # Locally calculated -sha256 7ae49229e7c7a55fed9e36598b12e2173eecef0fffe0a386b6a10fad30f3c79f ssdp-responder-1.8.tar.gz -sha256 e17dc0bc91bf499d8cca5e016c22c6d2a4770e3cc1a43756a7973375a83ddb90 LICENSE +sha256 974c244abd4ba8c87532867a84756182a1460c99072ffb1eb91c5a1f73311d89 ssdp-responder-1.9.tar.gz +sha256 68d6fdc22e337f725fe719bf9ae6d92b1d8d0ca4cff8219b303ab76706670a8d LICENSEpackage/ssdp-responder/ssdp-responder.mk +1
-1@@ -4,7 +4,7 @@ # ################################################################################ -SSDP_RESPONDER_VERSION = 1.8 +SSDP_RESPONDER_VERSION = 1.9 SSDP_RESPONDER_SITE = https://github.com/troglobit/ssdp-responder/releases/download/v$(SSDP_RESPONDER_VERSION) SSDP_RESPONDER_LICENSE = ISC SSDP_RESPONDER_LICENSE_FILES = LICENSESignature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildrootSignature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/ssdp-responder: bump to version 1.9
Quoted 4 lines · Yann E. MORIN
On 2022-11-05 19:45 +0100, Yann E. MORIN spake thusly:
Quoted 1 line
Applied to master, thanks.
s/master/next/
Also, sorry for the typo in your name in my previous reply... :-/
Absolutely no problem, thank you! <3
/J
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/ssdp-responder: minor update of help text
In reply to Joachim Wiberg--- package/ssdp-responder/Config.in | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
package/ssdp-responder/Config.in +10 -8
@@ -7,14 +7,16 @@ config BR2_PACKAGE_SSDP_RESPONDER targeted more at embedded systems that need to announce themselves to Windows systems. - ssdpd is a stand-alone UNIX, no external dependencies but the - standard C library. It has a built-in web server for serving - the UPnP XML description which Windows use to present the - icon, by default an InternetGatewayDevice is announced. + The project consists of ssdpd and ssdp-scan. The former is a + stand-alone UNIX daemon, it has no dependencies but a standard + C library. It comes with built-in web server for serving the + UPnP XML description on port 1901, the XML is used by Windows + to present the icon, by default an InternetGatewayDevice is + announced. - Also included is ssdp-scan, a tool similar to mdns-scan, which - continuously scans for SSDP capable hosts on the network. - Take care only to use for debugging since it scans the network - quite aggressively. + ssdp-scan is a tool, similar to mdns-scan, to find other SSDP + capable hosts on the network. Take care to only use it for + debugging, or quicker device discovery operations, since it + scans the network quite aggressively. https://github.com/troglobit/ssdp-responder/
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 2/3] package/ssdp-responder: minor update of help text
Joachim, All,
On 2022-10-31 18:46 +0100, Joachim Wiberg spake thusly:
Quoted 1 line
Signed-off-by Joachim Wiberg <[email protected]>
Applied to next, thanks.
Regards,
Yann E. MORIN.
Quoted 40 lines
--- package/ssdp-responder/Config.in | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)package/ssdp-responder/Config.in +10
-8@@ -7,14 +7,16 @@ config BR2_PACKAGE_SSDP_RESPONDER targeted more at embedded systems that need to announce themselves to Windows systems. - ssdpd is a stand-alone UNIX, no external dependencies but the - standard C library. It has a built-in web server for serving - the UPnP XML description which Windows use to present the - icon, by default an InternetGatewayDevice is announced. + The project consists of ssdpd and ssdp-scan. The former is a + stand-alone UNIX daemon, it has no dependencies but a standard + C library. It comes with built-in web server for serving the + UPnP XML description on port 1901, the XML is used by Windows + to present the icon, by default an InternetGatewayDevice is + announced. - Also included is ssdp-scan, a tool similar to mdns-scan, which - continuously scans for SSDP capable hosts on the network. - Take care only to use for debugging since it scans the network - quite aggressively. + ssdp-scan is a tool, similar to mdns-scan, to find other SSDP + capable hosts on the network. Take care to only use it for + debugging, or quicker device discovery operations, since it + scans the network quite aggressively. https://github.com/troglobit/ssdp-responder/Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/ssdp-responder: fix warnings from check-package and shellcheck
In reply to Joachim Wiberg--- package/ssdp-responder/S50ssdpd | 47 +++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) mode change 100755 => 100644 package/ssdp-responder/S50ssdpd
package/ssdp-responder/S50ssdpd +27 -20
@@ -1,25 +1,32 @@ #!/bin/sh -NAME=ssdpd -PIDFILE=/var/run/$NAME.pid -DAEMON=/usr/sbin/$NAME -CFGFILE=/etc/default/$NAME +DAEMON=ssdpd +PIDFILE=/var/run/$DAEMON.pid +CFGFILE=/etc/default/$DAEMON DAEMON_ARGS="" # Read configuration variable file if it is present -[ -f $CFGFILE ] && . $CFGFILE +# shellcheck source=/dev/null +[ -r "$CFGFILE" ] && . "$CFGFILE" + +cmd() +{ + start-stop-daemon -q -p "$PIDFILE" -x "$DAEMON" "$@" + status=$? + [ $status -eq 0 ] && echo "OK" || echo "FAIL" + + return $status +} start() { - printf 'Starting %s: ' "$NAME" - start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS - [ $? = 0 ] && echo "OK" || echo "FAIL" + printf 'Starting %s: ' "$DAEMON" + cmd -S -- "$DAEMON_ARGS" } stop() { - printf 'Stopping %s: ' "$NAME" - start-stop-daemon -K -q -p $PIDFILE -x $DAEMON - [ $? = 0 ] && echo "OK" || echo "FAIL" + printf 'Stopping %s: ' "$DAEMON" + cmd -K } restart() {
@@ -28,15 +35,15 @@ restart() { } case "$1" in - start|stop|restart) - "$1" - ;; - reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart|reload}" - exit 1 + start|stop|restart) + "$1" + ;; + reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 esac exit $?
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/3] package/ssdp-responder: fix warnings from check-package and shellcheck
package/ssdp-responder/S50ssdpd line 20
Quoted 8 lines · On Mon, 31 Oct 2022 18:46:32 +0100 Joachim Wiberg <[email protected]> wrote:
package/ssdp-responder/S50ssdpd +8
-0+cmd() +{ + start-stop-daemon -q -p "$PIDFILE" -x "$DAEMON" "$@" + status=$? + [ $status -eq 0 ] && echo "OK" || echo "FAIL" + + return $status +}
I don't think we're using this cmd construct anywhere else in the tree, or did I miss some change in our coding style/policy?
package/ssdp-responder/S50ssdpd line 16
Quoted 5 lines
start(){package/ssdp-responder/S50ssdpd +0
-3- printf 'Starting %s: ' "$NAME" - start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS - [ $? = 0 ] && echo "OK" || echo "FAIL"
This all looked matching our coding style. Why are you changing this?
Quoted 9 lines
case "$1" in
package/ssdp-responder/S50ssdpd +0
-8- start|stop|restart) - "$1" - ;; - reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart|reload}"
package/ssdp-responder/S50ssdpd restart() { · line 46
Quoted 10 lines
package/ssdp-responder/S50ssdpd +9
-1- exit 1 + start|stop|restart) + "$1" + ;; + reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1
I'm not sure what is the recommended indentation style in our init scripts. Tabs? Spaces?
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/3] package/ssdp-responder: fix warnings from check-package and shellcheck
Hi Thomas!
Quoted 12 lines · Thomas Petazzoni
package/ssdp-responder/S50ssdpd line 20
Quoted 8 lines · On Mon, 31 Oct 2022 18:46:32 +0100 Joachim Wiberg <[email protected]> wrote:
package/ssdp-responder/S50ssdpd +8
-0+cmd() +{ + start-stop-daemon -q -p "$PIDFILE" -x "$DAEMON" "$@" + status=$? + [ $status -eq 0 ] && echo "OK" || echo "FAIL" + + return $status +}I don't think we're using this cmd construct anywhere else in the tree, or did I miss some change in our coding style/policy?
I mentioned it in the cover letter, but that information should have been here in this patch. Sorry about that.
It all started out with utils/check-package telling me I used $DAEMON wrong. While changing that I ended up with a final comment from it that said I should also "run shellcheck and fix the warnings".
It in turn had several grievances which I took one by one. In this one I used the same construct as in package/smcroute/S41smcroute to work around a warning about using $? instead of using an if cmd; then ...
Quoted 20 lines
package/ssdp-responder/S50ssdpd line 16
Quoted 4 lines
start(){package/ssdp-responder/S50ssdpd +0
-3- printf 'Starting %s: ' "$NAME" - start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS - [ $? = 0 ] && echo "OK" || echo "FAIL"This all looked matching our coding style. Why are you changing this?
Quoted 14 lines
case "$1" in
package/ssdp-responder/S50ssdpd +4
-9- start|stop|restart) - "$1" - ;; - reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart|reload}" - exit 1 + start|stop|restart) + "$1" + ;; + reload)
Quoted 8 lines
package/ssdp-responder/S50ssdpd restart() { · line 46
Quoted 5 lines
package/ssdp-responder/S50ssdpd +5
-0+ restart + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1I'm not sure what is the recommended indentation style in our init scripts. Tabs? Spaces?
Shellcheck pointed out this section had four spaces indent instead of the eight (tab) used for the rest of the script. Iirc from the "own code coding style" discussions C and shell script should follow the same style, but I may very well be wrong here.
Best regards
/Joachim
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/3] package/ssdp-responder: fix warnings from check-package and shellcheck
Joachim, All,
On 2022-11-01 08:30 +0100, Joachim Wiberg spake thusly:
Quoted 17 lines · Thomas Petazzoni
Quoted 12 lines
package/ssdp-responder/S50ssdpd line 20
Quoted 8 lines · On Mon, 31 Oct 2022 18:46:32 +0100 Joachim Wiberg <[email protected]> wrote:
package/ssdp-responder/S50ssdpd +8
-0+cmd() +{ + start-stop-daemon -q -p "$PIDFILE" -x "$DAEMON" "$@" + status=$? + [ $status -eq 0 ] && echo "OK" || echo "FAIL" + + return $status +}I don't think we're using this cmd construct anywhere else in the tree, or did I miss some change in our coding style/policy?
I mentioned it in the cover letter, but that information should have been here in this patch. Sorry about that.
Quoted 7 lines
It all started out with utils/check-package telling me I used $DAEMON wrong. While changing that I ended up with a final comment from it that said I should also "run shellcheck and fix the warnings".
It in turn had several grievances which I took one by one. In this one I used the same construct as in package/smcroute/S41smcroute to work around a warning about using
$?instead of using anif cmd; then ...
We hanve cmd() in only two pacjages so far, smcroute and watchdogd, both proided by you, so I can see you are aiming for some consistency! :-)
However, the majority of our SNNfoo startup scripts do not use this cmd() wrapper construct, so I am not a fan of it.
(I like that it is generic and that we could have in a library of helpers shared across our startup script, but IIRC we had a similar discussion a long time ago, and decide against it, because it is trivial enough to call start-stop-daemon).
The rest of the changes are however interesting, so could you respin with just fixing those, pelase?
Note: it is acceptable that some shellcheck triggers get forcefully disabled. For example, SC2086 (Double quote to prevent globbing and word splitting) must be disabled when expanding $DAEMON_ARGS; this can be achieved with:
# shellcheck source=/dev/null
[ -f $CFGFILE ] && . $CFGFILE # shellcheck disable=SC2086
start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGSBasically, the canonical reference for a startup script is package/busybox/S01syslogd.
Oh, btw, as much as I hate TABs, we do use TABs for indentation...
https://nightly.buildroot.org/#adding-packages-start-script
Regards,
Yann E. MORIN.
Quoted 42 lines
Quoted 20 lines
package/ssdp-responder/S50ssdpd line 16
Quoted 4 lines
start(){package/ssdp-responder/S50ssdpd +0
-3- printf 'Starting %s: ' "$NAME" - start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS - [ $? = 0 ] && echo "OK" || echo "FAIL"This all looked matching our coding style. Why are you changing this?
Quoted 14 lines
case "$1" in
package/ssdp-responder/S50ssdpd +4
-9- start|stop|restart) - "$1" - ;; - reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart|reload}" - exit 1 + start|stop|restart) + "$1" + ;; + reload)Quoted 8 lines
package/ssdp-responder/S50ssdpd restart() { · line 46
Quoted 5 lines
package/ssdp-responder/S50ssdpd +5
-0+ restart + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1I'm not sure what is the recommended indentation style in our init scripts. Tabs? Spaces?
Shellcheck pointed out this section had four spaces indent instead of the eight (tab) used for the rest of the script. Iirc from the "own code coding style" discussions C and shell script should follow the same style, but I may very well be wrong here.
Best regards
/Joachim_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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 [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/3] package/ssdp-responder: fix warnings from check-package and shellcheck
Quoted 20 lines · Yann E. MORIN
On 2022-11-01 08:30 +0100, Joachim Wiberg spake thusly:
Quoted 12 lines · Thomas Petazzoni
Quoted 7 lines · On Mon, 31 Oct 2022 18:46:32 +0100 Joachim Wiberg <[email protected]> wrote:
package/ssdp-responder/S50ssdpd line 20
Quoted 4 lines
package/ssdp-responder/S50ssdpd +3
-0+cmd() +{ +}I don't think we're using this cmd construct anywhere else in the tree, or did I miss some change in our coding style/policy?
I mentioned it in the cover letter, but that information should have been here in this patch. Sorry about that.
Quoted 7 lines
It all started out with utils/check-package telling me I used $DAEMON wrong. While changing that I ended up with a final comment from it that said I should also "run shellcheck and fix the warnings".
It in turn had several grievances which I took one by one. In this one I used the same construct as in package/smcroute/S41smcroute to work around a warning about using
$?instead of using anif cmd; then ...
Quoted 8 lines
We hanve
cmd()in only two pacjages so far, smcroute and watchdogd, both proided by you, so I can see you are aiming for some consistency! :-) However, the majority of our SNNfoo startup scripts do not use thiscmd()wrapper construct, so I am not a fan of it.
(I like that it is generic and that we could have in a library of helpers shared across our startup script, but IIRC we had a similar discussion a long time ago, and decide against it, because it is trivial enough to call start-stop-daemon).
OK, I get it. I was sort of aiming for a rehash of the start() and stop() helper functions that many other start scripts use. It's a small generalization step up from that to reduce duplication and thus avoid annoying bugs in behavior between stop and start actions. Anyway ...
Quoted 2 lines
The rest of the changes are however interesting, so could you respin with just fixing those, pelase?
Sure thing, I'll send a v2! :-)
Quoted 2 lines
Note: it is acceptable that some shellcheck triggers get forcefully disabled.
OK, was a bit unsure about the policy for that. Thanks!
Quoted 9 lines
For example, SC2086 (Double quote to prevent globbing and word splitting) must be disabled when expanding $DAEMON_ARGS; this can be achieved with:
# shellcheck source=/dev/null [ -f $CFGFILE ] && . $CFGFILE# shellcheck disable=SC2086 start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS
Ah, yes that makes sense. Thank you!
Quoted 2 lines
Basically, the canonical reference for a startup script is package/busybox/S01syslogd.
Got it! :)
Quoted 2 lines
Oh, btw, as much as I hate TABs, we do use TABs for indentation...
https://nightly.buildroot.org/#adding-packages-start-script
Yup, I'll be migrating my scripts to this. Thanks for the clarification and the thorough review!
Best regards
/Joachim
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/1 package/ssdp-responder: fix warnings from check-package and shellcheck
In reply to Yann E. MORINSummary of changes:
- Fix use of $DAEMON, found by check-package
- Expects DAEMON to be name of daemon controlled by script, this causes ripple efects in rest of script
- Recommend chmod a-x, .mk file installs with -m 0755
- Fix shellcheck warnings:
- Use "$VAR" in case of spaces in filenames
- recommend not using $? in if stmt, should use if start-stop ...
- mismatch in indentation in case-esac
Changes since v1:
- Revert introduction of cmd() wrapper for start-stop-daemon, instead call start-stop-daemon directly in start() and stop() functions
--- package/ssdp-responder/S50ssdpd | 47 +++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) mode change 100755 => 100644 package/ssdp-responder/S50ssdpd
package/ssdp-responder/S50ssdpd +27 -20
@@ -1,25 +1,32 @@ #!/bin/sh -NAME=ssdpd -PIDFILE=/var/run/$NAME.pid -DAEMON=/usr/sbin/$NAME -CFGFILE=/etc/default/$NAME +DAEMON=ssdpd +PIDFILE=/var/run/$DAEMON.pid +CFGFILE=/etc/default/$DAEMON DAEMON_ARGS="" # Read configuration variable file if it is present -[ -f $CFGFILE ] && . $CFGFILE +# shellcheck source=/dev/null +[ -r "$CFGFILE" ] && . "$CFGFILE" +# shellcheck disable=SC2086 start() { - printf 'Starting %s: ' "$NAME" - start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS - [ $? = 0 ] && echo "OK" || echo "FAIL" + printf 'Starting %s: ' "$DAEMON" + if start-stop-daemon -S -q -p "$PIDFILE" -x "$DAEMON" -- $DAEMON_ARGS; then + echo "OK" + else + echo "FAIL" + fi } stop() { - printf 'Stopping %s: ' "$NAME" - start-stop-daemon -K -q -p $PIDFILE -x $DAEMON - [ $? = 0 ] && echo "OK" || echo "FAIL" + printf 'Stopping %s: ' "$DAEMON" + if start-stop-daemon -K -q -p "$PIDFILE" -x "$DAEMON"; then + echo "OK" + else + echo "FAIL" + fi } restart() {
@@ -28,15 +35,15 @@ restart() { } case "$1" in - start|stop|restart) - "$1" - ;; - reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart|reload}" - exit 1 + start|stop|restart) + "$1" + ;; + reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 esac exit $?
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedRe: [Buildroot] [PATCH v2 1/1] package/ssdp-responder: fix warnings from check-package and shellcheck
Quoted 11 lines · On Sun, 6 Nov 2022 19:19:46 +0100 Joachim Wiberg <[email protected]> wrote:
Summary of changes:
- Fix use of $DAEMON, found by check-package
- Expects DAEMON to be name of daemon controlled by script, this causes ripple efects in rest of script
- Recommendchmod a-x, .mk file installs with-m 0755
- Fix shellcheck warnings:
- Use "$VAR" in case of spaces in filenames
- recommend not using $? in if stmt, should useif start-stop ...
- mismatch in indentation in case-esac
Quoted 4 lines
Changes since v1:
- Revert introduction of
cmd()wrapper for start-stop-daemon, instead call start-stop-daemon directly instart()andstop()functions
The changes between versions should be...
Quoted 3 lines
Signed-off-by Joachim Wiberg <[email protected]>---
... here. So that they don't show up in the final commit log.
Applied to next with this fixed. Thanks!
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot