From 2b7dda9e9d06f2ab6036da39250a765926c9c437 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Mar 2008 09:33:32 -0500 Subject: Bug#33464: DROP FUNCTION caused a crash The cause of the crash is an assertion failure that we do not emit an error message (grant not found) and then return "ok". The assertion is valid, and we were ignoring the buggy behavior prior to the "Diagnostics" result-verification. Use an error handler to mutate innocuous missing-grant errors, when removing routines, into warnings. mysql-test/r/drop.result: Show that the crash disappears. Also prepare for the larger bug to be fixed with only minor changes to this test. mysql-test/t/drop.test: Show that the crash disappears. Also prepare for the larger bug to be fixed with only minor changes to this test. sql/sql_acl.cc: Disable a segment of code that makes a faulty assumption about the existence of a routine's defining user, until that assumption becomes true. Push a new handler onto the error-handler stack, so that when removing a routine, a missing ACL grant is now a warning instead of an error. If any unexpected error is raised then tell the caller. --- mysql-test/t/drop.test | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'mysql-test/t/drop.test') diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index a79044436eb..3dd180f2d78 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -134,4 +134,66 @@ drop table mysql_test.`#sql-347f_8`; copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; drop database mysql_test; + +# +# Bug#33464: DROP FUNCTION caused a crash. +# +CREATE DATABASE dbbug33464; +CREATE USER 'userbug33464'@'localhost'; + +GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost'; + +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK +connect (connbug33464, localhost, userbug33464, , dbbug33464); +--source suite/funcs_1/include/show_connection.inc + +--disable_warnings +DROP PROCEDURE IF EXISTS sp3; +DROP FUNCTION IF EXISTS fn1; +--enable_warnings + +delimiter //; +CREATE PROCEDURE sp3(v1 char(20)) +BEGIN + SELECT * from dbbug33464.t6 where t6.f2= 'xyz'; +END// +delimiter ;// + +delimiter //; +CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER +BEGIN + return 1; +END// +delimiter ;// + +delimiter //; +CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER +BEGIN + return 2; +END// +delimiter ;// + +disconnect connbug33464; + +# cleanup +connection default; +USE dbbug33464; +--source suite/funcs_1/include/show_connection.inc + +SELECT fn1(); +SELECT fn2(); + +--error 0, ER_CANNOT_USER +DROP USER 'userbug33464'@'localhost'; + +DROP FUNCTION fn1; +DROP FUNCTION fn2; +DROP PROCEDURE sp3; + +--error 0, ER_CANNOT_USER +DROP USER 'userbug33464'@'localhost'; + +use test; +DROP DATABASE dbbug33464; + --echo End of 5.1 tests -- cgit v1.2.1 From 2eb67908704727d276cae0d63e5d116511a5fc7d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Mar 2008 14:18:35 -0500 Subject: Move test that has more to do with grants than DROP. We shouldn't have grant warnings on embedded server. mysql-test/r/drop.result: Move test that has more to do with grants than DROP. mysql-test/r/grant.result: Move test that has more to do with grants than DROP. mysql-test/t/drop.test: Move test that has more to do with grants than DROP. mysql-test/t/grant.test: Move test that has more to do with grants than DROP. --- mysql-test/t/drop.test | 62 -------------------------------------------------- 1 file changed, 62 deletions(-) (limited to 'mysql-test/t/drop.test') diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index 3dd180f2d78..a79044436eb 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -134,66 +134,4 @@ drop table mysql_test.`#sql-347f_8`; copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; drop database mysql_test; - -# -# Bug#33464: DROP FUNCTION caused a crash. -# -CREATE DATABASE dbbug33464; -CREATE USER 'userbug33464'@'localhost'; - -GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost'; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (connbug33464, localhost, userbug33464, , dbbug33464); ---source suite/funcs_1/include/show_connection.inc - ---disable_warnings -DROP PROCEDURE IF EXISTS sp3; -DROP FUNCTION IF EXISTS fn1; ---enable_warnings - -delimiter //; -CREATE PROCEDURE sp3(v1 char(20)) -BEGIN - SELECT * from dbbug33464.t6 where t6.f2= 'xyz'; -END// -delimiter ;// - -delimiter //; -CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER -BEGIN - return 1; -END// -delimiter ;// - -delimiter //; -CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER -BEGIN - return 2; -END// -delimiter ;// - -disconnect connbug33464; - -# cleanup -connection default; -USE dbbug33464; ---source suite/funcs_1/include/show_connection.inc - -SELECT fn1(); -SELECT fn2(); - ---error 0, ER_CANNOT_USER -DROP USER 'userbug33464'@'localhost'; - -DROP FUNCTION fn1; -DROP FUNCTION fn2; -DROP PROCEDURE sp3; - ---error 0, ER_CANNOT_USER -DROP USER 'userbug33464'@'localhost'; - -use test; -DROP DATABASE dbbug33464; - --echo End of 5.1 tests -- cgit v1.2.1 From b5978a9424c6213a8282713feb3734c2f92968c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Mar 2008 12:40:12 -0400 Subject: Bug#26703: DROP DATABASE fails if database contains a #mysql50# \ table with backticks (Thanks to Lu Jingdong, though I did not take his patch directly, as it contained a significant flaw.) It wasn't a backtick/parsing problem. We merely didn't anticipate and allocate enough space to handle the optional "#mysql50#" table- name prefix. Now, allocate that extra space in case we need it when we look up a legacy table to get its file's name. mysql-test/r/drop.result: Verify that databases with old-style files can be removed. mysql-test/t/drop.test: Verify that databases with old-style files can be removed. sql/sql_db.cc: Extend the size of the memory that holds the table's name, so that the legacy "mysql50" prefix fits. --- mysql-test/t/drop.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'mysql-test/t/drop.test') diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index a79044436eb..ad26287a666 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -134,4 +134,19 @@ drop table mysql_test.`#sql-347f_8`; copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; drop database mysql_test; +# +# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks +# +create database mysqltestbug26703; +use mysqltestbug26703; +create table `#mysql50#abc``def` ( id int ); +--error ER_WRONG_TABLE_NAME +create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +--error ER_WRONG_TABLE_NAME +create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +use test; +drop database mysqltestbug26703; + --echo End of 5.1 tests -- cgit v1.2.1 From 1975532945bd1e719cf88e646907e22002635e51 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 20 Mar 2008 11:36:35 +0300 Subject: A test case for Bug#29958: Weird message on DROP DATABASE if mysql.proc does not exist. mysql-test/r/drop.result: Update result file. mysql-test/t/drop.test: Add a test case for Bug#29958: Weird message on DROP DATABASE if mysql.proc does not exist. --- mysql-test/t/drop.test | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'mysql-test/t/drop.test') diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index a79044436eb..1668d2f3d09 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -134,4 +134,38 @@ drop table mysql_test.`#sql-347f_8`; copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; drop database mysql_test; +########################################################################### + +--echo +--echo # -- +--echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not +--echo # -- exist. +--echo # -- + +--disable_warnings +DROP DATABASE IF EXISTS mysql_test; +--enable_warnings + +CREATE DATABASE mysql_test; + +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.frm +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYD +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYI + +DROP TABLE mysql.proc; + +DROP DATABASE mysql_test; + +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI + +--echo +--echo # -- +--echo # -- End of Bug#29958. +--echo # -- + +########################################################################### + +--echo --echo End of 5.1 tests -- cgit v1.2.1 From 8eb0166801e33d9db1b17c25d4fabbde68ed4852 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Mar 2008 10:52:00 +0300 Subject: Fix tree. --- mysql-test/t/drop.test | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mysql-test/t/drop.test') diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index 1668d2f3d09..7c60c7daf69 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -148,17 +148,17 @@ DROP DATABASE IF EXISTS mysql_test; CREATE DATABASE mysql_test; ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.frm ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYD ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYI +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD +--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI DROP TABLE mysql.proc; DROP DATABASE mysql_test; ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD ---copy_file $MYSQLTEST_VARDIR/master-data/mysql/backup.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI --echo --echo # -- -- cgit v1.2.1