Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Sep 2005 22:02:28 +0930 (CST)
From:      Jarrod Sayers <jarrod@netleader.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/85566: [patch] Correction to allow for restart/reload of www/apache2 when using apache2_profiles
Message-ID:  <200509011232.j81CWSjY032662@manhattan.netleader.com.au>
Resent-Message-ID: <200509011240.j81CeIF4023803@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         85566
>Category:       ports
>Synopsis:       [patch] Correction to allow for restart/reload of www/apache2 when using apache2_profiles
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 01 12:40:18 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jarrod Sayers
>Release:        FreeBSD 4.11-RELEASE-p11 i386
>Organization:
>Environment:
System: FreeBSD manhattan.netleader.com.au 4.11-RELEASE-p11 FreeBSD 4.11-RELEASE-p11 #21: Sun Jul 3 15:43:12 CST 2005 root@manhattan.netleader.com.au:/usr/obj/usr/src/sys/MANHATTAN i386

Port: www/apache2
  $FreeBSD: ports/www/apache2/Makefile,v 1.225 2005/08/25 20:24:52 clement Exp $
  $FreeBSD: ports/www/apache2/files/apache.sh,v 1.13 2005/06/01 17:49:31 clement Exp $

>Description:
When www/apache2 is configured to use profiles, the ability to use the restart
and reload directives is lost due to an issue with apache.sh which is installed
as /usr/local/etc/rc.d/apache2.sh and the way the syntax check is performed.

When attempting a restart or reload, the following error is generated (and no
reload):

manhattan# /usr/local/etc/rc.d/apache2.sh reload
===> apache2 profile: httpd171
Reloading apache2 config files.
Performing sanity check on apache2 configuration:
Usage: /usr/local/sbin/httpd [-D name] [-d directory] [-f file]
                             [-C "directive"] [-c "directive"]
                             [-k start|restart|graceful|stop]
                             [-v] [-V] [-h] [-l] [-L] [-t] [-S]
[~ much noice about command line arguments ~]
===> apache2 profile: httpd172
Reloading apache2 config files.
Performing sanity check on apache2 configuration:
Usage: /usr/local/sbin/httpd [-D name] [-d directory] [-f file]
                             [-C "directive"] [-c "directive"]
                             [-k start|restart|graceful|stop]
                             [-v] [-V] [-h] [-l] [-L] [-t] [-S]
[~ much noice about command line arguments ~]
manhattan#

The start and stop directives are performed by routines in rc.subr and using a
'set -x' on the shell script, the process is started as follows:

+ eval /usr/local/sbin/httpd -f /usr/local/etc/apache2/httpd172.conf -c "PidFile /var/run/httpd.httpd172.pid"
+ /usr/local/sbin/httpd -f /usr/local/etc/apache2/httpd172.conf -c PidFile /var/run/httpd.httpd172.pid
+ _return=0 

However the restart and reload directives are performed by the apache2.sh script
resulting in:

+ echo Performing sanity check on apache2 configuration:
Performing sanity check on apache2 configuration:
+ /usr/local/sbin/httpd -f /usr/local/etc/apache2/httpd172.conf -c "PidFile /var/run/httpd.httpd172.pid" -t
Usage: /usr/local/sbin/httpd [-D name] [-d directory] [-f file] 

I believe the error is caused by the addition of the -c argument (more importantly,
the requirement for the quotes) to override the location of the pid file
regardless of the one defined within the configuration file.

>How-To-Repeat:
Install www/apache2 from ports:`

manhattan# cd /usr/ports/www/apache2
manhattan# make install clean

Add lines to /etc/rc.conf to enable apache2 profiles (use would normally be for
more than one profile but apache2_profiles can be used to start a single httpd
process to confirm the error):

apache2_enable="YES"
apache2_profiles="httpd"
apache2_httpd_configfile="/usr/local/etc/apache2/httpd.conf"

>Fix:
Eval'ing the command performing the sanity checks corrects the error (and mimics
a standard start procedure) allowing for restart and reload ability regardless
of the use of profiles.  (Very simple) diff provided below:

--- ports/www/apache2/files/apache.sh.orig	Fri Jul  1 19:49:58 2005
+++ ports/www/apache2/files/apache.sh	Mon Aug 29 15:32:12 2005
@@ -93,7 +93,7 @@
 apache2_checkconfig()
 {
 	echo "Performing sanity check on apache2 configuration:"
-	${command} ${apache2_flags} -t
+	eval ${command} ${apache2_flags} -t
 }
 
 apache2_precmd() 

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509011232.j81CWSjY032662>