Bug#445946: [apache2.2-common] /etc/init.d/apache2 restart gives an error when /bin/sh points to dash
Package: apache2.2-common
Version: 2.2.3-4+etch1
Severity: minor
Tags: patch
When /bin/sh points to dash, invoking
# /etc/init.d/apache2 restart
gives the following error:
Forcing reload of web server (apache2).../etc/init.d/apache2: 172: [[: not
found
/etc/init.d/apache2: 172: [[: not found
..
When /bin/sh points to bash, the above command works without any error
message.
Below is a diff between Debian's supplied file and my supposed changes. If
applied, the script works without error output if /bin/sh points to dash.
# diff -U 3 /etc/init.d/apache2 /tmp/apache2
--- /etc/init.d/apache2 2007-06-17 22:12:56.000000000 +0200
+++ /tmp/apache2 2007-10-09 11:00:42.000000000 +0200
@@ -102,10 +102,10 @@
if [ -n "${PID:-}" ]; then
i=0
while $(kill -0 "${PID:-}" 2> /dev/null); do
- if [[ $i == '30' ]]; then
+ if [ "$i" = '30' ]; then
break;
else
- if [[ $i == '0' ]]; then
+ if [ "$i" = '0' ]; then
echo -n " waiting "
else
echo -n "."
# diff -C 3 /etc/init.d/apache2 /tmp/apache2
*** /etc/init.d/apache2 2007-06-17 22:12:56.000000000 +0200
--- /tmp/apache2 2007-10-09 11:00:42.000000000 +0200
***************
*** 102,111 ****
if [ -n "${PID:-}" ]; then
i=0
while $(kill -0 "${PID:-}" 2> /dev/null); do
! if [[ $i == '30' ]]; then
break;
else
! if [[ $i == '0' ]]; then
echo -n " waiting "
else
echo -n "."
--- 102,111 ----
if [ -n "${PID:-}" ]; then
i=0
while $(kill -0 "${PID:-}" 2> /dev/null); do
! if [ "$i" = '30' ]; then
break;
else
! if [ "$i" = '0' ]; then
echo -n " waiting "
else
echo -n "."
Reply to: