Commit 153f5678 authored by Alexander Nozdrin's avatar Alexander Nozdrin

Merge from mysql-next-bugfixing.

parents 10b08544 4337c380
......@@ -2964,6 +2964,7 @@ void do_move_file(struct st_command *command)
void do_chmod_file(struct st_command *command)
{
long mode= 0;
int err_code;
static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = {
......@@ -2983,7 +2984,10 @@ void do_chmod_file(struct st_command *command)
die("You must write a 4 digit octal number for mode");
DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str));
handle_command_error(command, chmod(ds_file.str, mode));
err_code= chmod(ds_file.str, mode);
if (err_code < 0)
err_code= 1;
handle_command_error(command, err_code);
dynstr_free(&ds_mode);
dynstr_free(&ds_file);
DBUG_VOID_RETURN;
......
......@@ -12,13 +12,14 @@ use mysql_test;
chmod 000 mysql_test/t1.frm
DROP DATABASE mysql_test;
ERROR HY000: Error dropping database (can't rmdir './mysql_test', errno: 39)
SELECT DATABASE();
DATABASE()
mysql_test
rm mysql_test/t1.MYD mysql_test/t1.MYI
rm -f mysql_test/t1.MYD mysql_test/t1.MYI
chmod 666 mysql_test/t1.frm
rm -f mysql_test/t1.frm
DROP DATABASE mysql_test;
......
......@@ -444,13 +444,13 @@ events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NU
events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE EVENT e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 +05:00 CREATE EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
e1 +05:00 CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE EVENT e2;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e2 -05:00 CREATE EVENT `e2` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
e2 -05:00 CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE EVENT e3;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e3 +00:00 CREATE EVENT `e3` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
e3 +00:00 CREATE DEFINER=`root`@`localhost` EVENT `e3` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
The following should fail, and nothing should be altered.
ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
ENDS '1999-01-02 00:00:00';
......
......@@ -25,17 +25,53 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--echo chmod 000 mysql_test/t1.frm
--chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm
# NOTE: For the DROP DATABASE below we need:
# - disable result log because ER_DB_DROP_RMDIR contains errno, which can be
# different on different platforms.
# - expect different error codes, because Windows and UNIX behaves
# differently (see below).
#
# NOTE: Windows and UNIX behaves differently in this test case:
#
# - on UNIX when t1.frm is chmoded to 000, it is perfectly deleted
# by the first DROP DATABASE, but some other files (t1.MYI and t1.MYD) left
# in the directory. So, we have to explicitly removes them before the
# second DROP DATABASE.
#
# - on Windows when t1.frm is chmoded to 000, it is not deleted by the first
# DROP DATABASE, but all other files in the database directory are deleted.
# Thus, we have to change the t1.frm permissions again and delete it
# explicitly before the second DROP DATABASE.
#
# All those differences do not really matter for the idea of this test case:
# checking that if DROP DATABASE failed, the client is Ok.
--echo
--error ER_DB_DROP_RMDIR
--disable_result_log
--error ER_DB_DROP_RMDIR,6
DROP DATABASE mysql_test;
--enable_result_log
--echo
SELECT DATABASE();
# Remove t1.MYI and t1.MYD. On UNIX it should succeed. On Windows, it fails.
--echo
--echo rm mysql_test/t1.MYD mysql_test/t1.MYI
--exec rm $MYSQLD_DATADIR/mysql_test/t1.MYD
--exec rm $MYSQLD_DATADIR/mysql_test/t1.MYI
--echo rm -f mysql_test/t1.MYD mysql_test/t1.MYI
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYD
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYI
# Make t1.frm removable: fail on UNIX, succeed on Windows.
--echo chmod 666 mysql_test/t1.frm
--error 0, 1
--chmod 0666 $MYSQLD_DATADIR/mysql_test/t1.frm
# Remove t1.frm: fail on UNIX, succeed on Windows.
--echo rm -f mysql_test/t1.frm
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.frm
--echo
DROP DATABASE mysql_test;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment