Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2007 11:02:25 +0400 (MSD)
From:      Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        clement@FreeBSD.org
Subject:   ports/116627: [patch] www/apache22: completely shut up rc.d script when no profiles are enabled
Message-ID:  <20070925070225.57FB21AF41C@void.codelabs.ru>
Resent-Message-ID: <200709250710.l8P7A1F5038590@freefall.freebsd.org>

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

>Number:         116627
>Category:       ports
>Synopsis:       [patch] www/apache22: completely shut up rc.d script when no profiles are enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 25 07:10:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
Code Labs
>Environment:

System: FreeBSD XXX 7.0-CURRENT FreeBSD 7.0-CURRENT #10: Wed Sep 12 16:16:49 MSD 2007 root@XXX:/usr/src/sys/i386/compile/XXX i386

>Description:

If one has a number of Apache profiles, but has apache22_enable set
to NO, rc.d script still prints the names of the profiles (but, of
cource, does no further actions).  This is a bit annoying as it can
provoke the thoughts that something gone terribly wrong.

>How-To-Repeat:

Add a couple of Apache profiles, do not set individual values
for apache22_<profile>_enable and set apache22_enable to NO.
Run /usr/local/etc/rc.d/apache22 start and see the profile
banners.

The same effect can be achieved if not all apache22_<profile>_enable
are set to 'yes': rc.d script will still output names of all profiles.

>Fix:

The following patch fixes the situation.  Furthermore, it checks
the apache22*_enable values to be 'yes', 'no' or 'none' and issues
warning if some variable has the other value.

--- apache22.sh.in.respect-enable.patch begins here ---
--- apache22.sh.in.orig	2007-09-25 09:55:57.000000000 +0400
+++ apache22.sh.in	2007-09-25 10:54:20.000000000 +0400
@@ -89,6 +89,26 @@
 else
 	if [ "x${apache22_profiles}" != "x" -a "x$1" != "x" ]; then
 		for profile in ${apache22_profiles}; do
+			eval _enable="\${apache22_${profile}_enable}"
+			case "x${_enable:-${apache22_enable}}" in
+			x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+				continue
+				;;
+			x[Yy][Ee][Ss])
+				;;
+			*)
+				if test -z "$_enable"; then
+					_var=apache22_enable
+				else
+					_var=apache22_"${profile}"_enable
+				fi
+				echo "Bad value" \
+				    "'${_enable:-${apache22_enable}}'" \
+				    "for ${_var}. " \
+				    "Profile ${profile} skipped."
+				continue
+				;;
+			esac
 			echo "===> apache22 profile: ${profile}"
 			%%PREFIX%%/etc/rc.d/apache22%%RC_SUBR_SUFFIX%% $1 ${profile}
 			retcode="$?"
--- apache22.sh.in.respect-enable.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



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