Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 762481 - www-servers/apache-2.4.46-r4: /etc/init.d/apache2 status errors if PIDFILE= is changed
Summary: www-servers/apache-2.4.46-r4: /etc/init.d/apache2 status errors if PIDFILE= i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-12-30 00:28 UTC by Hank Leininger
Modified: 2020-12-30 02:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2020-12-30 00:28:53 UTC
/etc/init.d/apache2 specifies PIDFILE in such a way that it can be overridden by /etc/conf.d/apache2:

PIDFILE="${PIDFILE:-/var/run/apache2.pid}"

However... changing this works for start/stop but confuses status:

# /etc/init.d/apache2 status
 * status: crashed

This is because start-stop-daemon is not passed --pidfile "${PIDFILE}" (as is often, but not always, done in other /etc/init.d/* scripts). So the resulting /run/openrc/daemons/apache2/001 state file has an empty pidfile=, and 'init.d/apache2 status' does not know the nonstandard pidfile location and decides the service has crashed.

Simply adding --pidfile "${PIDFILE}" to the start action's start-stop-daemon causes the pidfile path to be correctly recorded, and so the 'status' action works fine. As far as I can tell that will have no negative consequences on systems which leave PIDFILE= as default.
Comment 1 Larry the Git Cow gentoo-dev 2020-12-30 01:32:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/apache.git/commit/?id=348521816ac865188a12f03b059d5463fe1f441e

commit 348521816ac865188a12f03b059d5463fe1f441e
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2020-12-30 01:29:34 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2020-12-30 01:29:34 +0000

    2.4/init: Submit pidfile to s-s-d on start to not confuse status
    
    Reported-by: Hank Leininger <hlein@korelogic.com>
    Bug: https://bugs.gentoo.org/762481
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 2.4/init/apache2.initd | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 2 Larry the Git Cow gentoo-dev 2020-12-30 02:02:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6458eb8b3983cada9077c463d5d3dff2f4c80219

commit 6458eb8b3983cada9077c463d5d3dff2f4c80219
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2020-12-30 02:00:56 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2020-12-30 02:02:01 +0000

    www-servers/apache: Submit pidfile to s-s-d on start
    
    Closes: https://bugs.gentoo.org/762481
    Closes: https://github.com/gentoo/gentoo/pull/18875
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 www-servers/apache/Manifest                | 2 +-
 www-servers/apache/apache-2.4.46-r4.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)