Bug 282585 - /etc/rc.d/sendmail: Incorrect status code of the stop command when sendmail_enable="NO" & sendmail_submit_enable="YES" are set
Summary: /etc/rc.d/sendmail: Incorrect status code of the stop command when sendmail_e...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: Mateusz Piotrowski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-06 11:23 UTC by Mateusz Piotrowski
Modified: 2024-12-31 13:21 UTC (History)
2 users (show)

See Also:


Attachments
patch (3.35 KB, patch)
2024-11-09 23:23 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Piotrowski freebsd_committer freebsd_triage 2024-11-06 11:23:12 UTC
tijl@ reports that service sendmail stop returns incorrect status code in the following setup:

sendmail_enable="NO"
sendmail_msp_queue_enable="YES"
sendmail_outbound_enable="YES"
sendmail_submit_enable="YES"
Comment 1 Tijl Coosemans freebsd_committer freebsd_triage 2024-11-09 23:23:07 UTC
Created attachment 255060 [details]
patch

The problem is that the first run_rc_command call successfully stops sendmail and then the second call fails because it's no longer running.

I believe this patch fixes the problem.
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-12-03 10:49:46 UTC
A commit in branch main references this bug:

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

commit 6b17d944a1d448dbb797c5fa5b0778242ba02e52
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-12-03 10:45:10 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-12-03 10:46:39 +0000

    rc.d/sendmail: Fix error with some configurations

    The sendmail startup script can run 4 daemons: sendmail, sendmail_submit,
    sendmail_outbound, and sendmail_msp_queue.  Of the first 3 at most one
    can be enabled.  There's a run_rc_command call for each and the ones for
    sendmail and sendmail_msp_queue run unconditionally.  For some rc
    commands this triggers warnings or errors when sendmail_enable="NO" or
    sendmail_msp_queue_enable="NO".  Since d2e7bb630b83 these errors are
    propagated and the whole script fails.

    Fix this by first determining which daemons are enabled, setting ${name}
    and ${rcvar} accordingly, and then always calling run_rc_command
    conditionally.

    Also replace ${name}.cf with sendmail.cf because ${name} isn't always
    sendmail.

    PR:             282585
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D47757

 libexec/rc/rc.d/sendmail | 49 +++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-12-31 13:21:51 UTC
A commit in branch stable/13 references this bug:

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

commit 242eb8d4e0095f7d922ecec78b7a3c91a6e2d99c
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-12-03 10:45:10 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-12-31 13:17:46 +0000

    rc.d/sendmail: Fix error with some configurations

    The sendmail startup script can run 4 daemons: sendmail, sendmail_submit,
    sendmail_outbound, and sendmail_msp_queue.  Of the first 3 at most one
    can be enabled.  There's a run_rc_command call for each and the ones for
    sendmail and sendmail_msp_queue run unconditionally.  For some rc
    commands this triggers warnings or errors when sendmail_enable="NO" or
    sendmail_msp_queue_enable="NO".  Since d2e7bb630b83 these errors are
    propagated and the whole script fails.

    Fix this by first determining which daemons are enabled, setting ${name}
    and ${rcvar} accordingly, and then always calling run_rc_command
    conditionally.

    Also replace ${name}.cf with sendmail.cf because ${name} isn't always
    sendmail.

    PR:             282585
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D47757

    (cherry picked from commit 6b17d944a1d448dbb797c5fa5b0778242ba02e52)

 libexec/rc/rc.d/sendmail | 49 +++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-12-31 13:21:52 UTC
A commit in branch stable/14 references this bug:

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

commit fb3408bb6e5b7bebe8800d9f08579d9dc6236b81
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-12-03 10:45:10 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-12-31 13:16:10 +0000

    rc.d/sendmail: Fix error with some configurations

    The sendmail startup script can run 4 daemons: sendmail, sendmail_submit,
    sendmail_outbound, and sendmail_msp_queue.  Of the first 3 at most one
    can be enabled.  There's a run_rc_command call for each and the ones for
    sendmail and sendmail_msp_queue run unconditionally.  For some rc
    commands this triggers warnings or errors when sendmail_enable="NO" or
    sendmail_msp_queue_enable="NO".  Since d2e7bb630b83 these errors are
    propagated and the whole script fails.

    Fix this by first determining which daemons are enabled, setting ${name}
    and ${rcvar} accordingly, and then always calling run_rc_command
    conditionally.

    Also replace ${name}.cf with sendmail.cf because ${name} isn't always
    sendmail.

    PR:             282585
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D47757

    (cherry picked from commit 6b17d944a1d448dbb797c5fa5b0778242ba02e52)

 libexec/rc/rc.d/sendmail | 49 +++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)