[debian-mysql] Bug#570656: mysqldump doesn't honor \0 send by server

Jörg Sommer joerg at alea.gnuu.de
Sat Feb 20 13:58:19 UTC 2010


Package: mysql-client-5.0
Version: 5.0.51a-24+lenny3
Severity: normal

Hi,

I've a table with the name Spaß (encoded in latin1). A dump of this
table stopps in the middle of the create table statement:

CREATE TABLE `test_v1` (
  `testid` int(11) NOT NULL auto_increment,
  `spieleid` text NOT NULL,
  `grafik` text NOT NULL,
  `sound` text NOT NULL,
  `tiefe` text NOT NULL,
  `steuer` text NOT NULL,
  `atmos` text NOT NULL,
  `gesamt` text NOT NULL,
  `lan` text NOT NULL,
  `spa<DF>;
SET character_set_client = @saved_cs_client;

Looking with strace what's going on, I saw this:

write(3, "\34\0\0\0\3show create table `test_v1`"..., 32) = 32
read(3, "\1\0\0\1\2\33\0\0\2\3def\0\0\0\5Table\0\f?\0\25\0\0\0\375\1\0\37\0\0\"\0\0\3\3def\0\0\0\fCreate Table\0\f?\0U\1\0\0\375\1\0\37\0\0\5\0\0\4\376\0\0\2\0B\2\0\5\7test_v1\3747\2CREATE TABLE `test_v1` (\n  `testid` int(11) NOT NULL auto_increment,\n  `spieleid` text NOT NULL,\n  `grafik` text NOT NULL,\n  `sound` text NOT NULL,\n  `tiefe` text NOT NULL,\n  `steuer` text NOT NULL,\n  `atmos` text NOT NULL,\n  `gesamt` text NOT NULL,\n  `lan` text NOT NULL,\n  `spa\337\0` text NOT NULL,\n  `pcgames` text NOT NULL,\n  `gamestar` text NOT NULL,\n  `gamigo` text NOT NULL,\n  `text` text NOT NULL,\n  `datum` int(11) NOT NULL default '0',\n  `reporter` int(3) NOT NULL default '1',\n  PRIMARY KEY  (`testid`)\n) ENGINE=MyISAM AUTO_INCREMENT=55 DEFAULT CHARSET=latin1\5\0\0\6\376\0\0\2\0"..., 16384) = 674

In the answer of the server, you can see `spa\337\0`. The answer of the
server should go out to the dump via fprintf() in line 1785 in
mysqldump.c:

           if (path)
             my_fclose(sql_file, MYF(MY_WME));

           seen_views= 1;
           DBUG_RETURN(0);
         }

         row= mysql_fetch_row(result);
(*)      fprintf(sql_file, "%s;\n", row[1]);
         check_io(sql_file);
         mysql_free_result(result);
       }
       my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
                   result_table);
       if (mysql_query_with_error_report(mysql, &result, query_buff))

But fprintf() stopps at the \0. Hence, the cutted create table statement.

Maybe, also the server is to be blamed to not send \0, but at least the
client has to respect this (and work around this bug).

Bye, Jörg.

-- System Information:
Debian Release: unstable/experimental
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.33-rc7
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature http://en.wikipedia.org/wiki/OpenPGP
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20100220/e388f4c2/attachment.pgp>


More information about the pkg-mysql-maint mailing list