[debian-mysql] Bug#453127: mysql-common: preinst breaks on upgrade if datadir not set

Edward Allcutt emallcut at gleim.com
Tue Nov 27 15:18:50 UTC 2007

Package: mysql-common
Version: 5.0.32-7etch1
Severity: normal

I run multiple mysqld instances on the same machine. Each uses a
separate config file. None of them use /etc/mysql/my.cnf which doesn't
exist on this system.

On upgrade, the mysql-common preinst gets the datadir from
/etc/mysql/my.cnf (mysqld --print-defaults | ...) then runs find on the
result. Since there is no my.cnf the resultant shell variable is empty
and find uses $PWD (which seems to be /). As this was taking rather a
long time I just killed find.

I've worked around this by creating a dummy my.cnf containing a fake
datadir entry.

I've also prepared a fix to the preinst which checks that the datadir
exists before running find:

--- mysql-common.preinst        2007-11-27 10:00:14.000000000 -0500
+++ mysql-common.preinst.fixed  2007-11-27 10:17:25.000000000 -0500
@@ -150,7 +150,7 @@
 if [ "$1" = "upgrade" ] && [ -x /usr/sbin/mysqld ]; then
        cvt_datadir=`cvt_get_param datadir`
        # test for ISAM tables, which we must convert NOW
-       if [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
+       if [ -n "$cvt_datadir" ] && [ -d "$cvt_datadir" ] && [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
                pidfile=`cvt_get_param pid-file`
                if [ "$pidfile" ] && [ -f "$pidfile" ]; then
                        server_pid=`cat $pidfile`

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)

-- no debconf information

More information about the pkg-mysql-maint mailing list