mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
BUG#40980 - Drop table can remove another MyISAM table's
data and index files It was possible if DATA/INDEX DIRECTORY is pointing to symlinked MySQL data home directory. Do not allow to drop data/index files implicitly symlinked to data home directory. For such tables remove symlink only. mysql-test/r/symlink.result: A test case for BUG#40980. mysql-test/t/symlink.test: A test case for BUG#40980. storage/myisam/mi_delete_table.c: Do not allow to drop data/index files implicitly symlinked to data home directory. For such tables remove symlink only.
This commit is contained in:
@@ -168,4 +168,16 @@ Warning 1618 <DATA DIRECTORY> option ignored
|
||||
Warning 1618 <INDEX DIRECTORY> option ignored
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
#
|
||||
# BUG#40980 - Drop table can remove another MyISAM table's
|
||||
# data and index files
|
||||
#
|
||||
CREATE TABLE user(a INT) DATA DIRECTORY='MYSQL_TMP_DIR/mysql'
|
||||
INDEX DIRECTORY='MYSQL_TMP_DIR/mysql';
|
||||
FLUSH TABLE user;
|
||||
# Symlinking mysql database to tmpdir
|
||||
FLUSH TABLE mysql.user;
|
||||
DROP TABLE user;
|
||||
FLUSH TABLE mysql.user;
|
||||
SELECT * FROM mysql.user;
|
||||
End of 5.1 tests
|
||||
|
||||
@@ -249,4 +249,26 @@ eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTO
|
||||
DROP TABLE t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#40980 - Drop table can remove another MyISAM table's
|
||||
--echo # data and index files
|
||||
--echo #
|
||||
--mkdir $MYSQL_TMP_DIR/mysql
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
eval CREATE TABLE user(a INT) DATA DIRECTORY='$MYSQL_TMP_DIR/mysql'
|
||||
INDEX DIRECTORY='$MYSQL_TMP_DIR/mysql';
|
||||
FLUSH TABLE user;
|
||||
--echo # Symlinking mysql database to tmpdir
|
||||
--remove_file $MYSQL_TMP_DIR/mysql/user.MYD
|
||||
--remove_file $MYSQL_TMP_DIR/mysql/user.MYI
|
||||
--rmdir $MYSQL_TMP_DIR/mysql
|
||||
--exec ln -s $MYSQLD_DATADIR/mysql $MYSQL_TMP_DIR/mysql
|
||||
FLUSH TABLE mysql.user;
|
||||
DROP TABLE user;
|
||||
FLUSH TABLE mysql.user;
|
||||
--disable_result_log
|
||||
SELECT * FROM mysql.user;
|
||||
--enable_result_log
|
||||
--remove_file $MYSQL_TMP_DIR/mysql
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
Reference in New Issue
Block a user