From nobody Wed Nov 06 00:10:17 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XjlwH69QTz5bpL8; Wed, 06 Nov 2024 00:10:39 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XjlwH4243z4pf7; Wed, 6 Nov 2024 00:10:39 +0000 (UTC) (envelope-from tijl@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730851839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5B1LnKwCWhi74BexD0Gvf0EhXSVltz83aR4hzlyaVHs=; b=I1OmksH203pQCwNF65ftkZcEidglW29ciE3USvL/cPY4PgUVcp+w/Bz8Lgf/DpFwSKwVfu yPKYf1u1BpwolONxsXXz7odsW9/j42TG43cQTPtjXbZhSRmtv9tKa5ASvTPRuNifll3ecb W+IYOtiVYxpr177jpJ7At4BJGaIU4BLCJYQuwgAmYASEtAvji4rB2nNajAFC7xmoITtY4X GLcpCbpsKZ964pSuEEb2QKKrWDwRhGVxgp/wmzRhOcDGOXFCIQqycs34J+e+wAw/ZJ4zhE vs1FBPupoDtfEdmoABFnonB8ipR23P/iW+004a4+6OnT+um7SKnRp9Nz1Vh2mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730851839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5B1LnKwCWhi74BexD0Gvf0EhXSVltz83aR4hzlyaVHs=; b=D5VptaZQRKbtm69kxwltug7Uthox9xvDC54DRV2kjoZMsQ3TrtcsyXWCNDV0GYHcAmN9hA SjIS4kZa3M8pjJnPNSy3pZSU3SufmvCoAUsD/85t8tNUdrdL6q7vcW6y4qcjX9esz9C0oG 0Y3S579MM2EKK5uwAXyyEY4cxqFbEVdZDdJ0gJCnERJKeiadRQPXvnCoQllrh99pe46Atl qzReJMPb3BtDRkWX3TRzEWqce9mlDKlo6ug6YVo3xnXVyTKboZaUrtO/rZ4GwjyKXFjxI7 5D6Ud9iRtjIQdftKBx+AlwcM6qlU/sWy81OwRvnvF4z9Qsz8lF+tlbJe94NPdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730851839; a=rsa-sha256; cv=none; b=W9ZnfRuP8Xa36nFv/iRAPP2JAqsB8z43UTZkhvttnBGZMyveU1d20yXGooCTYcf1pA8D6N SWuklz5aarrgokC7h5Y0+3u0OdeGfMUWqHapg4kUGz7KuUOc7o7ZU+DHOKIxERRkqimcMp iO5OR/l3mlYMvPIqBse2w4/0OLEff+Fe0iDsNtTk3QMIWXyH1NvgSH2I9gopiiS0S6WKSY trvAAM+1nHdOxgnfiF/3Q2GZkVfTt+ftUko3LjRaHL2LdczMdXv6QLZtiSrXVXc2eXTHrG t9wO+fogb4TLAbgtRd9lf1jnKjpQqUDN8ArTdvDJeADScbqEYSBgUC56jVsbrw== Received: from hal.tijl.coosemans.org (unknown [IPv6:2a02:a03f:994d:4700:4176:b282:c7bb:9a7c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: tijl) by smtp.freebsd.org (Postfix) with ESMTPSA id 4XjlwG6BjXzLhs; Wed, 6 Nov 2024 00:10:38 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Date: Wed, 6 Nov 2024 01:10:17 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Mateusz Piotrowski <0mp@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d2e7bb630b83 - main - rc.d/sendmail: Return non-zero if the daemon fails to start or is not running Message-ID: <20241106011017.68146ea9@hal.tijl.coosemans.org> In-Reply-To: <202410211921.49LJLj5t024751@gitrepo.freebsd.org> References: <202410211921.49LJLj5t024751@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 21 Oct 2024 19:21:45 GMT Mateusz Piotrowski wrote: > The branch main has been updated by 0mp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d2e7bb630b83848a774d8213014a9e0747775019 > > commit d2e7bb630b83848a774d8213014a9e0747775019 > Author: Mateusz Piotrowski <0mp@FreeBSD.org> > AuthorDate: 2024-10-21 10:10:52 +0000 > Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > CommitDate: 2024-10-21 19:20:36 +0000 > > rc.d/sendmail: Return non-zero if the daemon fails to start or is not running > > If you have a mail server that is running sendmail daemon > (sendmail_enable=YES) and sendmail queue runner (sendmail_msp_queue=YES) > and the sendmail daemon dies, /etc/rc.d/sendmail status does see the > daemon is not running but returns 0 as the exit code. This prevents > other programs (like puppet) from restarting sendmail to fix the issue. > > Make sure that the exit code is propagated towards the end of the script > if any of the sendmail services fail. > > This patch does not call exit directly but instead just sets the exit > status code by calling exit in a subshell. This way we do not exit the > current shell in case the service script is sourced (e.g., when > rc_fast_and_loose is active). > > PR: 223132 > MFC after: 2 weeks > Reported by: pirzyk > Discussed with: jilles, eugen > Reviewed by: christos, gshapiro (previous version), markj > Approved by: christos (mentor), markj (mentor) > Differential Revision: https://reviews.freebsd.org/D46862 > Co-authored-by: Jim Pirzyk > --- > libexec/rc/rc.d/sendmail | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libexec/rc/rc.d/sendmail b/libexec/rc/rc.d/sendmail > index af84c6d6b548..5a780e5b15a1 100755 > --- a/libexec/rc/rc.d/sendmail > +++ b/libexec/rc/rc.d/sendmail > @@ -206,6 +206,7 @@ sendmail_precmd() > } > > run_rc_command "$1" > +_ret=$? > > required_files= > > @@ -214,6 +215,7 @@ if checkyesno sendmail_submit_enable; then > rcvar="sendmail_submit_enable" > _rc_restart_done=false > run_rc_command "$1" > + _ret=$(( _ret > $? ? _ret : $? )) > fi > > if checkyesno sendmail_outbound_enable; then > @@ -221,6 +223,7 @@ if checkyesno sendmail_outbound_enable; then > rcvar="sendmail_outbound_enable" > _rc_restart_done=false > run_rc_command "$1" > + _ret=$(( _ret > $? ? _ret : $? )) > fi > > name="sendmail_msp_queue" > @@ -229,3 +232,6 @@ pidfile="${sendmail_msp_queue_pidfile:-/var/spool/clientmqueue/sm-client.pid}" > required_files="/etc/mail/submit.cf" > _rc_restart_done=false > run_rc_command "$1" > +_ret=$(( _ret > $? ? _ret : $? )) > + > +(exit "$_ret") Running "make stop" in /etc/mail now produces an error with the following config in /etc/rc.conf: sendmail_enable="NO" sendmail_msp_queue_enable="YES" sendmail_outbound_enable="YES" sendmail_submit_enable="YES"