Bug#271302: init.d script should not kill other unrelated apache processes
While upgrading apache in a chroot, I noticed that:
(a) there are two lines trying to stop apache, and not one:
Preparing to replace apache 1.3.31-3 (using .../apache_1.3.31-6_i386.deb) ...
Stopping web server: apache.
Stopping web server: apacheNo process in pidfile `/var/run/apache.pid' found
running; none killed.
This might be a different issue, and fwiw, I don't consider the mere fact that
two lines are displayed a bug worth reporting.
(b) It killed the apache process that was running on the main system in addition
to the one in the chroot. The init.d script should _not_ touch random
processes called 'apache', but only those that are part of the apache package.
The prerm kills all `pidof apache`, it could at least use `pidof
/usr/bin/apache to limit it to processes that are Debian's apache (this will
not fix killing of apache in other/parent chroot's, but is still better).
| When pidof is invoked with a full pathname to the program it should
| find the pid of, it is reasonably safe. Otherwise it is possible
| that it returns pids of running programs that happen to have the same
| name as the program you're after but are actually other programs.
In order to really fix killing of processes in different chroots, you could
check whether /proc/$PID/exe is a symlink to '/usr/bin/apache' (and doesn't
give an error). For chroots that are below the root of the current process,
that will give /chroot/usr/bin/apache (for example), and for roots that are
upwards of the current root, it will give a permission denied.
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=nl_NL.UTF-8@euro, LC_CTYPE=nl_NL.UTF-8@euro
Versions of packages apache depends on:
ii apache-common 1.3.31-5 Support files for all Apache webse
ii debconf 22.214.171.124 Debian configuration management sy
ii dpkg 1.10.23 Package maintenance system for Deb
ii libc6 2.3.2.ds1-13 GNU C Library: Shared libraries an
ii libdb4.2 4.2.52-17 Berkeley v4.2 Database Libraries [
ii libexpat1 1.95.6-8 XML parsing C library - runtime li
ii libmagic1 4.09-1 File type determination library us
ii logrotate 3.7-2 Log rotation utility
ii mime-support 3.28-1 MIME files 'mime.types' & 'mailcap
ii perl 5.8.4-2 Larry Wall's Practical Extraction
-- debconf information:
* apache/enable-suexec: true
* apache/server-name: wolffelaar.nl
* apache/document-root: /var/www
* apache/server-port: 80
* apache/init: true
* apache/server-admin: email@example.com
Jeroen van Wolffelaar