[debian-mysql] BUG: converting ISAM tables does search on whole disk

Lubomir Host rajo at platon.sk
Sun Dec 9 22:28:52 UTC 2007


Hi,

I have found bug in Debian upgrade script
/var/lib/dpkg/info/mysql-common.preinst and
/var/lib/dpkg/info/mysql-server.preinst (5.0.45-1+lenny1).

For some reason parameter "datadir" on line 151 is empty and so executed
command on line 153 :

if [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
...
fi

is "find -name '*.ISM'", which means "browse whole disk". This can take a vere
very long time, especialy if it is big storage with ten-milions files.

Patch (not tested!!):

--- /var/lib/dpkg/info/mysql-common.preinst     2007-12-02 18:26:29.000000000 +0100
+++ /var/lib/dpkg/info/mysql-common.preinst.new 2007-12-09 23:25:47.244286645 +0100
@@ -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 [ ! -z $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`
--- /var/lib/dpkg/info/mysql-server.preinst     2007-12-02 18:26:29.000000000 +0100
+++ /var/lib/dpkg/info/mysql-server.preinst.new 2007-12-09 23:27:12.751100207 +0100
@@ -147,7 +147,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 [ ! -z $cvt_datadir ] && [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
                set +e
                cat << EOF >&2
 ----------------------------------------




-- 
  ,''`.  Lubomir Host 'rajo' <rajo AT platon.sk>    ICQ #:  257322664
 : :' :  Jabber: rajo AT jabber.platon.sk      VoIP: callto://rajo207
 `. `'   WWW: http://rajo.platon.sk/  Platon Group: http://platon.sk/
   `-    GnuPG key: DC0C C7EA 55C8 B089 C41D 944A F251 A93A 2361 A82F



More information about the pkg-mysql-maint mailing list