[Bug 284950] www/apache24: Behavior of config checks in rc-script

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 21 Feb 2025 15:50:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284950

            Bug ID: 284950
           Summary: www/apache24: Behavior of config checks in rc-script
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: apache@FreeBSD.org
          Reporter: michael.glaus@hostpoint.ch
          Assignee: apache@FreeBSD.org
             Flags: maintainer-feedback?(apache@FreeBSD.org)

Created attachment 257721
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=257721&action=edit
Improve behavior when checking config

I noticed that if you use the reload command of the rc-script, the apache
config will be checked twice. Once because the reload_precmd is set to
apache24_checkconfig and the reload function itself calls the
apache24_checkconfig function.

Because of this, i looked closer at the rc-script and found some other weird
behaviors.
- For the commands start, reload, graceful and gracefulstop the function
apache24_checkconfig is called, but the result is not used at all and the
script continues executing, even if the config is invalid
- The command reload and graceful do the same thing, except reload does check
the config twice.
- The restart command does check the config also twice (Once before stopping
apache and once before starting apache)

The attached patch does fix some of these points.
- The result of apache24_checkconfig will be checked and the command will abort
if there is an invalid config
- reload_precmd is removed. The config will be checked once for a reload. The
behavior of reload and graceful is the same

It would be nice, if the restart command does only check the config once,
before stopping apache. But I don't have much experience with rc-scripts, so
I'm unsure of the best approach to take.

-- 
You are receiving this mail because:
You are the assignee for the bug.