Bug 255207

Summary: rc_startmsgs: Silence "Starting ..." messages
Product: Base System Reporter: Jose Luis Duran <jlduran>
Component: confAssignee: Mateusz Piotrowski <0mp>
Status: Closed FIXED    
Severity: Affects Only Me CC: 0mp, imp, lwhsu, rgrimes
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Allow silencing of netif startmsgs.
none
Address @rgrimes suggestions
none
Start with the easy ones first.
none
Easy fixes first. none

Description Jose Luis Duran 2021-04-19 04:40:43 UTC
Created attachment 224239 [details]
Allow silencing of netif startmsgs.

By rc.conf(5), setting `rc_startmsgs="NO"` should silence netif's "Starting Network: lo0 ...".
Comment 1 Rodney W. Grimes freebsd_committer freebsd_triage 2021-04-19 13:10:24 UTC
This fixes one of many cases.  A quick grep of /etc/rc.d indicates that at least jail, local, ppp, pppoed and rfcomm_pppd_server may also be ignoring the rc_startmsgs control.
Comment 2 Jose Luis Duran 2021-04-20 06:53:05 UTC
Created attachment 224275 [details]
Address @rgrimes suggestions

There is another case, /etc/network.subr invokes wpa_supplicant/hostapd start, and the message "Starting wpa_supplicant." is displayed. I don't know how to best address this one.

Thank you!
Comment 3 Jose Luis Duran 2021-04-20 07:13:49 UTC
Created attachment 224278 [details]
Start with the easy ones first.

