- update to /etc/init.d/apache2: handle reload with deleted

binaries after package update more thoughtfully: If the binaries
  have been replaced, then a dlopen(3) on the apache modules is
  prone to fail. => Don't reload then, but complain and fail.
  Especially important for logrotate!

OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=350
This commit is contained in:
Roman Drahtmueller 2011-11-18 15:55:03 +00:00 committed by Git OBS Bridge
parent 8015fbf1a2
commit 1ee79ea228
2 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Nov 18 15:04:12 CET 2011 - draht@suse.de
- update to /etc/init.d/apache2: handle reload with deleted
binaries after package update more thoughtfully: If the binaries
have been replaced, then a dlopen(3) on the apache modules is
prone to fail. => Don't reload then, but complain and fail.
Especially important for logrotate!
-------------------------------------------------------------------
Fri Oct 7 17:11:56 CEST 2011 - draht@suse.de

View File

@ -6,8 +6,8 @@
# Copyright (c) 2004(?), 2005, 2006, 2007, 2008 SUSE Linux Products GmbH
#
# Authors: Rolf Haberrecker <apache@suse.de>, 2001
# Peter Poeml <apache@suse.de>, 2002, 2003, 2004, 2005, 2006, 2007,
# 2008, 2009, 2010
# Peter Poeml <apache@suse.de>, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011.
# Roman Drahtmueller <draht@suse.de>, 2010, 2011, 2012.
#
#
# /etc/init.d/apache2
@ -162,6 +162,8 @@ case "$action" in
echo -n "(not running)"
else
pid=$(<$pidfile)
# re-read exe symlink, it could be (deleted) in the meanwhile.
apache_bin=$(readlink /proc/$pid/exe 2>/dev/null)
kill -TERM $pid 2>/dev/null
case $? in
1) echo -n "(not running)";;
@ -175,7 +177,7 @@ case "$action" in
if ! test -f /proc/$pid/exe; then
break
fi
if test "$(readlink /proc/$pid/exe 2>/dev/null)" = $apache_bin; then
if test "$(readlink /proc/$pid/exe 2>/dev/null)" = "$apache_bin"; then
usleep 500000
else
break
@ -261,7 +263,25 @@ case "$action" in
rc_status
;;
reload|force-reload|graceful)
# check if there is a deleted binary. If there is, then logrotate
# or other occasions will fail to reload, as dlopen(3) of apache
# modules is prone to fail due to symbol mismatches.
# in this case, we only complain and fail.
if [ ! -f $pidfile -a -f $pidfile.rpmsave ]; then mv $pidfile.rpmsave $pidfile; fi
executable=$( readlink /proc/$(cat $pidfile)/exe 2> /dev/null )
case "$executable" in
*httpd*delete*)
echo -n "Reload httpd2 after package update: ignoring request. Please do a manual restart explicitly! "
rc_failed 1
rc_status -v
rc_exit
;;
*)
;;
esac
echo -n "Reload httpd2 (graceful restart)"
cmdline=$(echo $apache_bin -f $httpd_conf $server_flags "$@")
if eval $cmdline -t &> $logdir/rc$pname.out; then
killproc -USR1 $apache_bin || return=$rc_failed