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

Bug#215150: apache: Fails to start after upgrade



The apache.config script assumes that there will only be *one* matching
line in the existing httpd.conf for the pattern '^ServerName'.  If there
is more than one such line, the values of each will be concatenated, and
the combination will be substituted into the config file everywhere a
ServerName was previously listed.

This code will ensure that you only grab one server name from the
config:

    SERNAME=`grep ^ServerName /etc/apache/httpd.conf | head -n 1 | awk '{print $NF}'`

but it would be far better to check whether you get multiple matches,
and *not* make any changes to the config file at all if so, since this
debconf handling will wreak serious havoc with any http.conf containing
multiple virtual hosts.  I would suggest adding a check to the config
script that checks the values of SERNAME, SERADMIN, DOCROOT, and PORT,
and if *any* of them return a value > 1 when passed to wc -w, set a
debconf flag telling the postinst not to make any changes, and don't ask
the user any questions about httpd.conf.

Also, I noticed this check in do_debconf_configs() from postinst.common:

    if [ ! "`grep -q ^ServerName /etc/$pkg/httpd.conf`" ]; then

Well, 'grep -q' will always output 0 bytes.  I think the check you want
here is simply

    if ! grep -q ^ServerName /etc/$pkg/httpd.conf; then

Let me know if you would like me to work up a patch for these problems.

Thanks,
-- 
Steve Langasek
postmodern programmer

Attachment: signature.asc
Description: Digital signature


Reply to: