Package: apache2.2-common Version: 2.2.11-2 Severity: wishlist Tags: patch
The following patch adjusts /etc/init.d/apache2 to use POSIX $() command substitution[1] in every place. The $() was already in use, but there were some old backticks left. In some places the extra shell call seemed to be unnecessary, so the calls were simplified. An example: - if `$APACHE2CTL configtest > /dev/null 2>&1`; then + if $APACHE2CTL configtest > /dev/null 2>&1; then I believe, the return code of $APACHE2CTL call is available to the if-statement without running it under subshell. [1] http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03 -- Package-specific info: List of enabled modules from 'apache2 -M': actions* alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env mime negotiation php5 setenvif status (A * means that the .conf file for that module is not enabled in /etc/apache2/mods-enabled/) -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages apache2 depends on: ii apache2-mpm-prefork 2.2.11-2 Apache HTTP Server - traditional n apache2 recommends no packages. apache2 suggests no packages. Versions of packages apache2.2-common depends on: ii apache2-utils 2.2.11-2 utility programs for webservers ii libapr1 1.3.3-3 The Apache Portable Runtime Librar ii libaprutil1 1.2.12+dfsg-8 The Apache Portable Runtime Utilit ii libc6 2.9-4 GNU C Library: Shared libraries ii libmagic1 5.00-1 File type determination library us ii libssl0.9.8 0.9.8g-16 SSL shared libraries ii libuuid1 1.41.3-1 universally unique id library ii lsb-base 3.2-22 Linux Standard Base 3.2 init scrip ii mime-support 3.44-1 MIME files 'mime.types' & 'mailcap ii net-tools 1.60-23 The NET-3 networking toolkit ii perl 5.10.0-19 Larry Wall's Practical Extraction ii procps 1:3.2.7-11 /proc file system utilities ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime -- no debconf information
>From fd6ce1ac0780a9af8bdf474c6faddd821c74fc6d Mon Sep 17 00:00:00 2001 From: Jari Aalto <jari.aa...@cante.net> Date: Fri, 10 Apr 2009 01:08:58 +0300 Subject: [PATCH] apache2.2-common.apache2.init: Use POSIX command substitution Signed-off-by: Jari Aalto <jari.aa...@cante.net> --- apache2.2-common.apache2.init | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) mode change 100644 => 100755 apache2.2-common.apache2.init diff --git a/apache2.2-common.apache2.init b/apache2.2-common.apache2.init old mode 100644 new mode 100755 index 4d274be..bf60106 --- a/apache2.2-common.apache2.init +++ b/apache2.2-common.apache2.init @@ -13,7 +13,7 @@ ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin" -#[ `ls -1 /etc/apache2/sites-enabled/ | wc -l | sed -e 's/ *//;'` -eq 0 ] && \ +#[ $(ls -1 /etc/apache2/sites-enabled/ | wc -l | sed -e 's/ *//;') -eq 0 ] && \ #echo "You haven't enabled any sites yet, so I'm not starting apache2." && \ #echo "To add and enable a host, use addhost and enhost." && exit 0 @@ -41,7 +41,7 @@ test -f /etc/default/apache2 && . /etc/default/apache2 APACHE2CTL="$ENV /usr/sbin/apache2ctl" HTCACHECLEAN="$ENV /usr/sbin/htcacheclean" -PIDFILE=`. /etc/apache2/envvars ; echo $APACHE_PID_FILE` +PIDFILE=$(. /etc/apache2/envvars && echo $APACHE_PID_FILE) if [ -z "$PIDFILE" ] ; then echo ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars >&2 exit 2 @@ -72,9 +72,9 @@ stop_htcacheclean() { pidof_apache() { # if pidof is null for some reasons the script exits automagically # classified as good/unknown feature - PIDS=`pidof apache2` || true + PIDS=$(pidof apache2) || true - [ -e $PIDFILE ] && PIDS2=`cat $PIDFILE` + [ -e $PIDFILE ] && PIDS2=$(cat $PIDFILE) # if there is a pid we need to verify that belongs to apache2 # for real @@ -91,7 +91,7 @@ pidof_apache() { } apache_stop() { - if `$APACHE2CTL configtest > /dev/null 2>&1`; then + if $APACHE2CTL configtest > /dev/null 2>&1; then # if the config is ok than we just stop normaly $APACHE2CTL stop 2>&1 | grep -v 'not running' >&2 || true else @@ -120,7 +120,7 @@ apache_stop() { apache_wait_stop() { # running ? PIDTMP=$(pidof_apache) - if $(kill -0 "${PIDTMP:-}" 2> /dev/null); then + if kill -0 "${PIDTMP:-}" 2> /dev/null; then PID=$PIDTMP fi @@ -129,7 +129,7 @@ apache_wait_stop() { # wait until really stopped if [ -n "${PID:-}" ]; then i=0 - while $(kill -0 "${PID:-}" 2> /dev/null); do + while kill -0 "${PID:-}" 2> /dev/null; do if [ $i = '60' ]; then break; else -- 1.6.2.1