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

Bug#307901: phpmyadmin: fix for 307275 introduces potential for further config breakage



Package: phpmyadmin
Version: 4:2.6.2-2
Severity: important

The latest version of phpmyadmin uses the following code to undo a
release-critical bug of editing another package's conffile:

@@ -146,6 +146,15 @@
      ucf --purge /etc/phpmyadmin/apache.conf
      rm -f /etc/phpmyadmin/apache.conf.md5sum
  fi
+ # Trying to fix the mess. Sorry :( See #307275.
+ if [ "$1" = "upgrade" -a -n "$2" ] && \
+   dpkg --compare-versions "$2" lt-nl "4:2.6.2-2"; then
+     if grep -qs "^# Include /etc/apache2/conf\.d/\[^\.#\]\*$" /etc/apache2/apache2.conf; then
+         cp -f /etc/apache2/apache2.conf /etc/apache2/apache2.conf.old.phpmyadmin
+         grep -v "^Include /etc/apache2/conf\.d/\*\.conf" /etc/apache2/apache2.conf.old.phpmyadmin | \
+         sed "s%^# \(Include /etc/apache2/conf\.d/\[^\.#\]\*\)$%\1%" > /etc/apache2/apache2.conf
+     fi
+ fi
  .
  for webserver in apache apache-perl apache-ssl apache2; do
      if [ -f /etc/$webserver/conf.d/phpmyadmin.conf ]; then


There are two problems with this code block:

- The only version of phpmyadmin that contained this bug, according to the
  changelog, was 4:2.6.2-1.  Therefore, the code should check for *exactly*
  that version, instead of making further, possibly inappropriate changes to
  apache2's conffile.
- This code does not preserve permissions on apache2.conf, and introduces
  the possibility of breaking the config file if the grep/sed pipeline is
  interrupted mid-write.

A more robust solution would be:

 if [ "$1" = "upgrade" -a "$2" = "4:2.6.2-1" ]; then
     if grep -qs "^# Include /etc/apache2/conf\.d/\[^\.#\]\*$" /etc/apache2/apache2.conf; then
         grep -v "^Include /etc/apache2/conf\.d/\*\.conf" /etc/apache2/apache2.conf | \
         sed "s%^# \(Include /etc/apache2/conf\.d/\[^\.#\]\*\)$%\1%" > /etc/apache2/apache2.conf.old.phpmyadmin 
         chmod --reference=/etc/apache2/apache2.conf /etc/apache2/apache2.conf.old.phpmyadmin
         chown --reference=/etc/apache2/apache2.conf /etc/apache2/apache2.conf.old.phpmyadmin
         mv /etc/apache2/apache2.conf.old.phpmyadmin /etc/apache2/apache2.conf
     fi
 fi

Please address this problem so that 2.6.2-2 can be considered for sarge.

In addition, the changelog mentions:

  * Doesn't load the PHP extensions automatically in config.inc.php script.

... which sounds like a regression to me...

Thanks,
-- 
Steve Langasek
postmodern programmer

Attachment: signature.asc
Description: Digital signature


Reply to: