Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-23569 temporary tables can overwrite existing files
for internal temporary tables: don't use realpath(), and let them overwrite whatever orphan temp files might've left in the tmpdir (see main.error_simulation test). for user created temporary tables: we have to use realpath(), (see 3a726ab, remember DATA/INDEX DIRECTORY). don't allow them to overwrite existing files. This bug was reported by RACK911 LABS
- Loading branch information
Showing
4 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| create table d1 (a int); | ||
| create temporary table t1 (a int); | ||
| create temporary table t2 (a int); | ||
| Got one of the listed errors | ||
| create temporary table t3 (a int) engine=Aria; | ||
| Got one of the listed errors | ||
| select * from information_schema.columns where table_schema='test'; | ||
| Got one of the listed errors | ||
| flush tables; | ||
| select * from d1; | ||
| a | ||
| drop temporary table t1; | ||
| drop table d1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| source include/not_windows.inc; | ||
|
|
||
| # | ||
| # MDEV-23569 temporary tables can overwrite existing files | ||
| # | ||
|
|
||
| let datadir=`select @@datadir`; | ||
| create table d1 (a int); | ||
| create temporary table t1 (a int); | ||
| perl; | ||
| chdir "$ENV{MYSQL_TMP_DIR}/mysqld.1/"; | ||
| for (<#sql*.MYI>) { | ||
| /^#sql(.*)_([0-9a-f]+_)([0-9a-f]+)\.MYI$/ or die; | ||
| symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MYI", hex($3)+1; | ||
| symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+1; | ||
| symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+2; | ||
| symlink "$ENV{datadir}/test/d1.MYI", "#sql_$1_0.MAI"; | ||
| } | ||
| EOF | ||
|
|
||
| error 1,1030; | ||
| create temporary table t2 (a int); | ||
| error 1,1030; | ||
| create temporary table t3 (a int) engine=Aria; | ||
| error 1,1030; | ||
| select * from information_schema.columns where table_schema='test'; | ||
|
|
||
| flush tables; | ||
| select * from d1; | ||
| drop temporary table t1; | ||
| remove_files_wildcard $MYSQL_TMP_DIR/mysqld.1 *sql*; | ||
| drop table d1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters