Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 634414

Summary: www-servers/apache should provide a way to pass commands to apache with CLI similar to the one composed by /etc/init.d/apache2
Product: Gentoo Linux Reporter: Joona Hoikkala <joona>
Component: Current packagesAssignee: Lars Wendler (Polynomial-C) (RETIRED) <polynomial-c>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo, jstein, lithium3141, Ma3oxuct
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gitweb.gentoo.org/proj/apache.git/commit/?id=9e3d349cc1ee14e91d377b6a38c786ac4b153fe5
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Proposed fix to apache2ctl enabling described behavior
Proposed fix w/o bashisms

Description Joona Hoikkala 2017-10-16 06:57:57 UTC
Created attachment 498822 [details]
Proposed fix to apache2ctl enabling described behavior

www-servers/apache currently compiles Defines to apache2 daemon command line from variables defined in /etc/conf.d/apache2. These Define-statements are then used in the actual Apache configuration to parse certain directives in configuration within IfDefine - directives.

Both OpenRC script and apache2ctl currently lack functionality to enable users to run Apache2 commands with the complete compiled command line, with parameters parsed from the Gentoo specific configuration files. If the commands are run without the compiled CLI, results are affected by that hence being incorrect.

I propose adding functionality to apache2ctl - wrapper, which currently is only a wrapper for OpenRC script at /etc/init.d/apache2. This issue has a functional example of this behavior attached. What the modification does, is it looks in to the parameters passed to apache2ctl and if the first parameter is a verb used by /etc/init.d/apache2 it resumes the old behavior - passing the command forward to the init script. In other cases, it uses the same functionality as init script to compile the CLI parameters, and uses the compiled command line to run the command.
Comment 1 spock128 2018-02-01 13:25:12 UTC
For context see this certbot bug, as cert renewals are currently broken (certbot-0.20.0 & apache-2.4.29-r1)

https://github.com/certbot/certbot/issues/5344
Comment 2 David Mudrák 2018-02-15 08:25:34 UTC
I had the same problem as described at https://github.com/certbot/certbot/issues/5344 

I can confirm that replacing the default apache2ctl with Joona's version makes certbot 0.20.0 great again.

app-crypt/certbot-0.20.0::gentoo
www-servers/apache-2.4.27-r1::gentoo
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-02-15 13:08:00 UTC
So the script points to /bin/sh but uses a couple of bashisms[1]. That won't work with lightweight shells like dash or mksh.
This needs to be reworked in order to become POSIX sh compliant before I can put it into a release.

[1] https://wiki.ubuntu.com/DashAsBinSh
    https://mywiki.wooledge.org/Bashism
Comment 4 tazinblack 2018-02-18 08:41:59 UTC
Same problem here. Would be great if this could be fixed.
Thank you!
Comment 5 Andrey Falko 2018-02-19 21:13:58 UTC
Created attachment 520254 [details]
Proposed fix w/o bashisms

Attached is my attempt to remove bashisms per Polynomial-C's request. I tested with both bash and dash.
Comment 6 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-03-15 09:46:54 UTC
(In reply to Andrey Falko from comment #5)
> Created attachment 520254 [details]
> Proposed fix w/o bashisms
> 
> Attached is my attempt to remove bashisms per Polynomial-C's request. I
> tested with both bash and dash.

You cannot hard-code /usr/lib64 in the script. What about 32bit systems?
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-03-15 09:55:11 UTC
Ah well, we can modify it in the ebuild anyway. I gonna hack something up...
Comment 8 Larry the Git Cow gentoo-dev 2018-03-15 11:00:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8aed55978b5cd3375bc32f32792e3512862a3b94

commit 8aed55978b5cd3375bc32f32792e3512862a3b94
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2018-03-15 10:59:02 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2018-03-15 11:00:19 +0000

    www-servers/apache: Bump to version 2.4.32
    
    Changes/Enhancements:
    - Enabled http2 by default (#563452)
    - Pass commands to apache with apache2ctl (#634414)
    
    Bug: https://bugs.gentoo.org/563452
    Closes: https://bugs.gentoo.org/634414
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 www-servers/apache/Manifest             |   2 +
 www-servers/apache/apache-2.4.32.ebuild | 248 ++++++++++++++++++++++++++++++++
 2 files changed, 250 insertions(+)