Bug 255207 - rc_startmsgs: Silence "Starting ..." messages
Summary: rc_startmsgs: Silence "Starting ..." messages
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mateusz Piotrowski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-19 04:40 UTC by Jose Luis Duran
Modified: 2022-03-13 17:59 UTC (History)
4 users (show)

See Also:


Attachments
Allow silencing of netif startmsgs. (372 bytes, patch)
2021-04-19 04:40 UTC, Jose Luis Duran
no flags Details | Diff
Address @rgrimes suggestions (2.60 KB, patch)
2021-04-20 06:53 UTC, Jose Luis Duran
no flags Details | Diff
Start with the easy ones first. (1.11 KB, patch)
2021-04-20 07:13 UTC, Jose Luis Duran
no flags Details | Diff
Easy fixes first. (2.10 KB, patch)
2021-04-20 07:51 UTC, Jose Luis Duran
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 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 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 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 2022-03-13 17:59:32 UTC
Thanks! Committed!