List:Commits« Previous MessageNext Message »
From:bar Date:June 14 2007 6:50am
Subject:bk commit into 5.1 tree (bar:1.2544) BUG#26402
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-14 11:50:09+05:00, bar@stripped +5 -0
  Bug#26402 Server crashes with old-style named table
  Problem: crash on attempt to open a table
  having "#mysql50#" prefix in db or table name.
  Fix: This prefix is reserved for "mysql_upgrade"
  to access 5.0 tables  whose file names are not encoded
  according to "5.1 tablename to filename encoded".
  Don't try open tables whose db name or table name
  has this prefix.

  mysql-test/r/show_check.result@stripped, 2007-06-14 11:50:07+05:00, bar@stripped +2 -0
    Adding test case

  mysql-test/t/show_check.test@stripped, 2007-06-14 11:50:07+05:00, bar@stripped +6 -0
    Adding test case

  sql/mysql_priv.h@stripped, 2007-06-14 11:50:07+05:00, bar@stripped +4 -0
    Moving 5.0 prefix declarations into mysql_priv.h

  sql/sql_table.cc@stripped, 2007-06-14 11:50:07+05:00, bar@stripped +0 -4
    Moving 5.0 prefix declarations into mysql_priv.h

  sql/table.cc@stripped, 2007-06-14 11:50:07+05:00, bar@stripped +16 -1
    Don't try to do "normal" open of tables having '#mysql50#' prefix in
    db or table name. This prefix is reserved to access to unencoded
    table names when upgrading from 5.0 to 5.1.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.myoffice.izhnet.ru
# Root:	/home/bar/mysql-work/mysql-5.1.b26402

--- 1.511/sql/mysql_priv.h	2007-06-01 12:43:52 +05:00
+++ 1.512/sql/mysql_priv.h	2007-06-14 11:50:07 +05:00
@@ -1925,6 +1925,10 @@ uint filename_to_tablename(const char *f
 uint tablename_to_filename(const char *from, char *to, uint to_length);
 uint build_table_filename(char *buff, size_t bufflen, const char *db,
                           const char *table, const char *ext, uint flags);
+
+#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
+#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  9
+
 /* Flags for conversion functions. */
 #define FN_FROM_IS_TMP  (1 << 0)
 #define FN_TO_IS_TMP    (1 << 1)

--- 1.427/sql/sql_table.cc	2007-06-04 15:14:21 +05:00
+++ 1.428/sql/sql_table.cc	2007-06-14 11:50:07 +05:00
@@ -54,10 +54,6 @@ mysql_prepare_alter_table(THD *thd, TABL
                           HA_CREATE_INFO *create_info,
                           Alter_info *alter_info);
 
-#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
-#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  9
-
-
 /*
   Translate a file name to a table name (WL #1324).
 

--- 1.291/sql/table.cc	2007-06-01 09:20:09 +05:00
+++ 1.292/sql/table.cc	2007-06-14 11:50:07 +05:00
@@ -343,7 +343,22 @@ int open_table_def(THD *thd, TABLE_SHARE
   strxmov(path, share->normalized_path.str, reg_ext, NullS);
   if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
   {
-    if (strchr(share->table_name.str, '@'))
+    /*
+      We don't try to open 5.0 unecoded name, if
+      - non-encoded name contains '@' signs, 
+        because '@' can be misinterpreted.
+        It is not clear if '@' is escape character in 5.1,
+        or a normal character in 5.0.
+        
+      - non-encoded db or table name contain "#mysql50#" prefix.
+        This kind of tables must have been opened only by the
+        my_open() above.
+    */
+    if (strchr(share->table_name.str, '@') ||
+        strncmp(share->db.str, MYSQL50_TABLE_NAME_PREFIX,
+                MYSQL50_TABLE_NAME_PREFIX_LENGTH) ||
+        strncmp(share->table_name.str, MYSQL50_TABLE_NAME_PREFIX,
+                MYSQL50_TABLE_NAME_PREFIX_LENGTH))
       goto err_not_open;
 
     /* Try unecoded 5.0 name */

--- 1.111/mysql-test/r/show_check.result	2007-03-06 17:44:10 +04:00
+++ 1.112/mysql-test/r/show_check.result	2007-06-14 11:50:07 +05:00
@@ -752,4 +752,6 @@ Tables_in_test	Table_type
 été	BASE TABLE
 drop table `été`;
 set names latin1;
+show columns from `#mysql50#????????`;
+ERROR 42S02: Table 'test.#mysql50#????????' doesn't exist
 End of 5.1 tests

--- 1.76/mysql-test/t/show_check.test	2007-04-16 19:08:27 +05:00
+++ 1.77/mysql-test/t/show_check.test	2007-06-14 11:50:07 +05:00
@@ -593,4 +593,10 @@ show full tables;
 drop table `été`;
 set names latin1;
 
+#
+# Bug#26402 Server crashes with old-style named table
+#
+--error 1146
+show columns from `#mysql50#????????`;
+
 --echo End of 5.1 tests
Thread
bk commit into 5.1 tree (bar:1.2544) BUG#26402bar14 Jun