[debian-mysql] Bug#453820: mysql-server-5.0: Don't use commented out password lines

Nis Martensen nis.martensen at eev.tu-darmstadt.de
Sat Dec 1 11:46:44 UTC 2007

Package: mysql-server-5.0
Version: 5.0.32-7etch3
Severity: minor
Tags: patch

We were wondering why upgrading mysql-server kept breaking access for
the debian-sys-maint user for us. The reason turned out to be that we
had an old (commented out) password line in /etc/mysql/debian.cnf (at
the top of the file). It was a bit hard to find out that this was the
reason. I'd like to suggest something like this:

--- /var/lib/dpkg/info/mysql-server-5.0.postinst	2007-11-20 06:10:29.000000000 +0100
+++ mysql-server-5.0.postinst	2007-12-01 11:46:27.000000000 +0100
@@ -174,7 +174,7 @@
     # recreate the credentials file if not present or without mysql_upgrade stanza
     if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
-        pass="`sed -n 's/password *= *// p' $dc | head -n 1`"
+        pass="`sed -n 's/^[ 	]*password *= *// p' $dc | head -n 1`"
 	pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
         if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi

More information about the pkg-mysql-maint mailing list