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

Bug#303076: apache2-common: false logic in /etc/init.d/apache2 in deciding which PidFile directive is being used

Package: apache2-common
Severity: important

In apache2-common 2.0.53-5, the /etc/init.d/apache2-script tries to
decide the PidFile directive Apache actually uses. Like this:

        # let's try to find the pid file
        # apache2 allows more than PidFile entry in the config but only
        # the last found in the config is used
        for PFILE in `grep ^PidFile /etc/apache2/* -r | awk '{print $2}'`; do
                if [ -e "$PIDFILE" ]; then
                        PID=`cat $PIDFILE`

There is a logical failure in this. This way, the PidFile that is the
last one in the alphabetically last config file in /etc/apache2 or any of
its subdirectories gets to be PIDFILE's content - whether or not apache
actually ever uses that config file! It might be, and actually probably
is, a file in sites-available that is never linked to in sites-enabled. And
if there are backup-files, they come alphabetically later than the actual
config file. Or it might be any file that just happens to be in the
directory, maybe because of an earlier installation, and is not included
from anywhere.

This bug bit me after the last upgrade: we have a custom logrotate-script
that tries to run /etc/init.d/apache2 restart. And we had an httpd.conf
file in /etc/apache2/sites-available that contained the config of an
earlier installation. And a false PidFile directive. Result: apache
didn't get restarted after logrotate, just kept on running, with false
references to logfiles. So we lost quite a bit of log... This is just
to tell why I think this bug important.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.10-xenU

Reply to: