From f3e2b3df18918550ee49021d0e16ea8cb5272085 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 5 Oct 2010 14:57:51 +0200 Subject: [PATCH 01/32] Bug#55091: Server crashes on ADD PARTITION after a failed attempt In case of failure in ALTER ... PARTITION under LOCK TABLE the server could crash, due to it had modified the locked table object, which was not reverted in case of failure, resulting in a bad table definition used after the failed command. Solved by always closing the LOCKED TABLE, even in case of error. Note: this is a 5.1-only fix, bug#56172 fixed it in 5.5+ --- mysql-test/r/partition_innodb_plugin.result | 73 +++++++++++++++++++++ mysql-test/t/disabled.def | 1 - mysql-test/t/partition_innodb_plugin.test | 66 +++++++++++++++++++ sql/sql_partition.cc | 21 +++++- 4 files changed, 159 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result index dd91eee316a..f6b5ce84338 100644 --- a/mysql-test/r/partition_innodb_plugin.result +++ b/mysql-test/r/partition_innodb_plugin.result @@ -1,3 +1,76 @@ +call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal"); +# +# Bug#55091: Server crashes on ADD PARTITION after a failed attempt +# +SET @old_innodb_file_format_check = @@global.innodb_file_format_check; +SET @old_innodb_file_format = @@global.innodb_file_format; +SET @old_innodb_file_per_table = @@global.innodb_file_per_table; +SET @old_innodb_strict_mode = @@global.innodb_strict_mode; +SET @@global.innodb_file_format = Barracuda, +@@global.innodb_file_per_table = ON, +@@global.innodb_strict_mode = ON; +# Connection con1 +CREATE TABLE t1 (id INT NOT NULL +PRIMARY KEY, +user_num CHAR(10) +) ENGINE = InnoDB +KEY_BLOCK_SIZE=4 +PARTITION BY HASH(id) PARTITIONS 1; +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `user_num` char(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 1 */ +SET GLOBAL innodb_file_per_table = OFF; +# Connection con2 +LOCK TABLE t1 WRITE; +# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE +# are incompatible with innodb_file_per_table = OFF; +ALTER TABLE t1 ADD PARTITION PARTITIONS 1; +ERROR HY000: Got error 1478 from storage engine +t1#P#p0.ibd +t1.frm +t1.par +# This SET is not needed to reproduce the bug, +# it is here just to make the test case more realistic +SET innodb_strict_mode = OFF; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +t1.frm +t1.par +ALTER TABLE t1 REBUILD PARTITION p0; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +UNLOCK TABLES; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `user_num` char(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +/*!50100 PARTITION BY HASH (id) +PARTITIONS 3 */ +DROP TABLE t1; +# Connection default +SET @@global.innodb_strict_mode = @old_innodb_strict_mode; +SET @@global.innodb_file_format = @old_innodb_file_format; +SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +SET @@global.innodb_file_format_check = @old_innodb_file_format_check; SET NAMES utf8; CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a)) ENGINE=InnoDB diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index cede26f555a..bb931fb7b14 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,6 +11,5 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index eeb990c0d81..114adf67180 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -1,5 +1,71 @@ --source include/have_partition.inc --source include/have_innodb_plugin.inc +# Remove the line below when bug#53307 is solved. +--source include/not_valgrind.inc + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal"); +--echo # +--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt +--echo # +SET @old_innodb_file_format_check = @@global.innodb_file_format_check; +SET @old_innodb_file_format = @@global.innodb_file_format; +SET @old_innodb_file_per_table = @@global.innodb_file_per_table; +SET @old_innodb_strict_mode = @@global.innodb_strict_mode; +SET @@global.innodb_file_format = Barracuda, +@@global.innodb_file_per_table = ON, +@@global.innodb_strict_mode = ON; + +--echo # Connection con1 +--connect(con1,localhost,root,,) + +CREATE TABLE t1 (id INT NOT NULL +PRIMARY KEY, +user_num CHAR(10) +) ENGINE = InnoDB +KEY_BLOCK_SIZE=4 +PARTITION BY HASH(id) PARTITIONS 1; + +--list_files $MYSQLD_DATADIR/test +SHOW CREATE TABLE t1; + +SET GLOBAL innodb_file_per_table = OFF; + +--disconnect con1 +--connect(con2,localhost,root,,) +--echo # Connection con2 + +LOCK TABLE t1 WRITE; + +--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE +--echo # are incompatible with innodb_file_per_table = OFF; + +--error ER_GET_ERRNO +ALTER TABLE t1 ADD PARTITION PARTITIONS 1; + +--list_files $MYSQLD_DATADIR/test +--echo # This SET is not needed to reproduce the bug, +--echo # it is here just to make the test case more realistic +SET innodb_strict_mode = OFF; + +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--list_files $MYSQLD_DATADIR/test + +# really bug#56172 +ALTER TABLE t1 REBUILD PARTITION p0; + +UNLOCK TABLES; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--disconnect con2 +--connection default +--echo # Connection default +SET @@global.innodb_strict_mode = @old_innodb_strict_mode; +SET @@global.innodb_file_format = @old_innodb_file_format; +SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +SET @@global.innodb_file_format_check = @old_innodb_file_format_check; # # Bug#32430 - show engine innodb status causes errors diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 76caa2b0c8d..7b0c47865d8 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5934,6 +5934,12 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) int err; if (lpt->thd->locked_tables) { + /* + Close the table if open, to remove/destroy the already altered + table->part_info object, so that it is not reused. + */ + if (lpt->table->db_stat) + abort_and_upgrade_lock_and_close_table(lpt); /* When we have the table locked, it is necessary to reopen the table since all table objects were closed and removed as part of the @@ -6436,7 +6442,20 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, table, table_list, FALSE, NULL, written_bin_log)); err: - close_thread_tables(thd); + if (thd->locked_tables) + { + /* + table->part_info was altered in prep_alter_part_table and must be + destroyed and recreated, since otherwise it will be reused, since + we are under LOCK TABLE. + */ + alter_partition_lock_handling(lpt); + } + else + { + /* Force the table to be closed to avoid reuse of the table->part_info */ + close_thread_tables(thd); + } DBUG_RETURN(TRUE); } #endif From fd4cd8cee0626ab65c5512a78157e820634adb86 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Thu, 7 Oct 2010 18:45:02 +0400 Subject: [PATCH 02/32] Raise version. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a5fe8d292da..d58d978fecb 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.7-rc], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8-rc], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From cfc97fd02679dd0ddea6e2986aaf8b79a305d885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Oct 2010 11:59:43 +0300 Subject: [PATCH 03/32] Bug #56947 InnoDB leaks memory when failing to create a table row_create_table_for_mysql(): When the table creation fails, free the dict_table_t object. --- mysql-test/suite/innodb/r/innodb_bug56947.result | 8 ++++++++ mysql-test/suite/innodb/t/innodb_bug56947.test | 16 ++++++++++++++++ storage/innobase/row/row0mysql.c | 14 ++++++++------ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb_bug56947.result create mode 100644 mysql-test/suite/innodb/t/innodb_bug56947.test diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result new file mode 100644 index 00000000000..b279069d834 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug56947.result @@ -0,0 +1,8 @@ +SET @old_innodb_file_per_table=@@innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +create table bug56947(a int not null) engine = innodb; +CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB; +alter table bug56947 add unique index (a); +ERROR HY000: Table 'test.bug56947#1' already exists +drop table `bug56947#1`; +drop table bug56947; diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test new file mode 100644 index 00000000000..e11f39b97a8 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug56947.test @@ -0,0 +1,16 @@ +# +# Bug #56947 valgrind reports a memory leak in innodb-plugin.innodb-index +# +-- source include/have_innodb.inc + +SET @old_innodb_file_per_table=@@innodb_file_per_table; +# avoid a message about filed *.ibd file creation in the error log +SET GLOBAL innodb_file_per_table=0; +create table bug56947(a int not null) engine = innodb; +CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB; +--error 156 +alter table bug56947 add unique index (a); +drop table `bug56947#1`; +drop table bug56947; +--disable_query_log +SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 3e155fd14e6..20885f4098c 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1938,15 +1938,13 @@ err_exit: err = trx->error_state; - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { + switch (err) { + case DB_SUCCESS: + break; + case DB_OUT_OF_FILE_SPACE: trx->error_state = DB_SUCCESS; trx_general_rollback_for_mysql(trx, NULL); - /* TO DO: free table? The code below will dereference - table->name, though. */ - } - switch (err) { - case DB_OUT_OF_FILE_SPACE: ut_print_timestamp(stderr); fputs(" InnoDB: Warning: cannot create table ", stderr); @@ -1961,9 +1959,13 @@ err_exit: break; case DB_DUPLICATE_KEY: + default: /* We may also get err == DB_ERROR if the .ibd file for the table already exists */ + trx->error_state = DB_SUCCESS; + trx_general_rollback_for_mysql(trx, NULL); + dict_mem_table_free(table); break; } From 82ca4276a0d9d9d1a27e73f064a7540d8ddaa430 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 29 Oct 2010 15:27:40 +0300 Subject: [PATCH 04/32] fix tree name --- .bzr-mysql/default.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 36f40105d26..1b6d7676984 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] -post_commit_to = "commits@lists.mysql.com" -post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.5-bugteam" +post_commit_to = "dbg_mysql_security@sun.com" +post_push_to = "dbg_mysql_security@sun.com" +tree_name = "mysql-5.5-security" From 97e295cc2242a27550a6dafe86b184d4c559fa3b Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Fri, 29 Oct 2010 16:10:53 +0200 Subject: [PATCH 05/32] Bug #57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE This crash could happen if TRUNCATE TABLE indirectly failed to open a merge table due to failures to open underlying tables. Even if opening failed, the TRUNCATE TABLE code would try to invalidate the table in the query cache. Since this table had been closed and memory released, this could lead to a crash. This bug was introduced by a combination of the changes introduced by the patch for Bug#52044, where failing to open a table will cause opened tables to be closed. And the changes in patch for Bug#49938, where TRUNCATE TABLE uses the standard open tables function. This patch fixes the problem by setting the TABLE pointer to NULL before invalidating the query cache. Test case added to truncate_coverage.test. --- mysql-test/r/truncate_coverage.result | 27 ++++++++++++++ mysql-test/t/truncate_coverage.test | 54 +++++++++++++++++++++++++++ sql/sql_truncate.cc | 7 ++++ 3 files changed, 88 insertions(+) diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result index a7a4b9c70f4..728702f7ab5 100644 --- a/mysql-test/r/truncate_coverage.result +++ b/mysql-test/r/truncate_coverage.result @@ -78,3 +78,30 @@ COMMIT; UNLOCK TABLES; DROP TABLE t1; SET DEBUG_SYNC='RESET'; +# +# Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE +# +# Note that this test case only reproduces the problem +# when it is run with valgrind. +DROP TABLE IF EXISTS t1, m1; +CREATE TABLE t1(a INT) engine=memory; +CREATE TABLE m1(a INT) engine=merge UNION(t1); +# Connection con1 +SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped'; +# Sending: +TRUNCATE TABLE m1; +# Connection con2 +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +# Sending: +FLUSH TABLES; +# Connection default +# Waiting for FLUSH TABLES to be blocked. +SET DEBUG_SYNC= 'now SIGNAL dropped'; +# Connection con1 +# Reaping: TRUNCATE TABLE m1 +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +# Connection con2 +# Reaping: FLUSH TABLES +# Connection default +SET DEBUG_SYNC= 'RESET'; +DROP TABLE m1, t1; diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test index c9c4bd90ca4..135935b53b3 100644 --- a/mysql-test/t/truncate_coverage.test +++ b/mysql-test/t/truncate_coverage.test @@ -172,3 +172,57 @@ UNLOCK TABLES; DROP TABLE t1; SET DEBUG_SYNC='RESET'; +--echo # +--echo # Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE +--echo # + +--echo # Note that this test case only reproduces the problem +--echo # when it is run with valgrind. + +--disable_warnings +DROP TABLE IF EXISTS t1, m1; +--enable_warnings + +CREATE TABLE t1(a INT) engine=memory; +CREATE TABLE m1(a INT) engine=merge UNION(t1); +connect(con2, localhost, root); + +--echo # Connection con1 +connect(con1, localhost, root); +SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped'; +--echo # Sending: +--send TRUNCATE TABLE m1 + +--echo # Connection con2 +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +--echo # Sending: +--send FLUSH TABLES + +--echo # Connection default +connection default; +--echo # Waiting for FLUSH TABLES to be blocked. +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES'; +--source include/wait_condition.inc +SET DEBUG_SYNC= 'now SIGNAL dropped'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: TRUNCATE TABLE m1 +--error ER_WRONG_MRG_TABLE +--reap +disconnect con1; +--source include/wait_until_disconnected.inc + +--echo # Connection con2 +connection con2; +--echo # Reaping: FLUSH TABLES +--reap +disconnect con2; +--source include/wait_until_disconnected.inc + +--echo # Connection default +connection default; +SET DEBUG_SYNC= 'RESET'; +DROP TABLE m1, t1; diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 0cff2875ac8..909c6a08b67 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -472,6 +472,13 @@ bool Truncate_statement::truncate_table(THD *thd, TABLE_LIST *table_ref) binlog_stmt= !error || error != HA_ERR_WRONG_COMMAND; } + /* + If we tried to open a MERGE table and failed due to problems with the + children tables, the table will have been closed and table_ref->table + will be invalid. Reset the pointer here in any case as + query_cache_invalidate does not need a valid TABLE object. + */ + table_ref->table= NULL; query_cache_invalidate3(thd, table_ref, FALSE); } From 0e40c848d14cbe713fef684145d170ff94f7864d Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 1 Nov 2010 14:11:02 +0200 Subject: [PATCH 06/32] fixed a failure in the build scripts because of unexpected suffix --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index d8a45214a5c..9f986e068cb 100644 --- a/configure.in +++ b/configure.in @@ -27,7 +27,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.5.8-ga], [], [mysql]) +AC_INIT([MySQL Server], [5.5.8-rc], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From a10e8359fa2afd46b9500dd32ee37de7eb643e11 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 1 Nov 2010 15:10:02 +0200 Subject: [PATCH 07/32] fixed the .spec file to package the new QA plugins. --- support-files/mysql.spec.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 15fe4a38a54..5c2ea2305d3 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -977,6 +977,9 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_libdir}/mysql/plugin/auth.so %attr(755, root, root) %{_libdir}/mysql/plugin/auth_socket.so %attr(755, root, root) %{_libdir}/mysql/plugin/auth_test_plugin.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/qa_auth_server.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/adt_null.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/libdaemon_example.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/mypluglib.so @@ -985,6 +988,9 @@ echo "=====" >> $STATUS_HISTORY %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_socket.so %attr(755, root, root) %{_libdir}/mysql/plugin/debug/auth_test_plugin.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_client.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_interface.so +%attr(755, root, root) %{_libdir}/mysql/plugin/debug/qa_auth_server.so %if %{WITH_TCMALLOC} %attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target} @@ -1081,6 +1087,10 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Mon Nov 1 2010 Georgi Kodinov + +- Added test authentication (WL#1054) plugin binaries + * Wed Oct 6 2010 Georgi Kodinov - Added example external authentication (WL#1054) plugin binaries From 00a2cc813964c927918a9da01b5ec23571784cad Mon Sep 17 00:00:00 2001 From: "karen.langford@oracle.com" <> Date: Wed, 3 Nov 2010 14:02:15 +0100 Subject: [PATCH 08/32] Raise version number after cloning 5.1.53 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index b7cd3585789..7fd581af009 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MySQL Server], [5.1.53], [], [mysql]) +AC_INIT([MySQL Server], [5.1.54], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM From 0fb0d9a9a2484d1ccdf2e2340ac7a36ee3bb070c Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Wed, 3 Nov 2010 16:47:32 +0100 Subject: [PATCH 09/32] Bug #57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW This crash could happen if SHOW CREATE VIEW indirectly failed to open a view due to failures to open underlying tables (or functions). Several such errors were hidden and converted to ER_VIEW_INVALID warnings to prevent exposing details of underlying tables for which the user have no privileges. However, with the changes introduced by the patch for Bug#52044, failing to open a view will cause opened tables, views and functions to be closed. Since the errors causing these failures were converted to warnings, SHOW CREATE VIEW would try to continue. This made it possible to try to access memory that had been freed, causing a crash. This patch fixes the problem by not closing opened tables, views and functions in these cases. This allows SHOW CREATE VIEW to continue and also prevents it from accessing freed memory. Test case added to lock_sync.test. --- mysql-test/r/lock_sync.result | 35 +++++++++++++++++++++ mysql-test/t/lock_sync.test | 59 +++++++++++++++++++++++++++++++++++ sql/sql_show.cc | 13 ++++++-- 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result index 726b754eaa8..8fe94679e70 100644 --- a/mysql-test/r/lock_sync.result +++ b/mysql-test/r/lock_sync.result @@ -738,3 +738,38 @@ SET DEBUG_SYNC= 'now SIGNAL release_thrlock'; # Connection default DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; +# +# Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW +# +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP FUNCTION IF EXISTS f1; +CREATE TABLE t1(a INT); +CREATE FUNCTION f1() RETURNS INTEGER RETURN 1; +CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1; +DROP FUNCTION f1; +# Connection con1 +SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2'; +# Sending: +SHOW CREATE VIEW v1; +# Connection con2 +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +SET DEBUG_SYNC= 'now SIGNAL dropped'; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +# Sending: +FLUSH TABLES; +# Connection default +# Waiting for FLUSH TABLES to be blocked. +SET DEBUG_SYNC= 'now SIGNAL dropped'; +# Connection con1 +# Reaping: SHOW CREATE VIEW v1 +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# Connection con2 +# Reaping: FLUSH TABLES +# Connection default +SET DEBUG_SYNC= 'RESET'; +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test index 7131e2cde31..d5ad7becd7d 100644 --- a/mysql-test/t/lock_sync.test +++ b/mysql-test/t/lock_sync.test @@ -1078,6 +1078,65 @@ DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; +--echo # +--echo # Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1(a INT); +CREATE FUNCTION f1() RETURNS INTEGER RETURN 1; +CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1; +DROP FUNCTION f1; +connect(con2, localhost, root); + +--echo # Connection con1 +connect (con1, localhost, root); +# Need to trigger this sync point at least twice in order to +# get valgrind test failures without the patch +SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2'; +--echo # Sending: +--send SHOW CREATE VIEW v1 + +--echo # Connection con2 +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +SET DEBUG_SYNC= 'now SIGNAL dropped'; +SET DEBUG_SYNC= 'now WAIT_FOR opened'; +--echo # Sending: +--send FLUSH TABLES + +--echo # Connection default +connection default; +--echo # Waiting for FLUSH TABLES to be blocked. +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES'; +--source include/wait_condition.inc +SET DEBUG_SYNC= 'now SIGNAL dropped'; + +--echo # Connection con1 +connection con1; +--echo # Reaping: SHOW CREATE VIEW v1 +--reap + +--echo # Connection con2 +connection con2; +--echo # Reaping: FLUSH TABLES +--reap + +--echo # Connection default +connection default; +SET DEBUG_SYNC= 'RESET'; +DROP VIEW v1; +DROP TABLE t1; +disconnect con1; +disconnect con2; + + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/sql/sql_show.cc b/sql/sql_show.cc index be3dd8a0ca2..fa9c0e85c27 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -29,6 +29,8 @@ #include "repl_failsafe.h" #include "sql_parse.h" // check_access, check_table_access #include "sql_partition.h" // partition_element +#include "sql_derived.h" // mysql_derived_prepare, + // mysql_handle_derived, #include "sql_db.h" // check_db_dir_existence, load_db_opt_by_name #include "sql_time.h" // interval_type_to_name #include "tztime.h" // struct Time_zone @@ -683,11 +685,18 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) thd->lex->view_prepare_mode= TRUE; { + /* + Use open_tables() directly rather than open_normal_and_derived_tables(). + This ensures that close_thread_tables() is not called if open tables fails + and the error is ignored. This allows us to handle broken views nicely. + */ + uint counter; Show_create_error_handler view_error_suppressor(thd, table_list); thd->push_internal_handler(&view_error_suppressor); bool open_error= - open_normal_and_derived_tables(thd, table_list, - MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL); + open_tables(thd, &table_list, &counter, + MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) || + mysql_handle_derived(thd->lex, &mysql_derived_prepare); thd->pop_internal_handler(); if (open_error && (thd->killed || thd->is_error())) goto exit; From ccbf81d5ff87c10e423abbcab385552c7dca7403 Mon Sep 17 00:00:00 2001 From: Evgeny Potemkin Date: Thu, 4 Nov 2010 16:18:27 +0300 Subject: [PATCH 10/32] Bug#57278: Crash on min/max + with date out of range. MySQL officially supports DATE values starting from 1000-01-01. This is enforced for int values, but not for string values, thus one could easily insert '0001-01-01' value. Int values are checked by number_to_datetime function and Item_cache_datetime::val_str uses it to fill MYSQL_TIME struct out of cached int value. This leads to the scenario where Item_cache_datetime caches a non-null datetime value and when it tries to convert it from int to string number_to_datetime function treats the value as out-of-range and returns an error and Item_cache_datetime::val_str returns NULL for a non-null value. Due to this inconsistency server crashes. Now number_to_datetime allows DATE values below 1000-01-01 if the TIME_FUZZY_DATE flag is set. Better NULL handling for Item_cache_datetime. Added the Item_cache_datetime::store function to reset str_value_cached flag when an item is stored. --- mysql-test/r/type_date.result | 8 ++++++++ mysql-test/t/type_date.test | 8 ++++++++ sql-common/my_time.c | 7 ++++++- sql/item.cc | 19 ++++++++++++++++--- sql/item.h | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index bb441099b98..41345be5b8d 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -318,4 +318,12 @@ f1 date YES NULL f2 date YES NULL DROP TABLE t1; # +# +# Bug#57278: Crash on min/max + with date out of range. +# +set @a=(select min(makedate('111','1'))) ; +select @a; +@a +0111-01-01 +# End of 6.0 tests diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 11f2b68804a..6dec86dacab 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -284,4 +284,12 @@ DROP TABLE t1; --echo # +--echo # +--echo # Bug#57278: Crash on min/max + with date out of range. +--echo # +set @a=(select min(makedate('111','1'))) ; +select @a; +--echo # + + --echo End of 6.0 tests diff --git a/sql-common/my_time.c b/sql-common/my_time.c index ac6c2ace890..38384600fc1 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1127,7 +1127,12 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res, nr= (nr+19000000L)*1000000L; /* YYMMDD, year: 1970-1999 */ goto ok; } - if (nr < 10000101L) + /* + Though officially we support DATE values from 1000-01-01 only, one can + easily insert a value like 1-1-1. So, for consistency reasons such dates + are allowed when TIME_FUZZY_DATE is set. + */ + if (nr < 10000101L && !(flags & TIME_FUZZY_DATE)) goto err; if (nr <= 99991231L) { diff --git a/sql/item.cc b/sql/item.cc index b166f3e645f..7efbdf162a7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7493,9 +7493,19 @@ void Item_cache_datetime::store(Item *item, longlong val_arg) } +void Item_cache_datetime::store(Item *item) +{ + Item_cache::store(item); + str_value_cached= FALSE; +} + String *Item_cache_datetime::val_str(String *str) { DBUG_ASSERT(fixed == 1); + + if ((value_cached || str_value_cached) && null_value) + return NULL; + if (!str_value_cached) { /* @@ -7509,6 +7519,8 @@ String *Item_cache_datetime::val_str(String *str) if (value_cached) { MYSQL_TIME ltime; + /* Return NULL in case of OOM/conversion error. */ + null_value= TRUE; if (str_value.alloc(MAX_DATE_STRING_REP_LENGTH)) return NULL; if (cached_field_type == MYSQL_TYPE_TIME) @@ -7531,13 +7543,14 @@ String *Item_cache_datetime::val_str(String *str) { int was_cut; longlong res; - res= number_to_datetime(val_int(), <ime, TIME_FUZZY_DATE, &was_cut); + res= number_to_datetime(int_value, <ime, TIME_FUZZY_DATE, &was_cut); if (res == -1) return NULL; } str_value.length(my_TIME_to_str(<ime, const_cast(str_value.ptr()))); str_value_cached= TRUE; + null_value= FALSE; } else if (!cache_value()) return NULL; @@ -7558,7 +7571,7 @@ my_decimal *Item_cache_datetime::val_decimal(my_decimal *decimal_val) double Item_cache_datetime::val_real() { DBUG_ASSERT(fixed == 1); - if (!value_cached && !cache_value_int()) + if ((!value_cached && !cache_value_int()) || null_value) return 0.0; return (double) int_value; } @@ -7566,7 +7579,7 @@ double Item_cache_datetime::val_real() longlong Item_cache_datetime::val_int() { DBUG_ASSERT(fixed == 1); - if (!value_cached && !cache_value_int()) + if ((!value_cached && !cache_value_int()) || null_value) return 0; return int_value; } diff --git a/sql/item.h b/sql/item.h index 8e8199ecac8..b46f78853b7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3451,8 +3451,8 @@ public: cmp_context= STRING_RESULT; } - virtual void store(Item *item) { Item_cache::store(item); } void store(Item *item, longlong val_arg); + void store(Item *item); double val_real(); longlong val_int(); String* val_str(String *str); From ff24facf810642a14b2171db20ed1c9004384a88 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 8 Nov 2010 13:34:27 +0300 Subject: [PATCH 11/32] Fix for bug #54575: crash when joining tables with unique set column(backport from 5.1) Problem: a flaw (derefencing a NULL pointer) in the LIKE optimization code may lead to a server crash in some rare cases. Fix: check the pointer before its dereferencing. --- mysql-test/r/func_like.result | 14 ++++++++++++++ mysql-test/t/func_like.test | 18 ++++++++++++++++-- sql/item_cmpfunc.cc | 7 ++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 7e6fedb9403..f8743d6305f 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -165,3 +165,17 @@ select 'andre%' like 'andre select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê' 1 +End of 4.1 tests +# +# Bug #54575: crash when joining tables with unique set column +# +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +1 +DROP TABLE t1, t2; +End of 5.1 tests diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 4e1183afeff..50ebb2b2782 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -112,5 +112,19 @@ select 'andre%' like 'andre # select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'; -# -# End of 4.1 tests + +--echo End of 4.1 tests + + +--echo # +--echo # Bug #54575: crash when joining tables with unique set column +--echo # +CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a)); +CREATE TABLE t2(b INT PRIMARY KEY); +INSERT INTO t1 VALUES (); +INSERT INTO t2 VALUES (1), (2), (3); +SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; +DROP TABLE t1, t2; + + +--echo End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 5c2fb9857d5..4ae381af683 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4220,13 +4220,14 @@ Item_func::optimize_type Item_func_like::select_optimize() const if (args[1]->const_item()) { String* res2= args[1]->val_str((String *)&tmp_value2); + const char *ptr2; - if (!res2) + if (!res2 || !(ptr2= res2->ptr())) return OPTIMIZE_NONE; - if (*res2->ptr() != wild_many) + if (*ptr2 != wild_many) { - if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one) + if (args[0]->result_type() != STRING_RESULT || *ptr2 != wild_one) return OPTIMIZE_OP; } } From b31888294997ea450552127e6440ea970892f81e Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 8 Nov 2010 13:51:39 +0300 Subject: [PATCH 12/32] Bug#52711 Segfault when doing EXPLAIN SELECT with union...order by (select... where...) backport from 5.1 --- mysql-test/r/subselect.result | 16 ++++++++++++++++ mysql-test/t/subselect.test | 21 +++++++++++++++++++++ sql/sql_select.cc | 5 +++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 09a650c722b..7fbe4c08b08 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4527,4 +4527,20 @@ pk int_key 3 3 7 3 DROP TABLE t1,t2; +# +# Bug #52711: Segfault when doing EXPLAIN SELECT with +# union...order by (select... where...) +# +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +# Should not crash +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +# Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; End of 5.0 tests. diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index bd12742f0f1..0956f91619d 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3506,5 +3506,26 @@ ORDER BY outr.pk; DROP TABLE t1,t2; +--echo # +--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with +--echo # union...order by (select... where...) +--echo # + +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +--echo # Should not crash +--disable_result_log +EXPLAIN +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); + +--echo # Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +DROP TABLE t1,t2; +--enable_result_log --echo End of 5.0 tests. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 53a6b699022..929ef3c8949 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -501,7 +501,7 @@ JOIN::prepare(Item ***rref_pointer_array, thd->lex->allow_sum_func= save_allow_sum_func; } - if (!thd->lex->view_prepare_mode) + if (!thd->lex->view_prepare_mode && !(select_options & SELECT_DESCRIBE)) { Item_subselect *subselect; /* Is it subselect? */ @@ -6861,7 +6861,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { - if (order->item[0]->with_subselect) + if (order->item[0]->with_subselect && + !(join->select_lex->options & SELECT_DESCRIBE)) order->item[0]->val_str(&order->item[0]->str_value); DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; // skip const item From 0c4e115c952c8c6a429c81d844b5767cd80ad479 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 11 Nov 2010 11:08:53 +0300 Subject: [PATCH 13/32] Bug#57687 crash when reporting duplicate group_key error and utf8 Fixing DoS regression problem. Using "key_part->fieldnr - 1" to access the desired field is only correct in real INSERT queries. In case of inserting records into a temporary table when performing GROUP BY queries this expression does not work. Fix: Instead of accessing field_length and comparing it to key_part->length, there is an easier way to check if we're dealing with a prefix key: check key_part_flag against HA_PART_KEY_SEG flag. --- mysql-test/r/ctype_utf8.result | 11 +++++++++++ mysql-test/t/ctype_utf8.test | 12 ++++++++++++ sql/key.cc | 4 +--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 13e1092cb98..3982d09e64b 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -4885,5 +4885,16 @@ maketime(`a`,`a`,`a`) DROP TABLE t1; SET sql_mode=default; # +# Bug#57687 crash when reporting duplicate group_key error and utf8 +# Make sure to modify this when Bug#58081 is fixed. +# +SET NAMES utf8; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0), (1), (0), (0); +SELECT COUNT(*) FROM t1, t1 t2 +GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); +ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key' +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 318bbdca0c7..5ce83a05f61 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1529,6 +1529,18 @@ DROP TABLE t1, t2; SET NAMES utf8; --source include/ctype_numconv.inc +--echo # +--echo # Bug#57687 crash when reporting duplicate group_key error and utf8 +--echo # Make sure to modify this when Bug#58081 is fixed. +--echo # +SET NAMES utf8; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0), (1), (0), (0); +--error ER_DUP_ENTRY +SELECT COUNT(*) FROM t1, t1 t2 +GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); +DROP TABLE t1; + --echo # --echo # End of 5.5 tests diff --git a/sql/key.cc b/sql/key.cc index e28e0803986..288afd034a9 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -364,9 +364,7 @@ void key_unpack(String *to,TABLE *table,uint idx) while (tmp_end > tmp.ptr() && !*--tmp_end) ; tmp.length(tmp_end - tmp.ptr() + 1); } - if (cs->mbmaxlen > 1 && - table->field[key_part->fieldnr - 1]->field_length != - key_part->length) + if (cs->mbmaxlen > 1 && (key_part->key_part_flag & HA_PART_KEY_SEG)) { /* Prefix key, multi-byte charset. From 771137b50e9ae9a5fcbb8d2665f985d394434036 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 11 Nov 2010 13:25:23 +0300 Subject: [PATCH 14/32] Bug#57257 Replace(ExtractValue(...)) causes MySQL crash Bug#57820 extractvalue crashes Problem: ExtractValue and Replace crashed in some cases due to invalid handling of empty and NULL arguments. Per file comments: @mysql-test/r/ctype_ujis.result @mysql-test/r/xml.result @mysql-test/t/ctype_ujis.test @mysql-test/t/xml.test Adding tests @sql/item_strfunc.cc Make sure Item_func_replace::val_str safely handles empty strings. @sql/item_xmlfunc.cc set null_value if nodeset_func returned NULL, which is possible when the second argument is an unset user variable. --- mysql-test/r/ctype_ujis.result | 10 ++++++++++ mysql-test/r/xml.result | 13 +++++++++++++ mysql-test/t/ctype_ujis.test | 7 +++++++ mysql-test/t/xml.test | 11 +++++++++++ sql/item_strfunc.cc | 8 +++++++- sql/item_xmlfunc.cc | 4 ++-- 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 540ba178756..765ad5a96ca 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -2374,6 +2374,16 @@ hex(convert(_latin1 0xA4A2 using ujis)) hex(c2) DROP PROCEDURE sp1; DROP TABLE t1; DROP TABLE t2; +# +# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +# +SET NAMES utf8; +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); +CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis) + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'a' +Warning 1292 Truncated incorrect INTEGER value: 'a' set names default; set character_set_database=default; set character_set_server=default; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index fad2cab0e57..e6811789679 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1093,4 +1093,17 @@ Warnings: Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT' Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT' DROP TABLE t1; +# +# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +# +SET NAMES utf8; +SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds',''); +REPLACE(EXTRACTVALUE('1', '/a'),'ds','') + +# +# Bug #57820 extractvalue crashes +# +SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k'))); +AVG(DISTINCT EXTRACTVALUE((''),('$@k'))) +NULL End of 5.1 tests diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 400f1301dd3..4c29a2e11a0 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1209,6 +1209,13 @@ DROP PROCEDURE sp1; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); + + set names default; set character_set_database=default; set character_set_server=default; diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 6e7d38cdfca..a8917fc9fe7 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -617,4 +617,15 @@ FROM t1 ORDER BY t1.id; DROP TABLE t1; +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds',''); + +--echo # +--echo # Bug #57820 extractvalue crashes +--echo # +SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k'))); + --echo End of 5.1 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 8fda281bd9e..fd5c47d25cb 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -904,9 +904,15 @@ String *Item_func_replace::val_str(String *str) search=res2->ptr(); search_end=search+from_length; redo: + DBUG_ASSERT(res->ptr() || !offset); ptr=res->ptr()+offset; strend=res->ptr()+res->length(); - end=strend-from_length+1; + /* + In some cases val_str() can return empty string + with ptr() == NULL and length() == 0. + Let's check strend to avoid overflow. + */ + end= strend ? strend - from_length + 1 : NULL; while (ptr < end) { if (*ptr == *search) diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 3e20b90e68e..364311877e0 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2790,12 +2790,12 @@ String *Item_func_xml_extractvalue::val_str(String *str) null_value= 0; if (!nodeset_func || !(res= args[0]->val_str(str)) || - !parse_xml(res, &pxml)) + !parse_xml(res, &pxml) || + !(res= nodeset_func->val_str(&tmp_value))) { null_value= 1; return 0; } - res= nodeset_func->val_str(&tmp_value); return res; } From 0e1c167e168a69bedf20b048ae1adf37a7d2dbb1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 12 Nov 2010 13:12:15 +0300 Subject: [PATCH 15/32] Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' Problem: When GET_FORMAT() is called two times from the upper level function (e.g. LEAST in the bug report), on the second call "res= args[0]->val_str(...)" and str point to the same String object. 1. Fix: changing the order from - get val_str into tmp_value then convert to str to - get val_str into str then convert to tmp_value The new order is more correct: the purpose of "str" parameter is exactly to call val_str() for arguments. The purpose of String class members (like tmp_value) is to do further actions on the result. Doing it in the other way around give unexpected surprises. 2. Using str_value instead of str to do padding, for the same reason. --- mysql-test/r/date_formats.result | 14 ++++++++++++++ mysql-test/t/date_formats.test | 16 ++++++++++++++++ sql/item_timefunc.cc | 14 +++++++------- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 7e185daa668..a919a6f8c5e 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -609,3 +609,17 @@ SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; valid_date Thursday 01 January 2009 "End of 5.0 tests" +# +# Start of 5.1 tests +# +# +# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +# +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))) +% +SET NAMES latin1; +# +# End of 5.1 tests +# diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index e5dc7ffa53e..2a5de8ca9ba 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -359,3 +359,19 @@ SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; --echo "End of 5.0 tests" + + +--echo # +--echo # Start of 5.1 tests +--echo # + +--echo # +--echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +--echo # +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +SET NAMES latin1; + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 103bd96efd4..6335199b8de 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2456,14 +2456,14 @@ String *Item_char_typecast::val_str(String *str) { // Convert character set if differ uint dummy_errors; - if (!(res= args[0]->val_str(&tmp_value)) || - str->copy(res->ptr(), res->length(), from_cs, - cast_cs, &dummy_errors)) + if (!(res= args[0]->val_str(str)) || + tmp_value.copy(res->ptr(), res->length(), from_cs, + cast_cs, &dummy_errors)) { null_value= 1; return 0; } - res= str; + res= &tmp_value; } res->set_charset(cast_cs); @@ -2497,9 +2497,9 @@ String *Item_char_typecast::val_str(String *str) { if (res->alloced_length() < (uint) cast_length) { - str->alloc(cast_length); - str->copy(*res); - res= str; + str_value.alloc(cast_length); + str_value.copy(*res); + res= &str_value; } bzero((char*) res->ptr() + res->length(), (uint) cast_length - res->length()); From 67f640fd50586c92109f9d8a46719b9a4f68914b Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 15 Nov 2010 23:27:37 +0100 Subject: [PATCH 16/32] post-push fix for test to pass on windows --- mysql-test/t/partition_innodb_plugin.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index 114adf67180..626e5d19b99 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -27,6 +27,7 @@ user_num CHAR(10) KEY_BLOCK_SIZE=4 PARTITION BY HASH(id) PARTITIONS 1; +--replace_result #p# #P# --list_files $MYSQLD_DATADIR/test SHOW CREATE TABLE t1; @@ -44,12 +45,14 @@ LOCK TABLE t1 WRITE; --error ER_GET_ERRNO ALTER TABLE t1 ADD PARTITION PARTITIONS 1; +--replace_result #p# #P# --list_files $MYSQLD_DATADIR/test --echo # This SET is not needed to reproduce the bug, --echo # it is here just to make the test case more realistic SET innodb_strict_mode = OFF; ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--replace_result #p# #P# --list_files $MYSQLD_DATADIR/test # really bug#56172 From d25e3389f488e4f8b9e53cbd4030848127ff5355 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 17 Nov 2010 10:13:57 +0100 Subject: [PATCH 17/32] post-push fix, backported --replace_result patch for --list_files in mysqltest. --- client/mysqltest.cc | 8 +++++--- mysql-test/r/mysqltest.result | 2 +- mysql-test/t/mysqltest.test | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 35ceaaaa5de..b473169b58b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -441,7 +441,7 @@ struct st_command char *query, *query_buf,*first_argument,*last_argument,*end; DYNAMIC_STRING content; int first_word_len, query_len; - my_bool abort_on_error; + my_bool abort_on_error, used_replace; struct st_expected_errors expected_errors; char require_file[FN_REFLEN]; enum enum_commands type; @@ -3284,7 +3284,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname, if (ds_wild && ds_wild->length && wild_compare(file->name, ds_wild->str, 0)) continue; - dynstr_append(ds, file->name); + replace_dynstr_append(ds, file->name); dynstr_append(ds, "\n"); } set_wild_chars(0); @@ -3314,6 +3314,7 @@ static void do_list_files(struct st_command *command) {"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"} }; DBUG_ENTER("do_list_files"); + command->used_replace= 1; check_command_args(command, command->first_argument, list_files_args, @@ -3355,6 +3356,7 @@ static void do_list_files_write_file_command(struct st_command *command, {"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"} }; DBUG_ENTER("do_list_files_write_file"); + command->used_replace= 1; check_command_args(command, command->first_argument, list_files_args, @@ -8386,7 +8388,7 @@ int main(int argc, char **argv) memset(&saved_expected_errors, 0, sizeof(saved_expected_errors)); } - if (command_executed != last_command_executed) + if (command_executed != last_command_executed || command->used_replace) { /* As soon as any command has been executed, diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 8afef65b66f..5acac076292 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -798,7 +798,7 @@ drop table t1; mysqltest: At line 1: change user failed: Unknown database 'inexistent' mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO) mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES) -file1.txt +REPLACED_FILE1.txt file1.txt file2.txt file11.txt diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index d6bdbc2b3c1..c250b8768d2 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -2496,6 +2496,8 @@ write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; hello EOF +# Verify that --replace_result also work on list_files +--replace_result file REPLACED_FILE list_files $MYSQLTEST_VARDIR/tmp/testdir; # list_files gets the directory list before creating the new file list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *; From 594a599247489df21747526c523f436c41511dfe Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 18 Nov 2010 11:53:08 +0300 Subject: [PATCH 18/32] Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings ESCAPE argument might be empty string. It leads to server crash under some circumstances. The fix: -added check if ESCAPE argument result is not empty string --- mysql-test/r/ctype_latin1.result | 8 ++++++++ mysql-test/t/ctype_latin1.test | 5 +++++ sql/item_cmpfunc.cc | 11 ++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 763acd0fea0..66b2cbd8fc4 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -409,3 +409,11 @@ select hex(cast(_ascii 0x7f as char(1) character set latin1)); hex(cast(_ascii 0x7f as char(1) character set latin1)) 7F End of 5.0 tests +# +# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +# +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); +'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '') +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index b12436f77ba..a7e6351161b 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -127,3 +127,8 @@ DROP TABLE `abc select hex(cast(_ascii 0x7f as char(1) character set latin1)); --echo End of 5.0 tests + +--echo # +--echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +--echo # +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 6987dd9e053..5302406e270 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4692,6 +4692,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) String *escape_str= escape_item->val_str(&cmp.value1); if (escape_str) { + const char *escape_str_ptr= escape_str->ptr(); if (escape_used_in_parsing && ( (((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) && escape_str->numchars() != 1) || @@ -4706,9 +4707,9 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) CHARSET_INFO *cs= escape_str->charset(); my_wc_t wc; int rc= cs->cset->mb_wc(cs, &wc, - (const uchar*) escape_str->ptr(), - (const uchar*) escape_str->ptr() + - escape_str->length()); + (const uchar*) escape_str_ptr, + (const uchar*) escape_str_ptr + + escape_str->length()); escape= (int) (rc > 0 ? wc : '\\'); } else @@ -4725,13 +4726,13 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) { char ch; uint errors; - uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str->ptr(), + uint32 cnvlen= copy_and_convert(&ch, 1, cs, escape_str_ptr, escape_str->length(), escape_str->charset(), &errors); escape= cnvlen ? ch : '\\'; } else - escape= *(escape_str->ptr()); + escape= escape_str_ptr ? *escape_str_ptr : '\\'; } } else From 3586f7727f43275aa7e696d62f0e3bd444de2d24 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Tue, 23 Nov 2010 00:29:47 +0300 Subject: [PATCH 19/32] backport: Bug #55568 from 5.1-security to 5.0-security > revision-id: alexey.kopytov@sun.com-20100824103548-ikm79qlfrvggyj9h > parent: sunny.bains@oracle.com-20100816001222-xqc447tr6jwh8c53 > committer: Alexey Kopytov > branch nick: 5.1-security > timestamp: Tue 2010-08-24 14:35:48 +0400 > message: > Bug #55568: user variable assignments crash server when used > within query > > The server could crash after materializing a derived table > which requires a temporary table for grouping. > > When destroying the temporary table used to execute a query for > a derived table, JOIN::destroy() did not clean up Item_fields > pointing to fields in the temporary table. This led to > dereferencing a dangling pointer when printing out the items > tree later in the outer SELECT. > > The solution is an addendum to the patch for bug37362: in > addition to cleaning up items in tmp_all_fields3, do the same > for items in tmp_all_fields1, since now we have an example > where this is necessary. --- mysql-test/r/join.result | 51 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/join.test | 46 ++++++++++++++++++++++++++++++++++++ sql/field.cc | 2 +- sql/sql_select.cc | 22 +++++++++++------ sql/sql_select.h | 1 + 5 files changed, 114 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index beba47cd39b..131efc7aaad 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -952,4 +952,55 @@ a b a b 0 0 0 0 1 1 1 1 DROP TABLE t1; +# +# Bug #55568: user variable assignments crash server when used within +# query +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (1); +SELECT MULTIPOINT( +1, +( +SELECT MULTIPOINT( +MULTIPOINT( +1, +(SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d) +) +) FROM t1 +) +) != COUNT(*) q FROM t1 GROUP BY a; +q +NULL +NULL +SELECT MULTIPOINT( +1, +( +SELECT MULTIPOINT( +MULTIPOINT( +1, +(SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d) +) +) FROM t1 +) +) != COUNT(*) q FROM t1 GROUP BY a; +q +NULL +NULL +DROP TABLE t1; +# +# Bug #54468: crash after item's print() function when ordering/grouping +# by subquery +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (), (); +SELECT 1 FROM t1 +GROUP BY +GREATEST(t1.a, +(SELECT 1 FROM +(SELECT t1.b FROM t1,t1 t2 +ORDER BY t1.a, t1.a LIMIT 1) AS d) +); +1 +1 +DROP TABLE t1; End of 5.0 tests. diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index d51740bb380..17f2a64b24a 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -747,4 +747,50 @@ SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t DROP TABLE t1; +--echo # +--echo # Bug #55568: user variable assignments crash server when used within +--echo # query +--echo # + +CREATE TABLE t1 (a INT); + +INSERT INTO t1 VALUES (0), (1); + +let $i=2; +while ($i) +{ + SELECT MULTIPOINT( + 1, + ( + SELECT MULTIPOINT( + MULTIPOINT( + 1, + (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d) + ) + ) FROM t1 + ) + ) != COUNT(*) q FROM t1 GROUP BY a; + dec $i; +} + +DROP TABLE t1; + +--echo # +--echo # Bug #54468: crash after item's print() function when ordering/grouping +--echo # by subquery +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (), (); + +SELECT 1 FROM t1 +GROUP BY +GREATEST(t1.a, + (SELECT 1 FROM + (SELECT t1.b FROM t1,t1 t2 + ORDER BY t1.a, t1.a LIMIT 1) AS d) + ); + +DROP TABLE t1; + --echo End of 5.0 tests. diff --git a/sql/field.cc b/sql/field.cc index b61e5fd2d79..3efd6111dcb 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1365,7 +1365,7 @@ void Field::make_field(Send_field *field) } else field->org_table_name= field->db_name= ""; - if (orig_table) + if (orig_table && orig_table->alias) { field->table_name= orig_table->alias; field->org_col_name= field_name; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 929ef3c8949..ff572172afa 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2226,13 +2226,8 @@ JOIN::destroy() cleanup(1); /* Cleanup items referencing temporary table columns */ - if (!tmp_all_fields3.is_empty()) - { - List_iterator_fast it(tmp_all_fields3); - Item *item; - while ((item= it++)) - item->cleanup(); - } + cleanup_item_list(tmp_all_fields1); + cleanup_item_list(tmp_all_fields3); if (exec_tmp_table1) free_tmp_table(thd, exec_tmp_table1); if (exec_tmp_table2) @@ -2243,6 +2238,19 @@ JOIN::destroy() DBUG_RETURN(error); } + +void JOIN::cleanup_item_list(List &items) const +{ + if (!items.is_empty()) + { + List_iterator_fast it(items); + Item *item; + while ((item= it++)) + item->cleanup(); + } +} + + /* An entry point to single-unit select (a select without UNION). diff --git a/sql/sql_select.h b/sql/sql_select.h index 346d98aae58..553acd25624 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -489,6 +489,7 @@ public: } private: bool make_simple_join(JOIN *join, TABLE *tmp_table); + void cleanup_item_list(List &items) const; }; From 9919ac5c9799ee320bee3f0d6458c66eeb0fb7d5 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Tue, 23 Nov 2010 16:35:40 +0300 Subject: [PATCH 20/32] binlog.binlog_row_failure_mixing_engines test disabled. See bug #58416. --- mysql-test/suite/binlog/t/disabled.def | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def index d261364756e..85313982869 100644 --- a/mysql-test/suite/binlog/t/disabled.def +++ b/mysql-test/suite/binlog/t/disabled.def @@ -10,5 +10,4 @@ # ############################################################################## binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed - - +binlog_row_failure_mixing_engines : BUG#58416 2010-11-23 ramil Fails on win x86 debug_max From 4ff8a4b3de0f68972a9f4a2f10235d4fa558037a Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 23 Nov 2010 15:03:44 +0100 Subject: [PATCH 21/32] Bug #58415 mtr cannot find libmysqld.dll in new 5.5 packages Done as suggested Also tested from src build directory --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index bee48ed1e17..177752948d5 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1375,7 +1375,7 @@ sub command_line_setup { # Add the location for libmysqld.dll to the path. my $separator= ";"; my $lib_mysqld= - mtr_path_exists(vs_config_dirs('libmysqld','')); + mtr_path_exists("$bindir/lib", vs_config_dirs('libmysqld','')); if ( IS_CYGWIN ) { $lib_mysqld= posix_path($lib_mysqld); From 7427df4a804652d945784663b1cfa8b3ca7ed513 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 23 Nov 2010 15:24:14 +0000 Subject: [PATCH 22/32] EXCEPTIONS-CLIENT was removed, update the RPM spec file. While here, support supplying a '-j' flag to make(1) from the environment. --- support-files/mysql.spec.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 125ead12e2b..aa861609a5f 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -211,7 +211,6 @@ %define license_files_server %{src_dir}/LICENSE.mysql %define license_type Commercial %else -%define license_files_devel %{src_dir}/EXCEPTIONS-CLIENT %define license_files_server %{src_dir}/COPYING %{src_dir}/README %define license_type GPL %endif @@ -399,6 +398,7 @@ export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}} export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}} export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}} export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}} +export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-} # Build debug mysqld and libmysqld.a mkdir debug @@ -426,7 +426,7 @@ mkdir debug -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \ -DMYSQL_SERVER_SUFFIX="%{server_suffix}" echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG - make VERBOSE=1 + make ${MAKE_JFLAG} VERBOSE=1 ) # Build full release mkdir release @@ -441,7 +441,7 @@ mkdir release -DCOMPILATION_COMMENT="%{compilation_comment_release}" \ -DMYSQL_SERVER_SUFFIX="%{server_suffix}" echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG - make VERBOSE=1 + make ${MAKE_JFLAG} VERBOSE=1 ) # Use the build root for temporary storage of the shared libraries. @@ -1037,9 +1037,6 @@ echo "=====" >> $STATUS_HISTORY # ---------------------------------------------------------------------------- %files -n MySQL-devel%{product_suffix} -f optional-files-devel %defattr(-, root, root, 0755) -%if %{defined license_files_devel} -%doc %{license_files_devel} -%endif %doc %attr(644, root, man) %{_mandir}/man1/comp_err.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1* %attr(755, root, root) %{_bindir}/mysql_config @@ -1088,6 +1085,12 @@ echo "=====" >> $STATUS_HISTORY # merging BK trees) ############################################################################## %changelog +* Tue Nov 23 2010 Jonathan Perkin + +- EXCEPTIONS-CLIENT has been deleted, remove it from here too +- Support MYSQL_BUILD_MAKE_JFLAG environment variable for passing + a '-j' argument to make. + * Mon Nov 1 2010 Georgi Kodinov - Added test authentication (WL#1054) plugin binaries From b6b7fb2bfa36ed7b5ae391218f9259a078366f44 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 24 Nov 2010 16:12:23 +0300 Subject: [PATCH 23/32] A follow-up for Bug#58339 (Replace Server GPL README file). Fix formatting issues in README file. --- README | 540 ++++++++++++++++++++++++++------------------------------- 1 file changed, 246 insertions(+), 294 deletions(-) diff --git a/README b/README index a73ec2b7437..5463de4a7e8 100644 --- a/README +++ b/README @@ -68,7 +68,6 @@ Use of any of this software is governed by the terms of the license below: # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #=========================================================================== -== # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) # @@ -122,27 +121,30 @@ CMake is distributed under BSD License All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: + modification, are permitted provided that the following conditions are + met: - * Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - * Neither the name of Kitware, Inc. nor the names of its contributors -may be used to endorse or promote products derived from this software without -specific prior written permission. + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Kitware, Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Kitware, Inc. "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL Kitware Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL Kitware Inc. BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. Additional License(s) @@ -186,20 +188,16 @@ cmake-2.4.8/Utilities/cmtar/compat/gethostname.c: ************************************************************************** - * - Author : Per Foreby, perf@efd.lth.se - * - Author : Juergen Pfeifer, juergen.pfeifer@gmx.net - * - - * + * Author : Per Foreby, perf@efd.lth.se + * Author : Juergen Pfeifer, juergen.pfeifer@gmx.net + ************************************************************************** ---------------------------------------- Copyright (c) 2002 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for -details. + details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -208,9 +206,8 @@ details. -------------------------------------------- Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free -Software Foundati -on, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -253,35 +250,27 @@ cmake-2.4.8/Utilities/cmzlib/zlib.h: in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must -not be - misrepresented as being the original software. + not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source -distribution. + distribution. Jean-loup Gailly Mark Adler ---------------------------------------------- - This source code was modified by Martin Hedenfalk - for - use in Curl. His latest changes were done 2000-09-18. + This source code was modified by Martin Hedenfalk for use in Curl. His + latest changes were done 2000-09-18. - It has since been patched away like a madman by Daniel Stenberg - to make it better applied to curl conditions, and to -make - it not use globals, pollute name space and more. This source code -awaits a - rewrite to work around the paragraph 2 in the BSD licenses as explained - below. + It has since been patched away like a madman by Daniel Stenberg to make it + better applied to curl conditions, and to make it not use globals, pollute + name space and more. This source code awaits a rewrite to work around the + paragraph 2 in the BSD licenses as explained below. Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan - It has since been patched and modified a lot by Daniel Stenberg - to make it better applied to curl conditions, and to -make - it not use globals, pollute name space and more. This source code -awaits a - rewrite to work around the paragraph 2 in the BSD licenses as explained - below. + It has since been patched and modified a lot by Daniel Stenberg to make it + better applied to curl conditions, and to make it not use globals, pollute + name space and more. This source code awaits a rewrite to work around the + paragraph 2 in the BSD licenses as explained below. Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan (Royal Institute of Technology, Stockholm, Sweden). @@ -304,19 +293,15 @@ awaits a THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE -LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + SUCH DAMAGE. --------------------------------------------- @@ -332,8 +317,7 @@ STRICT -------------------------------------------------- cmake-2.4.8/Utilities/cmcurl/inet_pton.c, -cmake-2.4.8/Source/CTest/Curl/inet_pto -n.c: +cmake-2.4.8/Source/CTest/Curl/inet_pton.c: This is from the BIND 4.9.4 release, modified to compile by itself Copyright (c) 1996 by Internet Software Consortium. @@ -343,16 +327,13 @@ n.c: copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM -DISCLAIMS - ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED -WARRANTIES - OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -OF THIS - SOFTWARE. + DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, + OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. ------------------------------------------------------- @@ -369,24 +350,19 @@ OF THIS * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products -* derived from this software without specific prior written -permission. +* derived from this software without specific prior written permission. * -* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY +* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -** SUCH DAMAGE. +* SUCH DAMAGE. --------------------------------------------------- @@ -433,23 +409,20 @@ ANY WAY documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: - This product includes software developed by the University of - California, Berkeley and its contributors. + This product includes software developed by the University of + California, Berkeley and its contributors. 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -480,60 +453,33 @@ STRICT *************************************************************************** Copyright (c) 1998 Free Software Foundation, Inc. - * Copyright (c) 1998,2000 Free Software Foundation, Inc. - * - * - Permission is hereby granted, free of charge, to any person obtaining -a * - copy of this software and associated documentation files (the - * - "Software"), to deal in the Software without restriction, including - * - without limitation the rights to use, copy, modify, merge, publish, - * - distribute, distribute with modifications, sublicense, and/or sell - * - copies of the Software, and to permit persons to whom the Software is - * - furnished to do so, subject to the following conditions: - * + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, distribute with modifications, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished + to do so, subject to the following conditions: - * - The above copyright notice and this permission notice shall be -included * - in all copies or substantial portions of the Software. - * + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. - * - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS * - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. * - IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, * + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * - OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - * - THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * - Except as contained in this notice, the name(s) of the above -copyright * - holders shall not be used in advertising or otherwise to promote the - * - sale, use or other dealings in this Software without prior written - * + Except as contained in this notice, the name(s) of the above copyright + holders shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written authorization. - * - *************************************************************************** +*************************************************************************** ------------------------------------------------------ @@ -551,30 +497,25 @@ copyright * 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; - OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -586,31 +527,29 @@ Fred Fish's Dbug Library Use of any of this software is governed by the terms of the license below: -* - * N O T I C E * - * * - * Copyright Abandoned, 1987, Fred Fish * - * * - * * + * N O T I C E * + * * + * Copyright Abandoned, 1987, Fred Fish * + * * + * * * This previously copyrighted work has been placed into the public * * domain by the author and may be freely used for any purpose, * - * private or commercial. * - * * + * private or commercial. * + * * * Because of the number of inquiries I was receiving about the use * * of this product in commercially developed works I have decided to * - * simply make it public domain to further its unrestricted use. I * + * simply make it public domain to further its unrestricted use. I * * specifically would be most happy to see this material become a * * part of the standard Unix distributions by AT&T and the Berkeley * * Computer Science Research Group, and a standard part of the GNU * - * system from the Free Software Foundation. * - * * + * system from the Free Software Foundation. * + * * * I would appreciate it, as a courtesy, if this notice is left in * - * all copies and derivative works. Thank you. * - * * + * all copies and derivative works. Thank you. * + * * * The author makes no warranty of any kind with respect to this * * product and explicitly disclaims any implied warranties of mer- * - * chantability or fitness for any particular purpose. * - * + * chantability or fitness for any particular purpose. * *************************************************************************** @@ -619,28 +558,27 @@ dbug_analyze.c (part of Fred Fish's Dbug Library) Use of any of this software is governed by the terms of the license below: -* * -* Copyright Abandoned, 1987, Fred Fish * -* * -* * -* This previously copyrighted work has been placed into the public * -* domain by the author and may be freely used for any purpose, * -* private or commercial. * -* * -* Because of the number of inquiries I was receiving about the use * -* of this product in commercially developed works I have decided to * -* simply make it public domain to further its unrestricted use. I * -* specifically would be most happy to see this material become a * -* part of the standard Unix distributions by AT&T and the Berkeley * -* Computer Science Research Group, and a standard part of the GNU * -* system from the Free Software Foundation. * -* * -* I would appreciate it, as a courtesy, if this notice is left in * -* all copies and derivative works. Thank you. * -* * -* The author makes no warranty of any kind with respect to this * -* product and explicitly disclaims any implied warranties of mer- * -* chantability or fitness for any particular purpose. +* Copyright Abandoned, 1987, Fred Fish * +* * +* * +* This previously copyrighted work has been placed into the public * +* domain by the author and may be freely used for any purpose, * +* private or commercial. * +* * +* Because of the number of inquiries I was receiving about the use * +* of this product in commercially developed works I have decided to * +* simply make it public domain to further its unrestricted use. I * +* specifically would be most happy to see this material become a * +* part of the standard Unix distributions by AT&T and the Berkeley * +* Computer Science Research Group, and a standard part of the GNU * +* system from the Free Software Foundation. * +* * +* I would appreciate it, as a courtesy, if this notice is left in * +* all copies and derivative works. Thank you. * +* * +* The author makes no warranty of any kind with respect to this * +* product and explicitly disclaims any implied warranties of mer- * +* chantability or fitness for any particular purpose. * *************************************************************************** @@ -1454,11 +1392,9 @@ text: Library General Public License for more details. You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If -not, - write to the Free Software Foundation, Inc., 59 Temple Place - -Suite 330, - Boston, MA 02111-1307, USA. */ + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite + 330, Boston, MA 02111-1307, USA. */ @@ -1548,104 +1484,121 @@ Use of any of this software is governed by the terms of the license below: Unicode Terms of Use - For the general privacy policy governing access to this site, see the -Unicode Privacy Policy. For trademark usage, see the Unicode Consortium® -Trademarks and Logo Policy. + For the general privacy policy governing access to this site, see the + Unicode Privacy Policy. For trademark usage, see the Unicode + Consortium (R) Trademarks and Logo Policy. Notice to End User: Terms of Use - Carefully read the following legal agreement ("Agreement"). Use or copying -of the software and/or codes provided with this agreement (The "Software") -constitutes your acceptance of these terms + Carefully read the following legal agreement ("Agreement"). Use or + copying of the software and/or codes provided with this agreement (The + "Software") constitutes your acceptance of these terms 1. Unicode Copyright. - 1. Copyright © 1991-2008 Unicode, Inc. All rights reserved. - 2. Certain documents and files on this website contain a legend -indicating that "Modification is permitted." Any person is hereby authorized, -without fee, to modify such documents and files to create derivative works -conforming to the Unicode® Standard, subject to Terms and Conditions herein. + 1. Copyright (c) 1991-2008 Unicode, Inc. All rights reserved. + 2. Certain documents and files on this website contain a + legend indicating that "Modification is permitted." Any person + is hereby authorized, without fee, to modify such documents + and files to create derivative works conforming to the + Unicode (R) Standard, subject to Terms and Conditions herein. 3. Any person is hereby authorized, without fee, to view, use, -reproduce, and distribute all documents and files solely for informational -purposes in the creation of products supporting the Unicode Standard, subject to -the Terms and Conditions herein. - 4. Further specifications of rights and restrictions pertaining to -the use of the particular set of data files known as the "Unicode Character -Database" can be found in Exhibit 1. - 5. Each version of the Unicode Standard has further specifications -of rights and restrictions of use. For the book editions, these are found on the -back of the title page. For the online edition, certain files (such as the PDF -files for book chapters and code charts) carry specific restrictions. All other -files are covered under these general Terms of Use. To request a permission to -reproduce any part of the Unicode Standard, please contact the Unicode Consortium. - 6. No license is granted to "mirror" the Unicode website where a -fee is charged for access to the "mirror" site. - 7. Modification is not permitted with respect to this document. All -copies of this document must be verbatim. + reproduce, and distribute all documents and files solely for + informational purposes in the creation of products supporting + the Unicode Standard, subject to the Terms and Conditions + herein. + 4. Further specifications of rights and restrictions + pertaining to the use of the particular set of data files + known as the "Unicode Character Database" can be found in + Exhibit 1. + 5. Each version of the Unicode Standard has further + specifications of rights and restrictions of use. For the book + editions, these are found on the back of the title page. For + the online edition, certain files (such as the PDF files for + book chapters and code charts) carry specific restrictions. + All other files are covered under these general Terms of Use. + To request a permission to reproduce any part of the Unicode + Standard, please contact the Unicode Consortium. + 6. No license is granted to "mirror" the Unicode website where + a fee is charged for access to the "mirror" site. + 7. Modification is not permitted with respect to this + document. All copies of this document must be verbatim. 2. Restricted Rights Legend. Any technical data or software which is -licensed to the United States of America, its agencies and/or instrumentalities -under this Agreement is commercial technical data or commercial computer -software developed exclusively at private expense as defined in FAR 2.101, or -DFARS 252.227-7014 (June 1995), as applicable. For technical data, use, -duplication, or disclosure by the Government is subject to restrictions as set -forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and -this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202, -as applicable, use, duplication or disclosure by the Government is subject to -the restrictions set forth in this Agreement. + licensed to the United States of America, its agencies and/or + instrumentalities under this Agreement is commercial technical data + or commercial computer software developed exclusively at private + expense as defined in FAR 2.101, or DFARS 252.227-7014 (June 1995), + as applicable. For technical data, use, duplication, or disclosure + by the Government is subject to restrictions as set forth in DFARS + 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and + this Agreement. For Software, in accordance with FAR 12-212 or DFARS + 227-7202, as applicable, use, duplication or disclosure by the + Government is subject to the restrictions set forth in this + Agreement. 3. Warranties and Disclaimers. 1. This publication and/or website may include technical or -typographical errors or other inaccuracies . Changes are periodically added to -the information herein; these changes will be incorporated in new editions of -the publication and/or website. Unicode may make improvements and/or changes in -the product(s) and/or program(s) described in this publication and/or website at -any time. - 2. If this file has been purchased on magnetic or optical media -from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange -of the defective media within ninety (90) days of original purchase. + typographical errors or other inaccuracies . Changes are + periodically added to the information herein; these changes + will be incorporated in new editions of the publication and/or + website. Unicode may make improvements and/or changes in the + product(s) and/or program(s) described in this publication + and/or website at any time. + 2. If this file has been purchased on magnetic or optical + media from Unicode, Inc. the sole and exclusive remedy for any + claim will be exchange of the defective media within ninety + (90) days of original purchase. 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR -SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, -IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE -AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS -PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED -TO THIS PUBLICATION OR THE UNICODE WEBSITE. + SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND + EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT + LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS + LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN + THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE + REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE + WEBSITE. 4. Waiver of Damages. In no event shall Unicode or its licensors be -liable for any special, incidental, indirect or consequential damages of any -kind, or any damages whatsoever, whether or not Unicode was advised of the -possibility of the damage, including, without limitation, those resulting from -the following: loss of use, data or profits, in connection with the use, -modification or distribution of this information or its derivatives. + liable for any special, incidental, indirect or consequential + damages of any kind, or any damages whatsoever, whether or not + Unicode was advised of the possibility of the damage, including, + without limitation, those resulting from the following: loss of use, + data or profits, in connection with the use, modification or + distribution of this information or its derivatives. 5. Trademarks. 1. Unicode and the Unicode logo are registered trademarks of -Unicode, Inc. - 2. This site contains product names and corporate names of other -companies. All product names and company names and logos mentioned herein are -the trademarks or registered trademarks of their respective owners. Other -products and corporate names mentioned herein which are trademarks of a third -party are used only for explanation and for the owners' benefit and with no -intent to infringe. - 3. Use of third party products or information referred to herein is -at the user’s risk. + Unicode, Inc. + 2. This site contains product names and corporate names of + other companies. All product names and company names and logos + mentioned herein are the trademarks or registered trademarks + of their respective owners. Other products and corporate names + mentioned herein which are trademarks of a third party are + used only for explanation and for the owners' benefit and with + no intent to infringe. + 3. Use of third party products or information referred to + herein is at the user's risk. 6. Miscellaneous. - 1. Jurisdiction and Venue. This server is operated from a location -in the State of California, United States of America. Unicode makes no -representation that the materials are appropriate for use in other locations. If -you access this server from other locations, you are responsible for compliance -with local laws. This Agreement, all use of this site and any claims and damages -resulting from use of this site are governed solely by the laws of the State of -California without regard to any principles which would apply the laws of a -different jurisdiction. The user agrees that any disputes regarding this site -shall be resolved solely in the courts located in Santa Clara County, -California. The user agrees said courts have personal jurisdiction and agree to -waive any right to transfer the dispute to any other forum. - 2. Modification by Unicode Unicode shall have the right to modify -this Agreement at any time by posting it to this site. The user may not assign -any part of this Agreement without Unicode’s prior written consent. - 3. Taxes. The user agrees to pay any taxes arising from access to -this website or use of the information herein, except for those based on -Unicode’s net income. - 4. Severability. If any provision of this Agreement is declared -invalid or unenforceable, the remaining provisions of this Agreement shall -remain in effect. + 1. Jurisdiction and Venue. This server is operated from a + location in the State of California, United States of America. + Unicode makes no representation that the materials are + appropriate for use in other locations. If you access this + server from other locations, you are responsible for + compliance with local laws. This Agreement, all use of this + site and any claims and damages resulting from use of this + site are governed solely by the laws of the State of + California without regard to any principles which would apply + the laws of a different jurisdiction. The user agrees that any + disputes regarding this site shall be resolved solely in the + courts located in Santa Clara County, California. The user + agrees said courts have personal jurisdiction and agree to + waive any right to transfer the dispute to any other forum. + 2. Modification by Unicode Unicode shall have the right to + modify this Agreement at any time by posting it to this site. + The user may not assign any part of this Agreement without + Unicode's prior written consent. + 3. Taxes. The user agrees to pay any taxes arising from access + to this website or use of the information herein, except for + those based on Unicode's net income. + 4. Severability. If any provision of this Agreement is + declared invalid or unenforceable, the remaining provisions of + this Agreement shall remain in effect. 5. Entire Agreement. This Agreement constitutes the entire -agreement between the parties. + agreement between the parties. EXHIBIT 1 UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE @@ -1666,7 +1619,7 @@ OR SOFTWARE. COPYRIGHT AND PERMISSION NOTICE - Copyright © 1991-2008 Unicode, Inc. All rights reserved. Distributed under + Copyright (c) 1991-2008 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -2265,7 +2218,7 @@ http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee /* IEEE Standard 695-1980 "Universal Format for Object Modules" -header file + header file Contributed by Cygnus Support. */ *************************************************************************** @@ -2295,8 +2248,7 @@ Use of any of this software is governed by the terms of the license below: You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -********************************************************************** \ No newline at end of file +********************************************************************** From 95c5092f490334dea3312a9d2e651b9a7fcd3737 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 24 Nov 2010 16:32:15 +0300 Subject: [PATCH 24/32] Mark a couple of tests experimental. --- mysql-test/collections/default.experimental | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 2ddf87485ad..82f41d46dc2 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -16,6 +16,7 @@ main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_m main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again) main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) +main.show_check # Bug#58414 2010-11-24 alik Race condition in show_check.test main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server @@ -26,6 +27,7 @@ rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails spora rpl.rpl_innodb_bug28430* # Bug#46029 sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10 sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails From a92cc88aa537bc1a3264c3681d2407e54a9dba74 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 24 Nov 2010 17:52:57 +0300 Subject: [PATCH 25/32] Bug#55980 Character sets: supplementary character _bin ordering is wrong Post-fix: Reverting the "utf16_bin did not sort supplementary characters between U+D700 and U+E000" part. We'll use code-point order. Committing on behalf of Alexander Barkov. --- mysql-test/r/ctype_utf16.result | 4 ++-- strings/ctype-ucs2.c | 4 ++-- strings/ctype-utf8.c | 11 ----------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 7cee15aecef..beafbf80e1e 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -625,16 +625,16 @@ INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; HEX(a) HEX(CONVERT(a USING utf8mb4)) 0385 CE85 +FF9D EFBE9D D800DF84 F0908E84 DBC0DC00 F4808080 -FF9D EFBE9D ALTER TABLE t1 ADD KEY(a); SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a; HEX(a) HEX(CONVERT(a USING utf8mb4)) 0385 CE85 +FF9D EFBE9D D800DF84 F0908E84 DBC0DC00 F4808080 -FF9D EFBE9D DROP TABLE IF EXISTS t1; select @@collation_connection; @@collation_connection diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 09652c5884e..85d391d0c70 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1463,7 +1463,7 @@ my_strnncoll_utf16_bin(CHARSET_INFO *cs, } if (s_wc != t_wc) { - return my_bincmp(s, s + s_res, t, t + t_res); + return s_wc > t_wc ? 1 : -1; } s+= s_res; @@ -1503,7 +1503,7 @@ my_strnncollsp_utf16_bin(CHARSET_INFO *cs, if (s_wc != t_wc) { - return my_bincmp(s, s + s_res, t, t + t_res); + return s_wc > t_wc ? 1 : -1; } s+= s_res; diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 76fff72290b..324f6b9aafb 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1967,17 +1967,6 @@ my_strnxfrm_unicode_full_bin(CHARSET_INFO *cs, if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) break; src+= res; - if (cs->mbminlen == 2) /* utf16_bin */ - { - /* - Reorder code points to weights as follows: - U+0000..U+D7FF -> [00][00][00]..[00][D7][FF] BMP part #1 - U+10000..U+10FFFF -> [01][00][00]..[10][FF][FF] Supplementary - U+E000..U+FFFF -> [20][E0][00]..[20][FF][FF] BMP part #2 - */ - if (wc >= 0xE000 && wc <= 0xFFFF) - wc+= 0x200000; - } *dst++= (uchar) (wc >> 16); *dst++= (uchar) ((wc >> 8) & 0xFF); *dst++= (uchar) (wc & 0xFF); From efb1f6407361ba7978aa092cfea102b700359333 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 24 Nov 2010 18:08:27 +0300 Subject: [PATCH 26/32] Bug#45445: cannot execute procedures with thread_stack set to 128k. Reverting the patch. --- sql/sp.cc | 6 ------ sql/sp_head.cc | 11 ++++------- sql/sql_parse.cc | 3 --- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index 5d424564317..71a5afb437c 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -779,9 +779,6 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, int ret= 0; - if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&ret)) - return TRUE; - thd->lex= &newlex; newlex.current_select= NULL; @@ -1611,9 +1608,6 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, (int) name->m_name.length, name->m_name.str, type, cache_only)); - if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&depth)) - return NULL; - if ((sp= sp_cache_lookup(cp, name))) { ulong level; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 2f165310c28..54e32b67c65 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1240,8 +1240,11 @@ sp_head::execute(THD *thd, bool merge_da_on_success) The same with db_load_routine() required circa 7k bytes and 14k bytes accordingly. Hence, here we book the stack with some reasonable margin. + + Reverting back to 8 * STACK_MIN_SIZE until further fix. + 8 * STACK_MIN_SIZE is required on some exotic platforms. */ - if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&old_packet)) + if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); /* init per-instruction memroot */ @@ -2915,9 +2918,6 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, It's merged with the saved parent's value at the exit of this func. */ bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table; - if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&parent_modified_non_trans_table)) - DBUG_RETURN(TRUE); - thd->transaction.stmt.modified_non_trans_table= FALSE; DBUG_ASSERT(!thd->derived_tables); DBUG_ASSERT(thd->change_list.is_empty()); @@ -3073,9 +3073,6 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) DBUG_ENTER("sp_instr_stmt::execute"); DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command())); - if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res)) - DBUG_RETURN(TRUE); - const CSET_STRING query_backup= thd->query_string; #if defined(ENABLED_PROFILING) /* This s-p instr is profilable and will be captured. */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 40cecb75b69..cb641b5ff68 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7209,9 +7209,6 @@ bool parse_sql(THD *thd, Object_creation_ctx *backup_ctx= NULL; - if (check_stack_overrun(thd, 2 * STACK_MIN_SIZE, (uchar*)&backup_ctx)) - return TRUE; - if (creation_ctx) backup_ctx= creation_ctx->set_n_backup(thd); From a3d073d2cf755d48277bf6d41ed36b0083b6257f Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Wed, 24 Nov 2010 18:55:23 +0300 Subject: [PATCH 27/32] - Fix changelog (remove duplicated entry) - Mark main.gis experimental --- mysql-test/collections/default.experimental | 1 + support-files/mysql.spec.sh | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 82f41d46dc2..818691e2e73 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -9,6 +9,7 @@ funcs_1.myisam_views @solaris # Bug#50595 2010-03-05 alik funcs_1.myi innodb.innodb_information_schema # Bug#48883 2010-05-11 alik Test "innodb_information_schema" takes fewer locks than expected main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2 +main.gis # Bug#52208 2010-11-24 alik gis fails on some platforms (Solaris, HP-UX, Linux) main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index d3031b66f3b..aa861609a5f 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1106,10 +1106,6 @@ echo "=====" >> $STATUS_HISTORY - Add a "triggerpostun" to handle the uninstall of the "-community" server RPM. - This fixes bug#55015 "MySQL server is not restarted properly after RPM upgrade". -* Wed Nov 24 2010 Alexander Nozdrin - -- EXCEPTIONS-CLIENT has been deleted, remove it from here too. - * Tue Jun 15 2010 Joerg Bruehe - Change the behaviour on installation and upgrade: From f2d0f9c5f84b4a3c9a2bf80afdf000f1cc7fc22c Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Wed, 24 Nov 2010 23:34:00 +0000 Subject: [PATCH 28/32] Support alternate license file. --- packaging/WiX/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt index 052887f10a1..4048273fc03 100644 --- a/packaging/WiX/CMakeLists.txt +++ b/packaging/WiX/CMakeLists.txt @@ -63,7 +63,12 @@ FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR}) IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") ELSE() - FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS) + IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql") + SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql") + ELSE() + SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING") + ENDIF() + FILE(READ ${LICENSE_FILE} CONTENTS) STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}") STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}") FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15") From ddbcb7b5c4c9ea0dbac946eac5df82cb14dcbd01 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 25 Nov 2010 00:21:28 +0000 Subject: [PATCH 29/32] Fix the .deb package prefix. --- cmake/install_layout.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 19a8a61df2d..601e208d96d 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -26,7 +26,7 @@ # Build as per default RPM layout, with prefix=/usr # # DEB -# Build as per STANDALONE, prefix=/opt/mysql-$major.$minor +# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor # # SVR4 # Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql @@ -74,7 +74,7 @@ IF(UNIX) IF(INSTALL_LAYOUT MATCHES "RPM") SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "DEB") - SET(default_prefix "/opt/${MYSQL_BASE_VERSION}") + SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}") # This is required to avoid "cpack -GDEB" default of prefix=/usr SET(CPACK_SET_DESTDIR ON) ELSEIF(INSTALL_LAYOUT MATCHES "SVR4") From e3cbf205547e4b8e34438ab7413af409a6873731 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 26 Nov 2010 16:07:07 +0100 Subject: [PATCH 30/32] Cherrypicked http://lists.mysql.com/commits/124935 MSI: Only call custom action if REMOVE=ALL is specified, this avoids accidential removing services if feature states are modified (reported by Iggy) --- packaging/WiX/mysql_server.wxs.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index ea2ee1d9aaf..43a30538384 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -128,10 +128,10 @@ Impersonate="no" Return="check" /> - Installed And Not UPGRADINGPRODUCTCODE - Installed And Not UPGRADINGPRODUCTCODE - Installed And Not UPGRADINGPRODUCTCODE And UILevel>4 - Installed And Not UPGRADINGPRODUCTCODE And UILevel<=4 + Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" + Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" + Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel>4 + Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel<=4 From a186085a077c3f22827496a86c4029c8fd1384af Mon Sep 17 00:00:00 2001 From: Jon Olav Hauglid Date: Tue, 30 Nov 2010 18:52:38 +0100 Subject: [PATCH 31/32] Bug #58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8 The problem was that mysql_upgrade failed because DROP DATABASE refused to drop the 'performance_schema' database when the mysql.proc table definition was made temporarily invalid by dump import. This patch fixes the problem by adding the error resulting from opening a damaged mysq.proc table (ER_CANNOT_LOAD_FROM_TABLE), to the list of errors DROP DATABASE will ignore when trying to lock stored procedures and functions before deletion. This problem was a regression introduced by the patch for Bug#57663. Test case added to sp-destruct.test. --- mysql-test/r/sp-destruct.result | 18 ++++++++++++++++++ mysql-test/t/sp-destruct.test | 27 +++++++++++++++++++++++++++ sql/sp.cc | 2 ++ 3 files changed, 47 insertions(+) diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 32d0e39c5af..a3c8574d141 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -150,3 +150,21 @@ Warnings: Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted # Restore mysql.proc. drop table mysql.proc; +# +# Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8 +# +DROP TABLE IF EXISTS proc_backup; +DROP DATABASE IF EXISTS db1; +# Backup the proc table +RENAME TABLE mysql.proc TO proc_backup; +CREATE TABLE mysql.proc LIKE proc_backup; +CREATE DATABASE db1; +CREATE PROCEDURE db1.p1() SET @foo = 10; +# Modify a field of the table. +ALTER TABLE mysql.proc MODIFY comment CHAR (32); +DROP DATABASE db1; +Warnings: +Error 1548 Cannot load from mysql.proc. The table is probably corrupted +# Restore mysql.proc +DROP TABLE mysql.proc; +RENAME TABLE proc_backup TO mysql.proc; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index a5c287e44a8..b4aa9ea1959 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -252,3 +252,30 @@ drop table mysql.proc; --remove_file $MYSQLTEST_VARDIR/tmp/proc.frm --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI + + +--echo # +--echo # Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8 +--echo # + +--disable_warnings +DROP TABLE IF EXISTS proc_backup; +DROP DATABASE IF EXISTS db1; +--enable_warnings + +--echo # Backup the proc table +RENAME TABLE mysql.proc TO proc_backup; +CREATE TABLE mysql.proc LIKE proc_backup; + +CREATE DATABASE db1; +CREATE PROCEDURE db1.p1() SET @foo = 10; + +--echo # Modify a field of the table. +ALTER TABLE mysql.proc MODIFY comment CHAR (32); + +# This should not fail even if mysql.proc is invalid. +DROP DATABASE db1; + +--echo # Restore mysql.proc +DROP TABLE mysql.proc; +RENAME TABLE proc_backup TO mysql.proc; diff --git a/sql/sp.cc b/sql/sp.cc index 71a5afb437c..ae11c2ad14c 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1372,6 +1372,8 @@ public: MYSQL_ERROR ** cond_hdl) { if (sql_errno == ER_NO_SUCH_TABLE || + sql_errno == ER_CANNOT_LOAD_FROM_TABLE || + sql_errno == ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE || sql_errno == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED) return true; return false; From 93efc7e2c4bc8cffa235f2406db3bdaf4180189d Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 3 Dec 2010 20:49:08 +0300 Subject: [PATCH 32/32] Fix for bug #58669: read_only not enforced on 5.5.x Problem: "read-only" option ignored if it's enabled in the command line (or in the config file). Fix: sync opt_readonly (which is used for checks) with read_only (global var) when all server options are handled. --- mysql-test/r/bug58669.result | 17 +++++++++++++++++ mysql-test/t/bug58669-master.opt | 1 + mysql-test/t/bug58669.test | 22 ++++++++++++++++++++++ sql/mysqld.cc | 5 ++++- sql/mysqld.h | 3 ++- sql/sys_vars.cc | 11 ++++++++++- 6 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/bug58669.result create mode 100644 mysql-test/t/bug58669-master.opt create mode 100644 mysql-test/t/bug58669.test diff --git a/mysql-test/r/bug58669.result b/mysql-test/r/bug58669.result new file mode 100644 index 00000000000..5504c5908be --- /dev/null +++ b/mysql-test/r/bug58669.result @@ -0,0 +1,17 @@ +# +# Bug#58669: read_only not enforced on 5.5.x +# +CREATE USER user1@localhost; +CREATE DATABASE db1; +GRANT ALL PRIVILEGES ON db1.* TO user1@localhost; +CREATE TABLE db1.t1(a INT); +SELECT CURRENT_USER(); +CURRENT_USER() +user1@localhost +SHOW VARIABLES LIKE "%read_only%"; +Variable_name Value +read_only ON +INSERT INTO db1.t1 VALUES (1); +ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement +DROP DATABASE db1; +DROP USER user1@localhost; diff --git a/mysql-test/t/bug58669-master.opt b/mysql-test/t/bug58669-master.opt new file mode 100644 index 00000000000..6d909680527 --- /dev/null +++ b/mysql-test/t/bug58669-master.opt @@ -0,0 +1 @@ +--read-only diff --git a/mysql-test/t/bug58669.test b/mysql-test/t/bug58669.test new file mode 100644 index 00000000000..332c104cfea --- /dev/null +++ b/mysql-test/t/bug58669.test @@ -0,0 +1,22 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug#58669: read_only not enforced on 5.5.x +--echo # + +CREATE USER user1@localhost; +CREATE DATABASE db1; +GRANT ALL PRIVILEGES ON db1.* TO user1@localhost; +CREATE TABLE db1.t1(a INT); + +connect (con1,localhost,user1,,); +connection con1; +SELECT CURRENT_USER(); +SHOW VARIABLES LIKE "%read_only%"; +--error ER_OPTION_PREVENTS_STATEMENT +INSERT INTO db1.t1 VALUES (1); + +connection default; +disconnect con1; +DROP DATABASE db1; +DROP USER user1@localhost; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7fec30520d0..09c17d600a8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -410,7 +410,8 @@ handlerton *heap_hton; handlerton *myisam_hton; handlerton *partition_hton; -my_bool opt_readonly= 0, use_temp_pool, relay_log_purge; +my_bool read_only= 0, opt_readonly= 0; +my_bool use_temp_pool, relay_log_purge; my_bool relay_log_recovery; my_bool opt_sync_frm, opt_allow_suspicious_udfs; my_bool opt_secure_auth= 0; @@ -7342,6 +7343,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) test(global_system_variables.optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); + opt_readonly= read_only; + return 0; } diff --git a/sql/mysqld.h b/sql/mysqld.h index 376d8440619..7fe4dc7258a 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -107,7 +107,8 @@ extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern ulong slave_exec_mode_options; extern ulonglong slave_type_conversions_options; -extern my_bool opt_readonly, lower_case_file_system; +extern my_bool read_only, opt_readonly; +extern my_bool lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_secure_auth; extern char* opt_secure_file_priv; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 5c9df82ddac..9ca97b5dded 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1436,7 +1436,6 @@ static Sys_var_ulong Sys_read_buff_size( VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024), BLOCK_SIZE(IO_SIZE)); -static my_bool read_only; static bool check_read_only(sys_var *self, THD *thd, set_var *var) { /* Prevent self dead-lock */ @@ -1520,6 +1519,16 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type) read_only= opt_readonly; DBUG_RETURN(result); } + + +/** + The read_only boolean is always equal to the opt_readonly boolean except + during fix_read_only(); when that function is entered, opt_readonly is + the pre-update value and read_only is the post-update value. + fix_read_only() compares them and runs needed operations for the + transition (especially when transitioning from false to true) and + synchronizes both booleans in the end. +*/ static Sys_var_mybool Sys_readonly( "read_only", "Make all non-temporary tables read-only, with the exception for "