Summary: | apache2 init script clobbers environment | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Simon Detheridge <social-gentoobugzilla> |
Component: | Current packages | Assignee: | Apache Team - Bugzilla Reports <apache-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fredrik |
Priority: | High | Keywords: | Inclusion |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Other | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Simon Detheridge
2005-05-17 04:35:56 UTC
The 'cleansing' of the environment is intentional, and there has been a few open bugs about this before. I really do not want to change this, or start creating white lists, either .. However, I can't think think of any one way that'd suit both camps .. Does anyone have any adverse feelings to having a white-list variable in /etc/conf.d/apache2 as Simon explained ? Would be easy to implement, as well (could also go in at the same time we kill the 'graceful-restart-by-default' behaviour in the init script </muse> ..) Could this one help? This lets the user decide what to keep from the env, and I have to use it on a customer site due to PHP/Oracle and NLS conflicts. Basically the user needs to maintain the var KEEPENV in /etc/conf.d/apache2 and it would default to PATH only. --- /etc/init.d/apache2 2005-07-04 15:06:05.000000000 +0200 +++ tmp/apache2 2005-07-04 15:05:33.000000000 +0200 @@ -37,6 +37,13 @@ eerror "Did you etc-update /etc/conf.d/apache2?" return 1 fi + + if [ ! -z "${KEEPENV}" ]; then + for n in ${KEEPENV}; do + OLDENV="${OLDENV} ${n}=`printenv ${n}`"; + done + fi + /usr/sbin/apache2 -t ${APACHE2_OPTS} 1>/dev/null 2>&1 ret=$? if [ $ret -ne 0 ]; then @@ -54,10 +61,13 @@ start() { checkconfig || return 1 + if [ ! -z "${OLDENV}" ]; then + einfo " Keeping old env: ${KEEPENV}" + fi ebegin "Starting apache2" [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache [ -f /usr/lib/apache2/build/envvars ] && . /usr/lib/apache2/build/envvars - env -i PATH=$PATH /sbin/start-stop-daemon --quiet \ + env -i $OLDENV /sbin/start-stop-daemon --quiet \ --start --startas /usr/sbin/apache2 \ --pidfile ${PIDFILE} -- -k start ${APACHE2_OPTS} eend $? *** Bug 79027 has been marked as a duplicate of this bug. *** I've added a fix for this to SVN. It will appear the next time a configuration tarball is rolled. New tarball rolled. Fixed in CVS. Resolving. |