The previous patch was wrong.
Comment 4 Jose Luis Duran 2021-04-20 07:51:51 UTC
Created attachment 224281 [details]
Easy fixes first.
Comment 5 Mateusz Piotrowski freebsd_committer freebsd_triage 2021-08-18 14:39:07 UTC
This is an interesting patch. I believe we should get it committed in some form.
Comment 6 Warner Losh freebsd_committer freebsd_triage 2021-08-18 14:52:49 UTC
I'd be tempted to create a startmsg (to pick a name) that's basically "check_startmsg && echo" and use it everywhere. That way we don't need to have if we're doing the messages or not statements which are copying code into two places which strikes me as unwise.
Comment 7 Jose Luis Duran 2021-08-20 14:40:01 UTC
(In reply to Warner Losh from comment #6)

Sure, I think it would be a welcomed addition to rc.subr.

That way it could handle echo's "-n" flag for cases like jails: "Starting jails: jail1 jail2 jailn." and avoid the ifs.

I originally decided to close this PR as incomplete, since there is no `rc_stopmsgs`, hence some "Stopping ..." messages will still be displayed.
Comment 8 Jose Luis Duran 2022-03-10 00:41:11 UTC
(In reply to Warner Losh from comment #6)

Not holding my breath on this one, but it is up for review just in case:

https://reviews.freebsd.org/D34513
https://reviews.freebsd.org/D34514

Thank you!
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-03-13 17:58:41 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=19a6267d61a0c3bd6cd56f19ca3f8a67a54f675c

commit 19a6267d61a0c3bd6cd56f19ca3f8a67a54f675c
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-03-13 17:54:39 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2022-03-13 17:57:31 +0000

    rc.d/*: Use startmsg instead of echo on start messages

    By rc.conf(5), setting rc_startmsgs="NO" should silence start messages.

    Fix a few rc scripts by using startmsg.

    PR:             255207
    Reported by:    Jose Luis Duran <jlduran@gmail.com>
    Reviewed by:    imp, 0mp
    Approved by:    imp (src)
    Differential Revision:  https://reviews.freebsd.org/D34514

 libexec/rc/rc.d/jail               | 16 ++++++++--------
 libexec/rc/rc.d/local              |  4 ++--
 libexec/rc/rc.d/netif              |  2 +-
 libexec/rc/rc.d/ppp                |  6 +++---
 libexec/rc/rc.d/pppoed             |  2 +-
 libexec/rc/rc.d/rfcomm_pppd_server |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-03-13 17:58:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=325ebf37d8efc6488754051fcc2b1aaa40cefd8b

commit 325ebf37d8efc6488754051fcc2b1aaa40cefd8b
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-03-13 17:48:06 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2022-03-13 17:57:29 +0000

    Introduce startmsg and use it in rc scripts

    startmsg is a new rc.subr(8) function function to be used instead of
    echo(1) when for boot messages. It replaces the often forgotten

        check_startmsgs && echo ...

    with

        startmsg ...

    No functional change intended.

    I adjusted the commit message and did some final clean-ups of the patch
    before committing.

    PR:             255207
    Reported by:    Jose Luis Duran <jlduran@gmail.com>
    Reviewed by:    imp, 0mp
    Approved by:    imp (src)
    Differential Revision:  https://reviews.freebsd.org/D34514

 libexec/rc/rc.d/bgfsck         |  2 +-
 libexec/rc/rc.d/cleartmp       |  4 ++--
 libexec/rc/rc.d/fsck           |  4 ++--
 libexec/rc/rc.d/hostid         |  4 ++--
 libexec/rc/rc.d/hostname       |  4 ++--
 libexec/rc/rc.d/ldconfig       |  5 ++---
 libexec/rc/rc.d/motd           |  4 ++--
 libexec/rc/rc.d/mountcritlocal |  4 ++--
 libexec/rc/rc.d/moused         |  4 ++--
 libexec/rc/rc.d/newsyslog      |  4 ++--
 libexec/rc/rc.d/nfsclient      |  3 +--
 libexec/rc/rc.d/os-release     |  4 ++--
 libexec/rc/rc.d/pf             |  4 ++--
 libexec/rc/rc.d/savecore       |  2 +-
 libexec/rc/rc.subr             | 11 ++++++++++-
 share/man/man8/rc.subr.8       | 15 ++++++++++++++-
 16 files changed, 49 insertions(+), 29 deletions(-)
Comment 11 Mateusz Piotrowski freebsd_committer freebsd_triage 2022-03-13 17:59:32 UTC
Thanks! Committed!
Comment 12 commit-hook freebsd_committer freebsd_triage 2023-02-22 12:29:40 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8f2bb173bfc6e1a03a56b5098f8d2af740ce743f

commit 8f2bb173bfc6e1a03a56b5098f8d2af740ce743f
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-03-13 17:48:06 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2023-02-22 12:27:16 +0000

    Introduce startmsg and use it in rc scripts

    startmsg is a new rc.subr(8) function function to be used instead of
    echo(1) when for boot messages. It replaces the often forgotten

        check_startmsgs && echo ...

    with

        startmsg ...

    No functional change intended.

    I adjusted the commit message and did some final clean-ups of the patch
    before committing.

    PR:             255207
    Reported by:    Jose Luis Duran <jlduran@gmail.com>
    Reviewed by:    imp, 0mp
    Approved by:    imp (src)
    Differential Revision:  https://reviews.freebsd.org/D34514

    (cherry picked from commit 325ebf37d8efc6488754051fcc2b1aaa40cefd8b)

 libexec/rc/rc.d/bgfsck         |  2 +-
 libexec/rc/rc.d/cleartmp       |  4 ++--
 libexec/rc/rc.d/fsck           |  4 ++--
 libexec/rc/rc.d/hostid         |  4 ++--
 libexec/rc/rc.d/hostname       |  4 ++--
 libexec/rc/rc.d/ldconfig       |  5 ++---
 libexec/rc/rc.d/motd           |  4 ++--
 libexec/rc/rc.d/mountcritlocal |  4 ++--
 libexec/rc/rc.d/moused         |  4 ++--
 libexec/rc/rc.d/newsyslog      |  4 ++--
 libexec/rc/rc.d/nfsclient      |  3 +--
 libexec/rc/rc.d/os-release     |  4 ++--
 libexec/rc/rc.d/pf             |  4 ++--
 libexec/rc/rc.d/savecore       |  2 +-
 libexec/rc/rc.subr             | 11 ++++++++++-
 share/man/man8/rc.subr.8       | 13 +++++++++++++
 16 files changed, 48 insertions(+), 28 deletions(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2023-02-22 12:29:41 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e8396a9592abb08069009e48b84ead2636681b16

commit e8396a9592abb08069009e48b84ead2636681b16
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-03-13 17:54:39 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2023-02-22 12:27:50 +0000

    rc.d/*: Use startmsg instead of echo on start messages

    By rc.conf(5), setting rc_startmsgs="NO" should silence start messages.

    Fix a few rc scripts by using startmsg.

    PR:             255207
    Reported by:    Jose Luis Duran <jlduran@gmail.com>
    Reviewed by:    imp, 0mp
    Approved by:    imp (src)
    Differential Revision:  https://reviews.freebsd.org/D34514

    (cherry picked from commit 19a6267d61a0c3bd6cd56f19ca3f8a67a54f675c)

 libexec/rc/rc.d/jail               | 16 ++++++++--------
 libexec/rc/rc.d/local              |  4 ++--
 libexec/rc/rc.d/netif              |  2 +-
 libexec/rc/rc.d/ppp                |  6 +++---
 libexec/rc/rc.d/pppoed             |  2 +-
 libexec/rc/rc.d/rfcomm_pppd_server |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)