[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#316303: apache2-common: apache2ctl -k stop not being used - faulty init.d/apache2 logic



Package: apache2-common
Version: 2.0.54-4
Severity: normal
Tags: patch


The /etc/init.d/apache2 init script that comes with apache2-common has a
logic error that causes the script to always fall back to killing apache
instead of using apache2ctl -k stop.

Basically it's because this:

if `apache2 -t > /dev/null 2>&1`; then

will always be false, due to being in backticks.  After fixing this, I
also noticed and added a fix for bug 290060, which is that `apache2 -k
stop' is being called inside this if statement instead of `apache2ctl -k
stop'.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-rc4
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)

Versions of packages apache2-common depends on:
ii  apache2-utils                 2.0.54-4   utility programs for webservers
ii  debconf                       1.4.51     Debian configuration management sy
ii  debianutils                   2.14.1     Miscellaneous utilities specific t
ii  libc6                         2.3.5-1    GNU C Library: Shared libraries an
ii  libdb4.2                      4.2.52-19  Berkeley v4.2 Database Libraries [
ii  libexpat1                     1.95.8-3   XML parsing C library - runtime li
ii  libgcc1                       1:4.0.0-11 GCC support library
ii  libmagic1                     4.12-1     File type determination library us
ii  mime-support                  3.34-1     MIME files 'mime.types' & 'mailcap
ii  net-tools                     1.60-13    The NET-3 networking toolkit
ii  openssl                       0.9.7g-1   Secure Socket Layer (SSL) binary a
ii  ssl-cert                      1.0-11     Simple debconf wrapper for openssl

apache2-common recommends no packages.

-- no debconf information
--- /etc/init.d/apache2	2005-06-29 14:19:11.000000000 -0700
+++ /etc/init.d/apache2.fixed	2005-06-29 14:19:08.000000000 -0700
@@ -42,14 +42,12 @@
 		fi
 	done
 
-	if `apache2 -t > /dev/null 2>&1`; then
+	if $APACHE2 -t > /dev/null 2>&1; then
 		# if the config is ok than we just stop normaly
 
-		if [ -e "$PIDFILE" ]
+		if [ -n "$PID" ]
 		then
-			PID=`cat $PIDFILE`
-
-			$APACHE2 -k stop
+			$APACHE2CTL -k stop
 
 			CNT=0
 			while [ 1 ]

Reply to: