MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Magne Mahre Date:November 26 2008 12:58pm
Subject:bzr commit into mysql-6.0-runtime branch (magne.mahre:2754) Bug#36897
View as plain text  
#At file:///export/home/tmp/z/mysql-6.0-runtime-fix36897/ based on revid:staale.smedseng@stripped

 2754 Magne Mahre	2008-11-26
      Bug #36897        Falcon: "use tablespace" is possible
      
      The problem is that the code only checks for the
      existence of the target filename when entering a
      database. Added a check to verify that the target is
      indeed a directory, and not a tablespace file.
      
      Since the my_access() call only checks for file
      existence, it is removed, since this is already
      ensured with the my_stat() call.
modified:
  mysql-test/suite/falcon/r/falcon_bugs.result
  mysql-test/suite/falcon/t/falcon_bugs.test
  sql/sql_db.cc

=== modified file 'mysql-test/suite/falcon/r/falcon_bugs.result'

=== modified file 'mysql-test/suite/falcon/r/falcon_bugs.result'
--- a/mysql-test/suite/falcon/r/falcon_bugs.result	2008-11-18 15:42:54 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bugs.result	2008-11-26 12:58:17 +0000
@@ -3280,3 +3280,13 @@
 set auto_increment_offset=default;
 set auto_increment_increment=default;
 DROP TABLE t1, t2;
+#
+# Bug #36897 Falcon: "use tablespace" is possible
+# Test that "use <ts>" will fail if <ts> is a
+# tablespace and not a database
+#
+set @@storage_engine = falcon;
+create tablespace ts add datafile 'ts' engine=falcon;
+use ts;
+ERROR 42000: Unknown database 'ts'
+drop tablespace ts engine=falcon;

=== modified file 'mysql-test/suite/falcon/t/falcon_bugs.test'
--- a/mysql-test/suite/falcon/t/falcon_bugs.test	2008-10-02 21:05:39 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bugs.test	2008-11-26 12:58:17 +0000
@@ -1795,3 +1795,18 @@
 
 # Final cleanup.
 DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #36897 Falcon: "use tablespace" is possible
+--echo # Test that "use <ts>" will fail if <ts> is a
+--echo # tablespace and not a database
+--echo #
+
+set @@storage_engine = falcon;
+
+create tablespace ts add datafile 'ts' engine=falcon;
+--error ER_BAD_DB_ERROR
+use ts;
+
+# Final cleanup
+drop tablespace ts engine=falcon;

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2008-09-30 13:31:41 +0000
+++ b/sql/sql_db.cc	2008-11-26 12:58:17 +0000
@@ -2001,6 +2001,7 @@
 {
   char db_dir_path[FN_REFLEN];
   uint db_dir_path_len;
+  MY_STAT my_stat_result;
 
   db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path),
                                         db_name, "", "", 0);
@@ -2008,7 +2009,13 @@
   if (db_dir_path_len && db_dir_path[db_dir_path_len - 1] == FN_LIBCHAR)
     db_dir_path[db_dir_path_len - 1]= 0;
 
-  /* Check access. */
-
-  return my_access(db_dir_path, F_OK);
+  /* Verify that db_name is accessible and is a directory */
+
+  if (! my_stat(db_dir_path, &my_stat_result, MYF(0)))
+    return TRUE;
+
+  if (! MY_S_ISDIR(my_stat_result.st_mode))
+    return TRUE;
+
+  return FALSE;
 }

Thread
bzr commit into mysql-6.0-runtime branch (magne.mahre:2754) Bug#36897Magne Mahre26 Nov