Skip to content

Commit 79a3f96

Browse files
committed
rewrite bug#26704 test case
drop-no_root needs DROP DATABASE to fail. But `chmod 000` is not reliable after drop table force anymore. Make DROP DATABASE to fail by creating an extra file in the db dir
1 parent 529b6df commit 79a3f96

File tree

4 files changed

+34
-113
lines changed

4 files changed

+34
-113
lines changed

mysql-test/main/drop-no_root.result

Lines changed: 0 additions & 28 deletions
This file was deleted.

mysql-test/main/drop-no_root.test

Lines changed: 0 additions & 85 deletions
This file was deleted.

mysql-test/main/drop.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ create table mysql_test.`#sql-347f_7` (f1 int);
131131
create table mysql_test.`#sql-347f_8` (f1 int);
132132
drop table mysql_test.`#sql-347f_8`;
133133
drop database mysql_test;
134+
create database mysql_test;
135+
use mysql_test;
136+
create table t1(c int);
137+
drop database mysql_test;
138+
ERROR HY000: Error dropping database (can't rmdir './mysql_test', errno: 39 "Directory not empty")
139+
select database();
140+
database()
141+
mysql_test
142+
drop database mysql_test;
143+
select database();
144+
database()
145+
NULL
146+
use test;
134147

135148
# --
136149
# -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not

mysql-test/main/drop.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,27 @@ let $MYSQLD_DATADIR= `select @@datadir`;
175175
copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm;
176176
drop database mysql_test;
177177

178+
#
179+
# Bug#26704: Failing DROP DATABASE brings mysql-client out of sync.
180+
#
181+
182+
create database mysql_test;
183+
use mysql_test;
184+
create table t1(c int);
185+
186+
write_file $MYSQLD_DATADIR/mysql_test/do_not_delete;
187+
do_not_delete
188+
EOF
189+
190+
replace_result $MYSQLD_DATADIR ./ \\ / 41 39;
191+
error ER_DB_DROP_RMDIR;
192+
drop database mysql_test;
193+
select database();
194+
remove_file $MYSQLD_DATADIR/mysql_test/do_not_delete;
195+
drop database mysql_test;
196+
select database();
197+
use test;
198+
178199
###########################################################################
179200

180201
--echo

0 commit comments

Comments
 (0)