List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:September 27 2011 9:28am
Subject:bzr push into mysql-trunk branch (magnus.blaudd:3435)
View as plain text  
 3435 magnus.blaudd@stripped	2011-09-27 [merge]
      Merge

    added:
      storage/ndb/compile-cluster
=== modified file 'client/mysql_plugin.c'
--- a/client/mysql_plugin.c	2011-08-11 16:48:00 +0000
+++ b/client/mysql_plugin.c	2011-09-23 10:55:10 +0000
@@ -846,12 +846,19 @@ static int process_options(int argc, cha
   {
     i= (int)strlength(opt_basedir);
     if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
+    {
+      char buff[FN_REFLEN];
+      
+      strncpy(buff, opt_basedir, sizeof(buff) - 1);
 #ifdef __WIN__
-      if (opt_basedir[i-1] != '/')
-        strcat(opt_basedir, "//");
+      strncat(buff, "/", sizeof(buff) - strlen(buff) - 1);
 #else
-      strcat(opt_basedir, FN_DIRSEP);
+      strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1);
 #endif
+      buff[sizeof(buff) - 1]= 0;
+      my_delete(opt_basedir, MYF(0));
+      opt_basedir= my_strdup(buff, MYF(MY_FAE));
+    }
   }
   
   /*
@@ -1157,10 +1164,13 @@ static int bootstrap_server(char *server
 
 #ifdef __WIN__
   char *format_str= 0;
-  char *verbose_str= "";
+  const char *verbose_str= NULL;
+   
   
   if (opt_verbose)
-    strcat(verbose_str, "--console");
+    verbose_str= "--console";
+  else
+    verbose_str= "";
   if (has_spaces(opt_datadir) || has_spaces(opt_basedir) ||
       has_spaces(bootstrap_file))
     format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s < %s\"";

=== modified file 'cmake/plugin.cmake'
--- a/cmake/plugin.cmake	2011-06-10 14:12:38 +0000
+++ b/cmake/plugin.cmake	2011-09-21 11:01:41 +0000
@@ -196,6 +196,10 @@ MACRO(MYSQL_ADD_PLUGIN)
     # Install dynamic library
     MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
     INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
+    # Add installed files to list for RPMs
+    FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files
+            "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n"
+            "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n")
     # For internal testing in PB2, append collections files
     IF(DEFINED ENV{PB2WORKDIR})
       PLUGIN_APPEND_COLLECTIONS(${plugin})

=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2011-07-19 15:11:15 +0000
+++ b/include/mysql/plugin.h	2011-09-21 11:01:41 +0000
@@ -73,7 +73,7 @@ typedef struct st_mysql_xid MYSQL_XID;
   Plugin API. Common for all plugin types.
 */
 
-#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102
+#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
 
 /*
   The allowable types of plugins
@@ -122,7 +122,7 @@ __MYSQL_DECLARE_PLUGIN(NAME, \
                  builtin_ ## NAME ## _sizeof_struct_st_plugin, \
                  builtin_ ## NAME ## _plugin)
 
-#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
+#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}}
 
 /**
   declarations for SHOW STATUS support in plugins
@@ -149,6 +149,14 @@ typedef int (*mysql_show_var_func)(MYSQL
 
 
 /*
+  Constants for plugin flags.
+ */
+
+#define PLUGIN_OPT_NO_INSTALL   1UL   /* Not dynamically loadable */
+#define PLUGIN_OPT_NO_UNINSTALL 2UL   /* Not dynamically unloadable */
+
+
+/*
   declarations for server variables and command line options
 */
 
@@ -420,6 +428,7 @@ struct st_mysql_plugin
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;
   void * __reserved1;   /* reserved for dependency checking             */
+  unsigned long flags;  /* flags for plugin */
 };
 
 /*************************************************************************

=== modified file 'include/mysql/plugin_audit.h.pp'
--- a/include/mysql/plugin_audit.h.pp	2011-07-19 15:11:15 +0000
+++ b/include/mysql/plugin_audit.h.pp	2011-09-21 11:01:41 +0000
@@ -118,6 +118,7 @@ struct st_mysql_plugin
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;
   void * __reserved1;
+  unsigned long flags;
 };
 #include "plugin_ftparser.h"
 #include "plugin.h"

=== modified file 'include/mysql/plugin_auth.h.pp'
--- a/include/mysql/plugin_auth.h.pp	2011-07-19 15:11:15 +0000
+++ b/include/mysql/plugin_auth.h.pp	2011-09-21 11:01:41 +0000
@@ -118,6 +118,7 @@ struct st_mysql_plugin
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;
   void * __reserved1;
+  unsigned long flags;
 };
 #include "plugin_ftparser.h"
 #include "plugin.h"

=== modified file 'include/mysql/plugin_ftparser.h.pp'
--- a/include/mysql/plugin_ftparser.h.pp	2011-07-19 15:11:15 +0000
+++ b/include/mysql/plugin_ftparser.h.pp	2011-09-21 11:01:41 +0000
@@ -44,7 +44,7 @@ typedef enum _thd_wait_type_e {
   THD_WAIT_BINLOG= 8,
   THD_WAIT_GROUP_COMMIT= 9,
   THD_WAIT_SYNC= 10,
-  THD_WAIT_LAST= 11 
+  THD_WAIT_LAST= 11
 } thd_wait_type;
 extern struct thd_wait_service_st {
   void (*thd_wait_begin_func)(void*, int);
@@ -118,6 +118,7 @@ struct st_mysql_plugin
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;
   void * __reserved1;
+  unsigned long flags;
 };
 #include "plugin_ftparser.h"
 struct st_mysql_daemon

=== modified file 'libmysql/authentication_win/common.cc'
--- a/libmysql/authentication_win/common.cc	2011-04-29 21:53:46 +0000
+++ b/libmysql/authentication_win/common.cc	2011-09-21 11:01:41 +0000
@@ -22,6 +22,24 @@ template <> void error_log_print<error_l
 template <> void error_log_print<error_log_level::WARNING>(const char *fmt, ...);
 template <> void error_log_print<error_log_level::ERROR>(const char *fmt, ...);
 
+/**
+  Option indicating desired level of logging. Values:
+
+  0 - no logging
+  1 - log only error messages
+  2 - additionally log warnings
+  3 - additionally log info notes
+  4 - also log debug messages
+
+  Value of this option should be taken into account in the 
+  implementation of  error_log_vprint() function (see 
+  log_client.cc).
+
+  Note: No error or debug messages are logged in production code
+  (see logging macros in common.h).
+*/
+int opt_auth_win_log_level= 2;
+
 
 /** Connection class **************************************************/
 

=== modified file 'libmysql/authentication_win/common.h'
--- a/libmysql/authentication_win/common.h	2011-04-29 21:53:46 +0000
+++ b/libmysql/authentication_win/common.h	2011-09-21 11:01:41 +0000
@@ -41,13 +41,15 @@ struct error_log_level
   typedef enum {INFO, WARNING, ERROR}  type;
 };
 
+extern "C" int opt_auth_win_log_level;
+unsigned int  get_log_level(void);
+void          set_log_level(unsigned int);
+
 
 /*
   If DEBUG_ERROR_LOG is defined then error logging happens only
   in debug-copiled code. Otherwise ERROR_LOG() expands to 
-  error_log_print() even in production code. Note that in client
-  plugin, error_log_print() will print nothing if opt_auth_win_clinet_log
-  is 0.
+  error_log_print() even in production code.
 
   Note: Macro ERROR_LOG() can use printf-like format string like this:
 
@@ -57,8 +59,6 @@ struct error_log_level
   to fprintf() (see error_log_vprint() function).
 */
 
-extern "C" int opt_auth_win_client_log;
-
 #if defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF)
 #define ERROR_LOG(Level, Msg)     do {} while (0)
 #else
@@ -67,7 +67,7 @@ extern "C" int opt_auth_win_client_log;
 
 
 void error_log_vprint(error_log_level::type level,
-                        const char *fmt, va_list args);
+                      const char *fmt, va_list args);
 
 template <error_log_level::type Level>
 void error_log_print(const char *fmt, ...)
@@ -96,7 +96,7 @@ const char* get_last_error_message(Error
 
 #define DBUG_PRINT_DO(Keyword, Msg) \
   do { \
-    if (2 > opt_auth_win_client_log) break; \
+    if (4 > get_log_level()) break; \
     fprintf(stderr, "winauth: %s: ", Keyword); \
     debug_msg Msg; \
   } while (0)

=== modified file 'libmysql/authentication_win/handshake_client.cc'
--- a/libmysql/authentication_win/handshake_client.cc	2011-04-29 21:53:46 +0000
+++ b/libmysql/authentication_win/handshake_client.cc	2011-09-21 11:01:41 +0000
@@ -323,13 +323,13 @@ int win_auth_handshake_client(MYSQL_PLUG
     int opt_val= opt ? atoi(opt) : 0;
     if (opt && !opt_val)
     {
-      if (!strncasecmp("on", opt, 2))    opt_val= 1;
-      if (!strncasecmp("yes", opt, 3))   opt_val= 1;
-      if (!strncasecmp("true", opt, 4))  opt_val= 1;
-      if (!strncasecmp("debug", opt, 5)) opt_val= 2;
-      if (!strncasecmp("dbug", opt, 4))  opt_val= 2;
+      if (!strncasecmp("on", opt, 2))    opt_val= 2;
+      if (!strncasecmp("yes", opt, 3))   opt_val= 2;
+      if (!strncasecmp("true", opt, 4))  opt_val= 2;
+      if (!strncasecmp("debug", opt, 5)) opt_val= 4;
+      if (!strncasecmp("dbug", opt, 4))  opt_val= 4;
     }
-    opt_auth_win_client_log= opt_val;
+    set_log_level(opt_val);
   }
 
   ERROR_LOG(INFO, ("Authentication handshake for account %s", mysql->user));

=== modified file 'libmysql/authentication_win/log_client.cc'
--- a/libmysql/authentication_win/log_client.cc	2011-04-29 21:53:46 +0000
+++ b/libmysql/authentication_win/log_client.cc	2011-09-21 11:01:41 +0000
@@ -16,36 +16,32 @@
 #include <my_global.h>
 #include "common.h"
 
-/**
-  This option is set in win_auth_handshake_client() function 
-  in handshake_client.cc.
-
-  Values:
-  0 - no logging
-  1 - log error/warning/info messages
-  2 - also log debug messages
-
-  Note: No error or debug messages are logged in production code
-  (see logging macros in common.h).
-*/
-int opt_auth_win_client_log= 0;
-
 
 // Client-side logging function
 
 void error_log_vprint(error_log_level::type level,
                         const char *fmt, va_list args)
 {
-  if (0 == opt_auth_win_client_log)
-    return;
-
   const char *level_string= "";
+  int   log_level= get_log_level();
 
   switch (level)
   {
-  case error_log_level::INFO:    level_string= "Note"; break;
-  case error_log_level::WARNING: level_string= "Warning"; break;
-  case error_log_level::ERROR:   level_string= "ERROR"; break;
+  case error_log_level::INFO:    
+    if (3 > log_level)
+      return;
+    level_string= "Note"; 
+    break;
+  case error_log_level::WARNING: 
+    if (2 > log_level)
+      return;
+    level_string= "Warning"; 
+    break;
+  case error_log_level::ERROR:   
+    if (1 > log_level)
+      return;
+    level_string= "ERROR";
+    break;
   }
 
   fprintf(stderr, "Windows Authentication Plugin %s: ", level_string);
@@ -53,3 +49,17 @@ void error_log_vprint(error_log_level::t
   fputc('\n', stderr);
   fflush(stderr);
 }
+
+
+// Trivial implementation of log-level setting storage.
+
+void set_log_level(unsigned int level)
+{
+  opt_auth_win_log_level= level;
+}
+
+
+unsigned int  get_log_level(void)
+{
+  return opt_auth_win_log_level;
+}

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-09-14 11:23:46 +0000
+++ b/mysql-test/collections/default.experimental	2011-09-23 19:06:36 +0000
@@ -27,7 +27,6 @@ rpl.rpl_change_master_dbug              
 rpl.rpl_delayed_slave                    # BUG#11764654 rpl_delayed_slave fails sporadically in pb
 rpl.rpl_heartbeat_basic                  # BUG#12403008 2011-04-27 sven fails sporadically
 rpl.rpl_innodb_bug28430                  # Bug#11754425
-rpl.rpl_row_ignorable_event              # Sven: BUG#12765441
 rpl.rpl_row_sp011  @solaris              # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 rpl.rpl_seconds_behind_master            # BUG#11765124 2010-11-24 luis fails sporadically on pb2
 rpl.rpl_show_slave_running               # BUG#12346048 2011-04-11 sven fails sporadically on pb2

=== modified file 'mysql-test/include/order_by.inc'
--- a/mysql-test/include/order_by.inc	2011-03-30 13:33:29 +0000
+++ b/mysql-test/include/order_by.inc	2011-09-21 11:01:41 +0000
@@ -1706,6 +1706,13 @@ SELECT DISTINCT a,1 FROM t1 WHERE a <> 1
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11765255 58201:
+--echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+--echo #
+
+select 1 order by max(1) + min(1);
+
 --echo End of 5.1 tests
 
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-08-30 10:49:24 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-09-23 10:55:10 +0000
@@ -452,8 +452,9 @@ sub main {
   #
   read_plugin_defs("include/plugin.defs");
 
-  # Also read from any plugin local plugin.defs
-  for (glob "$basedir/plugin/*/tests/mtr/plugin.defs") {
+  # Also read from any plugin local or suite specific plugin.defs
+  for (glob "$basedir/plugin/*/tests/mtr/plugin.defs".
+            " suite/*/plugin.defs") {
     read_plugin_defs($_);
   }
 

=== modified file 'mysql-test/r/ctype_errors.result'
--- a/mysql-test/r/ctype_errors.result	2010-08-30 06:38:09 +0000
+++ b/mysql-test/r/ctype_errors.result	2011-09-21 11:01:41 +0000
@@ -29,4 +29,14 @@ SET lc_messages=cs_CZ;
 SET NAMES UTF8;
 USE nonexistant;
 ERROR 42000: Nezn-Bámá databáze 'nonexistant'
-End of 5.4 tests
+#
+# Bug#12736295: Buffer overflow for variable converted_err
+#               with non-latin1 server error message
+#
+# Connection con1
+SET lc_messages=ru_RU;
+SET NAMES latin1;
+SELECT '01234567890123456789012345678901234\';
+ERROR 42000: \0423 \0432\0430\0441 \043E\0448\0438\0431\043A\0430 \0432 \0437\0430\043F\0440\043E\0441\0435. \0418\0437\0443\0447\0438\0442\0435 \0434\043E\043A\0443\043C\0435\043D\0442\0430\0446\0438\044E \043F\043E \0438\0441\043F\043E\043B\044C\0437\0443\0435\043C\043E\0439 \0432\0435\0440\0441\0438\0438 MySQL \043D\0430 \043F\0440\0435\0434\043C\0435\0442 \043A\043E\0440\0440\0435\043A\0442\043D\043E\0433\043E \0441\0438\043D\0442\0430\043A\0441\0438\0441\0430 \043E\043A\043E\043B\043E ''012345678901234567890123456
+# Connection default
+End of 5.5 tests

=== modified file 'mysql-test/r/ctype_utf32_uca.result'
--- a/mysql-test/r/ctype_utf32_uca.result	2010-11-26 11:36:39 +0000
+++ b/mysql-test/r/ctype_utf32_uca.result	2011-09-21 11:01:41 +0000
@@ -2887,6 +2887,26 @@ HEX(s1)
 00000061
 DROP TABLE t1;
 #
+# Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN 
+#   MY_UCA_CHARCMP WITH UTF32
+#
+SET collation_connection=utf32_unicode_ci;
+CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
+INSERT INTO t1 VALUES ('a'), ('b');
+CREATE TABLE t2 (b VARBINARY(5) NOT NULL);
+#insert chars outside of BMP
+INSERT INTO t2 VALUEs (0x082837),(0x082837);
+#test for read-out-of-bounds with non-BMP chars as a LIKE pattern
+SELECT * FROM t1,t2 WHERE a LIKE b;
+a	b
+#test the original statement
+SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
+RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;
+1
+1
+1
+DROP TABLE t1,t2;
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/order_by_all.result'
--- a/mysql-test/r/order_by_all.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/order_by_all.result	2011-09-21 11:01:41 +0000
@@ -2550,6 +2550,13 @@ a	1
 3	1
 2	1
 DROP TABLE t1;
+#
+# Bug#11765255 58201:
+# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+#
+select 1 order by max(1) + min(1);
+1
+1
 End of 5.1 tests
 #
 # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY

=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result	2011-09-23 12:22:58 +0000
@@ -2550,6 +2550,13 @@ a	1
 3	1
 2	1
 DROP TABLE t1;
+#
+# Bug#11765255 58201:
+# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+#
+select 1 order by max(1) + min(1);
+1
+1
 End of 5.1 tests
 #
 # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY

=== modified file 'mysql-test/r/order_by_none.result'
--- a/mysql-test/r/order_by_none.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/order_by_none.result	2011-09-23 12:22:58 +0000
@@ -2549,6 +2549,13 @@ a	1
 3	1
 2	1
 DROP TABLE t1;
+#
+# Bug#11765255 58201:
+# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+#
+select 1 order by max(1) + min(1);
+1
+1
 End of 5.1 tests
 #
 # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2011-08-19 13:21:02 +0000
+++ b/mysql-test/r/plugin_auth.result	2011-09-26 10:34:49 +0000
@@ -49,7 +49,7 @@ ERROR 28000: Access denied for user 'plu
 ## test correct default plugin
 select USER(),CURRENT_USER();
 USER()	CURRENT_USER()
-plug@localhost	plug@%
+plug@localhost	plug_dest@%
 ## test no_auto_create_user sql mode with plugin users
 SET @@sql_mode=no_auto_create_user;
 GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
@@ -486,9 +486,27 @@ DROP USER bug12610784@localhost;
 #
 # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN 
 #  .-> USING PASSWORD: NO 
-#
 # shoud contain "using password=yes"
 ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password: YES)
 # shoud contain "using password=no"
 ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password: NO)
+# Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM 
+#   AUTHENTICATION SETTINGS
+#
+CREATE USER bug12818542@localhost 
+IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
+CREATE USER bug12818542_dest@localhost 
+IDENTIFIED BY 'bug12818542_dest_passwd';
+GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+bug12818542@localhost	bug12818542_dest@localhost
+SET PASSWORD = PASSWORD('bruhaha');
+Warnings:
+Note	1699	SET PASSWORD has no significance for users authenticating via plugins
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+bug12818542@localhost	bug12818542_dest@localhost
+DROP USER bug12818542@localhost;
+DROP USER bug12818542_dest@localhost;
 End of 5.5 tests

=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2011-07-28 08:31:36 +0000
+++ b/mysql-test/r/sp-error.result	2011-09-21 11:01:41 +0000
@@ -1707,6 +1707,22 @@ ERROR HY000: View 'test.v1' references i
 DROP PROCEDURE p1;
 DROP VIEW v1;
 DROP TABLE t1;
+#
+# Bug#12428824 - PARSER STACK OVERFLOW AND CRASH IN SP_ADD_USED_ROUTINE
+#                WITH OBSCURE QUERY
+#
+SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
+ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
+CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
+ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
+SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
+ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
+ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
 End of 5.1 tests
 #
 # Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2011-08-02 08:14:26 +0000
+++ b/mysql-test/r/sp.result	2011-09-21 11:01:41 +0000
@@ -7026,6 +7026,21 @@ SET @@GLOBAL.init_connect= @old_init_con
 DROP PROCEDURE p2;
 DROP PROCEDURE p5;
 #
+# Bug#11840395 (formerly known as bug#60347):
+# The string "versiondata" seems
+# to be 'leaking' into the schema name space
+#
+DROP DATABASE IF EXISTS mixedCaseDbName;
+CREATE DATABASE mixedCaseDbName;
+CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end|
+CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
+|
+call mixedCaseDbName.tryMyProc();
+select mixedCaseDbName.tryMyFunc();
+mixedCaseDbName.tryMyFunc()
+IT WORKS
+DROP DATABASE mixedCaseDbName;
+#
 # Bug#11766594  59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
 #
 CREATE TABLE t1 (a INT, b INT, KEY(b));

=== modified file 'mysql-test/r/type_float.result'
--- a/mysql-test/r/type_float.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/type_float.result	2011-07-18 08:27:05 +0000
@@ -431,4 +431,19 @@ SELECT f1 FROM t1;
 f1
 -1.79769313486231e308
 DROP TABLE t1;
+#
+# Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
+# 
+# Ignoring output from misc. float operations
+select format(-1.7976931348623157E+307,256) as foo;
+select least(-1.1111111111111111111111111,
+- group_concat(1.7976931348623157E+308)) as foo;
+select concat((truncate((-1.7976931348623157E+307),(0x1e))),
+(99999999999999999999999999999999999999999999999999999999999999999)) into @a;
 End of 5.0 tests
+#
+# Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
+#
+select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
+foo
+0

=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/union.result	2011-09-21 11:01:41 +0000
@@ -1643,6 +1643,63 @@ b
 1
 2
 DROP TABLE t1,t2;
+#
+# Bug#11765255 58201:
+# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+#
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+foo
+1
+prepare stmt1 from 'select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+';
+execute stmt1;
+foo
+1
+execute stmt1;
+foo
+1
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+foo
+1
+prepare stmt1 from 'select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+';
+execute stmt1;
+foo
+1
+execute stmt1;
+foo
+1
+deallocate prepare stmt1;
 End of 5.1 tests
 #
 # Bug#57986 ORDER BY clause is not used after a UNION, 

=== modified file 'mysql-test/t/ctype_errors.test'
--- a/mysql-test/t/ctype_errors.test	2009-10-15 12:23:43 +0000
+++ b/mysql-test/t/ctype_errors.test	2011-07-15 11:05:30 +0000
@@ -44,4 +44,19 @@ USE nonexistant;
 disconnect con1;
 connection default;
 
---echo End of 5.4 tests
+--echo #
+--echo # Bug#12736295: Buffer overflow for variable converted_err
+--echo #               with non-latin1 server error message
+--echo #
+
+connect (con1,localhost,root,,test);
+--echo # Connection con1
+SET lc_messages=ru_RU;
+SET NAMES latin1;
+--error ER_PARSE_ERROR
+--query SELECT '01234567890123456789012345678901234\'
+disconnect con1;
+--echo # Connection default
+connection default;
+
+--echo End of 5.5 tests

=== modified file 'mysql-test/t/ctype_utf32_uca.test'
--- a/mysql-test/t/ctype_utf32_uca.test	2010-11-26 11:36:39 +0000
+++ b/mysql-test/t/ctype_utf32_uca.test	2011-09-21 11:01:41 +0000
@@ -148,6 +148,27 @@ SET collation_connection=utf32_czech_ci;
 --source include/ctype_czech.inc
 --source include/ctype_like_ignorable.inc
 
+--echo #
+--echo # Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN 
+--echo #   MY_UCA_CHARCMP WITH UTF32
+--echo #
+
+SET collation_connection=utf32_unicode_ci;
+CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
+INSERT INTO t1 VALUES ('a'), ('b');
+CREATE TABLE t2 (b VARBINARY(5) NOT NULL);
+
+--echo #insert chars outside of BMP
+INSERT INTO t2 VALUEs (0x082837),(0x082837);
+
+--echo #test for read-out-of-bounds with non-BMP chars as a LIKE pattern
+SELECT * FROM t1,t2 WHERE a LIKE b;
+
+--echo #test the original statement
+SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
+RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;
+
+DROP TABLE t1,t2;
 
 --echo #
 --echo # End of 5.5 tests

=== modified file 'mysql-test/t/mysql_plugin.test'
--- a/mysql-test/t/mysql_plugin.test	2011-08-12 10:49:38 +0000
+++ b/mysql-test/t/mysql_plugin.test	2011-09-23 10:55:10 +0000
@@ -224,6 +224,7 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n 
 --echo # Attempt to use bad paths - basedir
 --echo #
 let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN -n --datadir=$MYSQLD_DATADIR --basedir=/basedir_not_there/ --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
+replace_result "/basedir_not_there//" "/basedir_not_there/";
 --error 1,2,256
 --exec $MYSQL_PLUGIN_CMD DISABLE daemon_example 2>&1
 

=== modified file 'mysql-test/t/plugin_auth.test'
--- a/mysql-test/t/plugin_auth.test	2011-08-17 14:07:07 +0000
+++ b/mysql-test/t/plugin_auth.test	2011-09-26 10:34:49 +0000
@@ -540,11 +540,9 @@ connection default;
 disconnect b12610784;
 DROP USER bug12610784@localhost;
 
-
 --echo #
 --echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN 
 --echo #  .-> USING PASSWORD: NO 
---echo #
 
 --echo # shoud contain "using password=yes"
 --error 1
@@ -554,5 +552,33 @@ DROP USER bug12610784@localhost;
 --error 1
 --exec $MYSQL -uunknown 2>&1
 
+--echo # Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM 
+--echo #   AUTHENTICATION SETTINGS
+--echo #
+
+CREATE USER bug12818542@localhost 
+  IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
+CREATE USER bug12818542_dest@localhost 
+  IDENTIFIED BY 'bug12818542_dest_passwd';
+GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
+
+connect(bug12818542_con,localhost,bug12818542,bug12818542_dest);
+connection bug12818542_con;
+SELECT USER(),CURRENT_USER();
+
+SET PASSWORD = PASSWORD('bruhaha');
+
+connection default;
+disconnect bug12818542_con;
+
+connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest);
+connection bug12818542_con2;
+SELECT USER(),CURRENT_USER();
+
+connection default;
+disconnect bug12818542_con2;
+
+DROP USER bug12818542@localhost;
+DROP USER bug12818542_dest@localhost;
 
 --echo End of 5.5 tests

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2011-07-28 08:31:36 +0000
+++ b/mysql-test/t/sp-error.test	2011-09-21 11:01:41 +0000
@@ -2535,6 +2535,28 @@ DROP PROCEDURE p1;
 DROP VIEW v1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#12428824 - PARSER STACK OVERFLOW AND CRASH IN SP_ADD_USED_ROUTINE
+--echo #                WITH OBSCURE QUERY
+--echo #
+
+--error ER_TOO_LONG_IDENT
+SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+
+--error ER_TOO_LONG_IDENT
+CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
+
+--error ER_WRONG_DB_NAME
+SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
+
+--error ER_WRONG_DB_NAME
+CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
+
+--error ER_TOO_LONG_IDENT
+SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
+
+--error ER_TOO_LONG_IDENT
+CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2011-08-02 08:14:26 +0000
+++ b/mysql-test/t/sp.test	2011-09-21 11:01:41 +0000
@@ -8376,6 +8376,26 @@ SET @@GLOBAL.init_connect= @old_init_con
 DROP PROCEDURE p2;
 DROP PROCEDURE p5;
 
+
+--echo #
+--echo # Bug#11840395 (formerly known as bug#60347):
+--echo # The string "versiondata" seems
+--echo # to be 'leaking' into the schema name space
+--echo #
+--disable_warnings
+DROP DATABASE IF EXISTS mixedCaseDbName;
+--enable_warnings
+CREATE DATABASE mixedCaseDbName;
+DELIMITER |;
+CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end|
+CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
+|
+DELIMITER ;|
+call mixedCaseDbName.tryMyProc();
+select mixedCaseDbName.tryMyFunc();
+DROP DATABASE mixedCaseDbName;
+
+
 --echo #
 --echo # Bug#11766594  59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
 --echo #

=== modified file 'mysql-test/t/type_float.test'
--- a/mysql-test/t/type_float.test	2010-04-11 06:52:42 +0000
+++ b/mysql-test/t/type_float.test	2011-07-18 08:27:05 +0000
@@ -307,4 +307,27 @@ INSERT INTO t1 VALUES(-1.79769313486231e
 SELECT f1 FROM t1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
+--echo # 
+
+--echo # Ignoring output from misc. float operations
+--disable_result_log
+
+let $nine_65=
+99999999999999999999999999999999999999999999999999999999999999999;
+
+select format(-1.7976931348623157E+307,256) as foo;
+select least(-1.1111111111111111111111111,
+             - group_concat(1.7976931348623157E+308)) as foo;
+eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
+                   ($nine_65)) into @a;
+--enable_result_log
+
 --echo End of 5.0 tests
+
+--echo #
+--echo # Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
+--echo #
+
+select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;

=== modified file 'mysql-test/t/union.test'
--- a/mysql-test/t/union.test	2011-01-10 12:45:53 +0000
+++ b/mysql-test/t/union.test	2011-09-21 11:01:41 +0000
@@ -1117,6 +1117,47 @@ SELECT * FROM t2 UNION SELECT * FROM t2
 DROP TABLE t1,t2;
 
 
+--echo #
+--echo # Bug#11765255 58201:
+--echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
+--echo #
+
+let $my_stmt=
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+select 4
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+
+eval $my_stmt;
+
+eval prepare stmt1 from '$my_stmt';
+execute stmt1;
+execute stmt1;
+
+let $my_stmt=
+select 1 as foo
+union
+select 2
+union
+select 3
+union
+(select 4)
+order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
+;
+
+eval $my_stmt;
+
+eval prepare stmt1 from '$my_stmt';
+execute stmt1;
+execute stmt1;
+
+deallocate prepare stmt1;
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'plugin/audit_null/audit_null.c'
--- a/plugin/audit_null/audit_null.c	2011-07-12 06:50:18 +0000
+++ b/plugin/audit_null/audit_null.c	2011-09-21 11:01:41 +0000
@@ -205,7 +205,8 @@ mysql_declare_plugin(audit_null)
   0x0003,                     /* version                         */
   simple_status,              /* status variables                */
   NULL,                       /* system variables                */
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/auth/auth_socket.c'
--- a/plugin/auth/auth_socket.c	2011-06-30 15:46:53 +0000
+++ b/plugin/auth/auth_socket.c	2011-08-15 18:12:11 +0000
@@ -88,7 +88,8 @@ mysql_declare_plugin(socket_auth)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/auth/dialog.c'
--- a/plugin/auth/dialog.c	2010-10-27 15:12:17 +0000
+++ b/plugin/auth/dialog.c	2011-08-15 18:12:11 +0000
@@ -153,7 +153,8 @@ mysql_declare_plugin(dialog)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 },
 {
   MYSQL_AUTHENTICATION_PLUGIN,
@@ -167,7 +168,8 @@ mysql_declare_plugin(dialog)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/auth/qa_auth_interface.c'
--- a/plugin/auth/qa_auth_interface.c	2011-09-20 14:24:18 +0000
+++ b/plugin/auth/qa_auth_interface.c	2011-09-23 10:19:37 +0000
@@ -167,7 +167,8 @@ mysql_declare_plugin(test_plugin)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/auth/qa_auth_server.c'
--- a/plugin/auth/qa_auth_server.c	2010-10-20 14:56:09 +0000
+++ b/plugin/auth/qa_auth_server.c	2011-08-15 18:12:11 +0000
@@ -82,6 +82,7 @@ mysql_declare_plugin(test_plugin)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;

=== modified file 'plugin/auth/test_plugin.c'
--- a/plugin/auth/test_plugin.c	2011-06-30 15:50:45 +0000
+++ b/plugin/auth/test_plugin.c	2011-09-21 11:01:41 +0000
@@ -146,7 +146,8 @@ mysql_declare_plugin(test_plugin)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 },
 {
   MYSQL_AUTHENTICATION_PLUGIN,
@@ -160,7 +161,8 @@ mysql_declare_plugin(test_plugin)
   0x0100,
   NULL,
   NULL,
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/daemon_example/daemon_example.cc'
--- a/plugin/daemon_example/daemon_example.cc	2011-06-30 15:46:53 +0000
+++ b/plugin/daemon_example/daemon_example.cc	2011-08-15 18:12:11 +0000
@@ -201,6 +201,7 @@ mysql_declare_plugin(daemon_example)
   0x0100 /* 1.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;

=== modified file 'plugin/fulltext/plugin_example.c'
--- a/plugin/fulltext/plugin_example.c	2011-07-03 23:48:19 +0000
+++ b/plugin/fulltext/plugin_example.c	2011-08-15 18:12:11 +0000
@@ -267,7 +267,8 @@ mysql_declare_plugin(ftexample)
   0x0001,                     /* version                         */
   simple_status,              /* status variables                */
   simple_system_variables,    /* system variables                */
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc	2011-07-21 16:27:14 +0000
+++ b/plugin/semisync/semisync_master_plugin.cc	2011-09-21 11:01:41 +0000
@@ -439,6 +439,7 @@ mysql_declare_plugin(semi_sync_master)
   0x0100 /* 1.0 */,
   semi_sync_master_status_vars,	/* status variables */
   semi_sync_master_system_vars,	/* system variables */
-  NULL                        /* config options                  */
+  NULL,                         /* config options */
+  0,                            /* flags */
 }
 mysql_declare_plugin_end;

=== modified file 'plugin/semisync/semisync_slave_plugin.cc'
--- a/plugin/semisync/semisync_slave_plugin.cc	2011-05-05 23:17:47 +0000
+++ b/plugin/semisync/semisync_slave_plugin.cc	2011-09-21 11:01:41 +0000
@@ -225,6 +225,7 @@ mysql_declare_plugin(semi_sync_slave)
   0x0100 /* 1.0 */,
   semi_sync_slave_status_vars,	/* status variables */
   semi_sync_slave_system_vars,	/* system variables */
-  NULL                        /* config options                  */
+  NULL,                         /* config options */
+  0,                            /* flags */
 }
 mysql_declare_plugin_end;

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2011-08-19 13:04:28 +0000
+++ b/sql/binlog.cc	2011-09-23 12:22:58 +0000
@@ -6104,6 +6104,7 @@ mysql_declare_plugin(binlog)
   0x0100 /* 1.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,  
 }
 mysql_declare_plugin_end;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-08-12 07:18:41 +0000
+++ b/sql/ha_ndbcluster.cc	2011-09-21 11:01:41 +0000
@@ -11136,7 +11136,8 @@ mysql_declare_plugin(ndbcluster)
   0x0100 /* 1.0 */,
   ndb_status_variables_export,/* status variables                */
   system_variables,           /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;
 

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-07-07 19:13:19 +0000
+++ b/sql/ha_partition.cc	2011-09-21 11:01:41 +0000
@@ -7433,7 +7433,8 @@ mysql_declare_plugin(partition)
   0x0100, /* 1.0 */
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;
 

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-09-22 10:42:10 +0000
+++ b/sql/item_strfunc.cc	2011-09-23 10:19:37 +0000
@@ -2421,7 +2421,7 @@ String *Item_func_format::val_str_ascii(
       return 0; /* purecov: inspected */
     nr= my_double_round(nr, (longlong) dec, FALSE, FALSE);
     str->set_real(nr, dec, &my_charset_numeric);
-    if (isnan(nr))
+    if (isnan(nr) || my_isinf(nr))
       return str;
     str_length=str->length();
   }
@@ -2477,6 +2477,7 @@ String *Item_func_format::val_str_ascii(
       For short values without thousands (<1000)
       replace decimal point to localized value.
     */
+    DBUG_ASSERT(dec_length <= str_length);
     ((char*) str->ptr())[str_length - dec_length]= lc->decimal_point;
   }
   return str;

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-09-21 12:00:09 +0000
+++ b/sql/share/errmsg-utf8.txt	2011-09-23 10:55:10 +0000
@@ -6526,3 +6526,9 @@ ER_MTS_INCONSISTENT_DATA
 
 ER_UNDO_RECORD_TOO_BIG
   eng "Undo log record is too big."
+
+ER_PLUGIN_NO_UNINSTALL
+  eng "Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it."
+
+ER_PLUGIN_NO_INSTALL
+  eng "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it."

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-08-19 13:21:02 +0000
+++ b/sql/sql_acl.cc	2011-09-21 11:49:00 +0000
@@ -1881,17 +1881,17 @@ bool change_password(THD *thd, const cha
     goto end;
   }
 
+  /* update loaded acl entry: */
+  set_user_salt(acl_user, new_password, new_password_len);
+
   if (my_strcasecmp(system_charset_info, acl_user->plugin.str,
                     native_password_plugin_name.str) &&
       my_strcasecmp(system_charset_info, acl_user->plugin.str,
                     old_password_plugin_name.str))
-  {
     push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
                  ER_SET_PASSWORD_AUTH_PLUGIN, ER(ER_SET_PASSWORD_AUTH_PLUGIN));
-  }
-  /* update loaded acl entry: */
-  set_user_salt(acl_user, new_password, new_password_len);
-  set_user_plugin(acl_user, new_password_len);
+  else
+    set_user_plugin(acl_user, new_password_len);
 
   if (update_user_table(thd, table,
 			acl_user->host.hostname ? acl_user->host.hostname : "",
@@ -8939,24 +8939,18 @@ static ulong parse_client_handshake_pack
 
 
 /**
-  Make sure that when sending plugin supplued data to the client they
+  Make sure that when sending plugin supplied data to the client they
   are not considered a special out-of-band command, like e.g. 
-  \255 (error) or \254 (change user request packet).
-  To avoid this we send plugin data packets starting with one of these
-  2 bytes "wrapped" in a command \1. 
-  For the above reason we have to wrap plugin data packets starting with
-  \1 as well.
+  \255 (error) or \254 (change user request packet) or \0 (OK).
+  To avoid this the server will send all plugin data packets "wrapped" 
+  in a command \1.
+  Note that the client will continue sending its replies unrwapped.
 */
 
-#define IS_OUT_OF_BAND_PACKET(packet,packet_len) \
-  ((packet_len) > 0 && \
-   (*(packet) == 1 || *(packet) == 255 || *(packet) == 254))
-
 static inline int 
 wrap_plguin_data_into_proper_command(NET *net, 
                                      const uchar *packet, int packet_len)
 {
-  DBUG_ASSERT(IS_OUT_OF_BAND_PACKET(packet, packet_len));
   return net_write_command(net, 1, (uchar *) "", 0, packet, packet_len);
 }
 
@@ -8993,13 +8987,8 @@ static int server_mpvio_write_packet(MYS
     res= send_server_handshake_packet(mpvio, (char*) packet, packet_len);
   else if (mpvio->status == MPVIO_EXT::RESTART)
     res= send_plugin_request_packet(mpvio, packet, packet_len);
-  else if (IS_OUT_OF_BAND_PACKET(packet, packet_len))
-    res= wrap_plguin_data_into_proper_command(mpvio->net, packet, packet_len);
   else
-  {
-    res= my_net_write(mpvio->net, packet, packet_len) ||
-         net_flush(mpvio->net);
-  }
+    res= wrap_plguin_data_into_proper_command(mpvio->net, packet, packet_len);
   mpvio->packets_written++;
   DBUG_RETURN(res);
 }
@@ -9767,7 +9756,8 @@ mysql_declare_plugin(mysql_password)
   0x0100,                                       /* Version (1.0)    */
   NULL,                                         /* status variables */
   NULL,                                         /* system variables */
-  NULL                                          /* config options   */
+  NULL,                                         /* config options   */
+  0,                                            /* flags            */
 },
 {
   MYSQL_AUTHENTICATION_PLUGIN,                  /* type constant    */
@@ -9781,7 +9771,8 @@ mysql_declare_plugin(mysql_password)
   0x0100,                                       /* Version (1.0)    */
   NULL,                                         /* status variables */
   NULL,                                         /* system variables */
-  NULL                                          /* config options   */
+  NULL,                                         /* config options   */
+  0,                                            /* flags            */
 }
 mysql_declare_plugin_end;
 

=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc	2011-07-28 10:54:44 +0000
+++ b/sql/sql_error.cc	2011-09-21 11:01:41 +0000
@@ -907,14 +907,16 @@ uint32 convert_error_message(char *to, u
   my_wc_t     wc;
   const uchar *from_end= (const uchar*) from+from_length;
   char *to_start= to;
-  uchar *to_end= (uchar*) to+to_length;
+  uchar *to_end;
   my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
   my_charset_conv_wc_mb wc_mb;
   uint error_count= 0;
   uint length;
 
   DBUG_ASSERT(to_length > 0);
+  /* Make room for the null terminator. */
   to_length--;
+  to_end= (uchar*) (to + to_length);
 
   if (!to_cs || from_cs == to_cs || to_cs == &my_charset_bin)
   {

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2011-08-15 09:44:00 +0000
+++ b/sql/sql_lex.cc	2011-09-23 11:42:35 +0000
@@ -436,6 +436,7 @@ void lex_start(THD *thd)
 
   lex->is_lex_started= TRUE;
   lex->used_tables= 0;
+  lex->reset_slave_info.all= false;
   DBUG_VOID_RETURN;
 }
 
@@ -2154,6 +2155,9 @@ bool st_select_lex::setup_ref_array(THD 
   // find_order_in_list() may need some extra space, so multiply by two.
   order_group_num*= 2;
 
+  // find_order_in_list() may need some extra space, so multiply by two.
+  order_group_num*= 2;
+
   /*
     We have to create array in prepared statement memory if it is
     prepared statement

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2011-08-18 08:31:08 +0000
+++ b/sql/sql_plugin.cc	2011-09-21 11:01:41 +0000
@@ -539,6 +539,11 @@ static st_plugin_dl *plugin_dl_add(const
 #endif
     }
 
+    /*
+      What's the purpose of this loop? If the goal is to catch a
+      missing 0 record at the end of a list, it will fail miserably
+      since the compiler is likely to optimize this away. /Matz
+     */
     for (i= 0;
          ((struct st_mysql_plugin *)(ptr+i*sizeof_st_plugin))->info;
          i++)
@@ -567,6 +572,23 @@ static st_plugin_dl *plugin_dl_add(const
   }
   plugin_dl.plugins= (struct st_mysql_plugin *)sym;
 
+  /*
+    If report is REPORT_TO_USER, we were called from
+    mysql_install_plugin. Otherwise, we are called directly or
+    indirectly from plugin_init.
+   */
+  if (report == REPORT_TO_USER)
+  {
+    st_mysql_plugin *plugin= plugin_dl.plugins;
+    for ( ; plugin->info ; ++plugin)
+      if (plugin->flags & PLUGIN_OPT_NO_INSTALL)
+      {
+        report_error(report, ER_PLUGIN_NO_INSTALL, plugin->name);
+        free_plugin_mem(&plugin_dl);
+        DBUG_RETURN(0);
+   }
+  }
+
   /* Duplicate and convert dll name */
   plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1;
   if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0))))
@@ -1894,6 +1916,16 @@ bool mysql_uninstall_plugin(THD *thd, co
     my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
     goto err;
   }
+  /*
+    Error message for ER_PLUGIN_IS_PERMANENT is not suitable for
+    plugins marked as not dynamically uninstallable, so we have a
+    separate one instead of changing the old one.
+   */
+  if (plugin->plugin->flags & PLUGIN_OPT_NO_UNINSTALL)
+  {
+    my_error(ER_PLUGIN_NO_UNINSTALL, MYF(0), plugin->plugin->name);
+    goto err;
+  }
 
   plugin->state= PLUGIN_IS_DELETED;
   if (plugin->ref_count)

=== modified file 'sql/sql_union.cc'
--- a/sql/sql_union.cc	2011-07-21 12:54:54 +0000
+++ b/sql/sql_union.cc	2011-09-21 11:01:41 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    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
@@ -432,7 +432,7 @@ bool st_select_lex_unit::prepare(THD *th
           Fake st_select_lex should have item list for correct ref_array
           allocation.
         */
-	fake_select_lex->item_list= item_list;
+        fake_select_lex->item_list= item_list;
 
         thd_arg->lex->current_select= fake_select_lex;
 

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-09-13 07:22:49 +0000
+++ b/sql/sql_yacc.yy	2011-09-26 07:19:04 +0000
@@ -8803,6 +8803,11 @@ function_call_generic:
             Create_func *builder;
             Item *item= NULL;
 
+            if (check_routine_name(&$1))
+            {
+              MYSQL_YYABORT;
+            }
+
             /*
               Implementation note:
               names are resolved with the following order:
@@ -8866,6 +8871,16 @@ function_call_generic:
               version() (a vendor can specify any schema).
             */
 
+            if (!$1.str || check_and_convert_db_name(&$1, FALSE))
+            {
+              my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
+              MYSQL_YYABORT;
+            }
+            if (check_routine_name(&$3))
+            {
+              MYSQL_YYABORT;
+            }
+
             builder= find_qualified_function_builder(thd);
             DBUG_ASSERT(builder);
             item= builder->create(thd, $1, $3, true, $5);

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2011-07-04 00:25:46 +0000
+++ b/storage/archive/ha_archive.cc	2011-09-21 11:01:41 +0000
@@ -1775,7 +1775,8 @@ mysql_declare_plugin(archive)
   0x0300 /* 3.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;
 

=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc	2011-08-19 13:04:28 +0000
+++ b/storage/blackhole/ha_blackhole.cc	2011-09-21 11:01:41 +0000
@@ -447,6 +447,7 @@ mysql_declare_plugin(blackhole)
   0x0100 /* 1.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;

=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc	2011-06-30 15:50:45 +0000
+++ b/storage/csv/ha_tina.cc	2011-09-21 11:01:41 +0000
@@ -1759,7 +1759,8 @@ mysql_declare_plugin(csv)
   0x0100 /* 1.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;
 

=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc	2011-06-30 15:50:45 +0000
+++ b/storage/example/ha_example.cc	2011-09-21 11:01:41 +0000
@@ -1001,6 +1001,7 @@ mysql_declare_plugin(example)
   0x0001 /* 0.1 */,
   func_status,                                  /* status variables */
   example_system_variables,                     /* system variables */
-  NULL                                          /* config options */
+  NULL,                                         /* config options */
+  0,                                            /* flags */
 }
 mysql_declare_plugin_end;

=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc	2011-06-30 15:50:45 +0000
+++ b/storage/federated/ha_federated.cc	2011-09-21 11:01:41 +0000
@@ -3474,6 +3474,7 @@ mysql_declare_plugin(federated)
   0x0100 /* 1.0 */,
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;

=== modified file 'storage/heap/ha_heap.cc'
--- a/storage/heap/ha_heap.cc	2011-07-04 00:25:46 +0000
+++ b/storage/heap/ha_heap.cc	2011-09-21 11:01:41 +0000
@@ -821,6 +821,7 @@ mysql_declare_plugin(heap)
   0x0100, /* 1.0 */
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;

=== modified file 'storage/innobase/btr/btr0pcur.c'
--- a/storage/innobase/btr/btr0pcur.c	2011-08-15 09:34:39 +0000
+++ b/storage/innobase/btr/btr0pcur.c	2011-09-26 07:19:04 +0000
@@ -358,33 +358,6 @@ btr_pcur_restore_position_func(
 	return(FALSE);
 }
 
-/**************************************************************//**
-If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY,
-releases the page latch and bufferfix reserved by the cursor.
-NOTE! In the case of BTR_LEAF_MODIFY, there should not exist changes
-made by the current mini-transaction to the data protected by the
-cursor latch, as then the latch must not be released until mtr_commit. */
-UNIV_INTERN
-void
-btr_pcur_release_leaf(
-/*==================*/
-	btr_pcur_t*	cursor, /*!< in: persistent cursor */
-	mtr_t*		mtr)	/*!< in: mtr */
-{
-	buf_block_t*	block;
-
-	ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
-	ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
-
-	block = btr_pcur_get_block(cursor);
-
-	btr_leaf_page_release(block, cursor->latch_mode, mtr);
-
-	cursor->latch_mode = BTR_NO_LATCHES;
-
-	cursor->pos_state = BTR_PCUR_WAS_POSITIONED;
-}
-
 /*********************************************************//**
 Moves the persistent cursor to the first record on the next page. Releases the
 latch on the current page, and bufferunfixes it. Note that there must not be

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-09-01 18:59:44 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-09-23 10:55:10 +0000
@@ -4382,25 +4382,6 @@ field_in_record_is_null(
 	return(0);
 }
 
-/**************************************************************//**
-Sets a field in a record to SQL NULL. Uses the record format
-information in table to track the null bit in record. */
-static inline
-void
-set_field_in_record_to_null(
-/*========================*/
-	TABLE*	table,	/*!< in: MySQL table object */
-	Field*	field,	/*!< in: MySQL field object */
-	char*	record)	/*!< in: a row in MySQL format */
-{
-	int	null_offset;
-
-	null_offset = (uint) ((char*) field->null_ptr
-		    - (char*) table->record[0]);
-
-	record[null_offset] = record[null_offset] | field->null_bit;
-}
-
 /*************************************************************//**
 InnoDB uses this function to compare two data fields for which the data type
 is such that we must use MySQL code to compare them. NOTE that the prototype
@@ -13035,7 +13016,8 @@ mysql_declare_plugin(innobase)
   INNODB_VERSION_SHORT,
   innodb_status_variables_export,/* status variables             */
   innobase_system_variables, /* system variables */
-  NULL /* reserved */
+  NULL, /* reserved */
+  0,    /* flags */
 },
 i_s_innodb_trx,
 i_s_innodb_locks,

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	2011-09-08 10:05:38 +0000
+++ b/storage/innobase/handler/i_s.cc	2011-09-23 11:09:58 +0000
@@ -729,7 +729,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
@@ -995,7 +999,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
@@ -1178,7 +1186,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /*******************************************************************//**
@@ -1511,7 +1523,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 UNIV_INTERN struct st_mysql_plugin	i_s_innodb_cmp_reset =
@@ -1561,7 +1577,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table information_schema.innodb_cmpmem. */
@@ -1802,7 +1822,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 UNIV_INTERN struct st_mysql_plugin	i_s_innodb_cmpmem_reset =
@@ -1852,7 +1876,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */
@@ -2376,7 +2404,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
@@ -2893,7 +2925,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */
@@ -3582,7 +3618,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 static ST_FIELD_INFO	i_s_innodb_buf_page_lru_fields_info[] =
@@ -4124,7 +4164,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /*******************************************************************//**
@@ -4366,7 +4410,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */
@@ -4641,7 +4689,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */
@@ -4896,7 +4948,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_COLUMNS */
@@ -5131,7 +5187,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_fields */
 static ST_FIELD_INFO	innodb_sys_fields_fields_info[] =
@@ -5338,7 +5398,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign */
@@ -5559,7 +5623,11 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols */
 static ST_FIELD_INFO	innodb_sys_foreign_cols_fields_info[] =
@@ -5773,6 +5841,10 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* reserved for dependency checking */
 	/* void* */
-	STRUCT_FLD(__reserved1, NULL)
+	STRUCT_FLD(__reserved1, NULL),
+
+	/* Plugin flags */
+	/* unsigned long */
+	STRUCT_FLD(flags, 0UL),
 };
 

=== modified file 'storage/innobase/include/btr0pcur.h'
--- a/storage/innobase/include/btr0pcur.h	2011-03-22 12:34:16 +0000
+++ b/storage/innobase/include/btr0pcur.h	2011-09-21 11:01:41 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 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 the Free Software
@@ -245,18 +245,6 @@ btr_pcur_restore_position_func(
 	mtr_t*		mtr);		/*!< in: mtr */
 #define btr_pcur_restore_position(l,cur,mtr)				\
 	btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr)
-/**************************************************************//**
-If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY,
-releases the page latch and bufferfix reserved by the cursor.
-NOTE! In the case of BTR_LEAF_MODIFY, there should not exist changes
-made by the current mini-transaction to the data protected by the
-cursor latch, as then the latch must not be released until mtr_commit. */
-UNIV_INTERN
-void
-btr_pcur_release_leaf(
-/*==================*/
-	btr_pcur_t*	cursor, /*!< in: persistent cursor */
-	mtr_t*		mtr);	/*!< in: mtr */
 /*********************************************************//**
 Gets the rel_pos field for a cursor whose position has been stored.
 @return	BTR_PCUR_ON, ... */
@@ -267,10 +255,9 @@ btr_pcur_get_rel_pos(
 	const btr_pcur_t*	cursor);/*!< in: persistent cursor */
 /**************************************************************//**
 Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
-that is, the cursor becomes detached. If there have been modifications
-to the page where pcur is positioned, this can be used instead of
-btr_pcur_release_leaf. Function btr_pcur_store_position should be used
-before calling this, if restoration of cursor is wanted later. */
+that is, the cursor becomes detached.
+Function btr_pcur_store_position should be used before calling this,
+if restoration of cursor is wanted later. */
 UNIV_INLINE
 void
 btr_pcur_commit_specify_mtr(

=== modified file 'storage/innobase/include/btr0pcur.ic'
--- a/storage/innobase/include/btr0pcur.ic	2011-03-22 12:34:16 +0000
+++ b/storage/innobase/include/btr0pcur.ic	2011-09-21 11:01:41 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 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 the Free Software
@@ -369,10 +369,9 @@ btr_pcur_move_to_next(
 
 /**************************************************************//**
 Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES,
-that is, the cursor becomes detached. If there have been modifications
-to the page where pcur is positioned, this can be used instead of
-btr_pcur_release_leaf. Function btr_pcur_store_position should be used
-before calling this, if restoration of cursor is wanted later. */
+that is, the cursor becomes detached.
+Function btr_pcur_store_position should be used before calling this,
+if restoration of cursor is wanted later. */
 UNIV_INLINE
 void
 btr_pcur_commit_specify_mtr(

=== modified file 'storage/innobase/include/mtr0mtr.h'
--- a/storage/innobase/include/mtr0mtr.h	2011-08-29 08:45:30 +0000
+++ b/storage/innobase/include/mtr0mtr.h	2011-09-26 07:19:04 +0000
@@ -218,16 +218,6 @@ ulint
 mtr_set_savepoint(
 /*==============*/
 	mtr_t*	mtr);	/*!< in: mtr */
-/**********************************************************//**
-Releases the latches stored in an mtr memo down to a savepoint.
-NOTE! The mtr must not have made changes to buffer pages after the
-savepoint, as these can be handled only by mtr_commit. */
-UNIV_INTERN
-void
-mtr_rollback_to_savepoint(
-/*======================*/
-	mtr_t*	mtr,		/*!< in: mtr */
-	ulint	savepoint);	/*!< in: savepoint */
 #ifndef UNIV_HOTBACKUP
 /**********************************************************//**
 Releases the (index tree) s-latch stored in an mtr memo after a

=== modified file 'storage/innobase/include/ut0mem.h'
--- a/storage/innobase/include/ut0mem.h	2010-10-02 19:12:58 +0000
+++ b/storage/innobase/include/ut0mem.h	2011-09-21 11:01:41 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 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 the Free Software
@@ -210,43 +210,6 @@ ut_strlcpy_rev(
 	ulint		size);	/*!< in: size of destination buffer */
 
 /**********************************************************************//**
-Compute strlen(ut_strcpyq(str, q)).
-@return	length of the string when quoted */
-UNIV_INLINE
-ulint
-ut_strlenq(
-/*=======*/
-	const char*	str,	/*!< in: null-terminated string */
-	char		q);	/*!< in: the quote character */
-
-/**********************************************************************//**
-Make a quoted copy of a NUL-terminated string.	Leading and trailing
-quotes will not be included; only embedded quotes will be escaped.
-See also ut_strlenq() and ut_memcpyq().
-@return	pointer to end of dest */
-UNIV_INTERN
-char*
-ut_strcpyq(
-/*=======*/
-	char*		dest,	/*!< in: output buffer */
-	char		q,	/*!< in: the quote character */
-	const char*	src);	/*!< in: null-terminated string */
-
-/**********************************************************************//**
-Make a quoted copy of a fixed-length string.  Leading and trailing
-quotes will not be included; only embedded quotes will be escaped.
-See also ut_strlenq() and ut_strcpyq().
-@return	pointer to end of dest */
-UNIV_INTERN
-char*
-ut_memcpyq(
-/*=======*/
-	char*		dest,	/*!< in: output buffer */
-	char		q,	/*!< in: the quote character */
-	const char*	src,	/*!< in: string to be quoted */
-	ulint		len);	/*!< in: length of src */
-
-/**********************************************************************//**
 Return the number of times s2 occurs in s1. Overlapping instances of s2
 are only counted once.
 @return	the number of times s2 occurs in s1 */

=== modified file 'storage/innobase/include/ut0mem.ic'
--- a/storage/innobase/include/ut0mem.ic	2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/ut0mem.ic	2011-09-21 11:01:41 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 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 the Free Software
@@ -99,27 +99,6 @@ ut_strcmp(const char* str1, const char* 
 }
 
 /**********************************************************************//**
-Compute strlen(ut_strcpyq(str, q)).
-@return	length of the string when quoted */
-UNIV_INLINE
-ulint
-ut_strlenq(
-/*=======*/
-	const char*	str,	/*!< in: null-terminated string */
-	char		q)	/*!< in: the quote character */
-{
-	ulint len;
-
-	for (len = 0; *str; len++, str++) {
-		if (*str == q) {
-			len++;
-		}
-	}
-
-	return(len);
-}
-
-/**********************************************************************//**
 Converts a raw binary data to a NUL-terminated hex string. The output is
 truncated if there is not enough space in "hex", make sure "hex_size" is at
 least (2 * raw_size + 1) if you do not want this to happen. Returns the

=== modified file 'storage/innobase/log/log0log.c'
--- a/storage/innobase/log/log0log.c	2011-08-10 06:26:39 +0000
+++ b/storage/innobase/log/log0log.c	2011-09-23 13:49:13 +0000
@@ -3487,15 +3487,20 @@ log_print(
 
 	current_time = time(NULL);
 
-	time_elapsed = 0.001 + difftime(current_time,
-					log_sys->last_printout_time);
+	time_elapsed = difftime(current_time,
+				log_sys->last_printout_time);
+
+	if (time_elapsed <= 0) {
+		time_elapsed = 1;
+	}
+
 	fprintf(file,
 		"%lu pending log writes, %lu pending chkp writes\n"
 		"%lu log i/o's done, %.2f log i/o's/second\n",
 		(ulong) log_sys->n_pending_writes,
 		(ulong) log_sys->n_pending_checkpoint_writes,
 		(ulong) log_sys->n_log_ios,
-		((log_sys->n_log_ios - log_sys->n_log_ios_old)
+		((double)(log_sys->n_log_ios - log_sys->n_log_ios_old)
 		 / time_elapsed));
 
 	log_sys->n_log_ios_old = log_sys->n_log_ios;

=== modified file 'storage/innobase/mtr/mtr0mtr.c'
--- a/storage/innobase/mtr/mtr0mtr.c	2011-08-29 08:45:30 +0000
+++ b/storage/innobase/mtr/mtr0mtr.c	2011-09-26 07:19:04 +0000
@@ -312,44 +312,6 @@ mtr_commit(
 }
 
 #ifndef UNIV_HOTBACKUP
-/**********************************************************//**
-Releases the latches stored in an mtr memo down to a savepoint.
-NOTE! The mtr must not have made changes to buffer pages after the
-savepoint, as these can be handled only by mtr_commit. */
-UNIV_INTERN
-void
-mtr_rollback_to_savepoint(
-/*======================*/
-	mtr_t*	mtr,		/*!< in: mtr */
-	ulint	savepoint)	/*!< in: savepoint */
-{
-	mtr_memo_slot_t* slot;
-	dyn_array_t*	memo;
-	ulint		offset;
-
-	ut_ad(mtr);
-	ut_ad(mtr->magic_n == MTR_MAGIC_N);
-	ut_ad(mtr->state == MTR_ACTIVE);
-
-	memo = &(mtr->memo);
-
-	offset = dyn_array_get_data_size(memo);
-	ut_ad(offset >= savepoint);
-
-	while (offset > savepoint) {
-		offset -= sizeof(mtr_memo_slot_t);
-
-		slot = dyn_array_get_element(memo, offset);
-
-		ut_ad(slot->type != MTR_MEMO_MODIFY);
-
-		/* We do not call mtr_memo_slot_note_modification()
-		because there MUST be no changes made to the buffer
-		pages after the savepoint */
-		mtr_memo_slot_release(mtr, slot);
-	}
-}
-
 /***************************************************//**
 Releases an object in the memo stack. */
 UNIV_INTERN

=== modified file 'storage/innobase/row/row0purge.c'
--- a/storage/innobase/row/row0purge.c	2011-09-21 00:24:59 +0000
+++ b/storage/innobase/row/row0purge.c	2011-09-26 07:19:04 +0000
@@ -516,7 +516,7 @@ row_purge_upd_exist_or_extern_func(
 
 	ut_ad(node);
 
-	if ((node->rec_type == TRX_UNDO_UPD_DEL_REC)
+	if (node->rec_type == TRX_UNDO_UPD_DEL_REC
 	    || (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
 
 		goto skip_secondaries;

=== modified file 'storage/innobase/ut/ut0mem.c'
--- a/storage/innobase/ut/ut0mem.c	2011-02-15 09:40:34 +0000
+++ b/storage/innobase/ut/ut0mem.c	2011-09-21 11:01:41 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
 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 the Free Software
@@ -488,53 +488,6 @@ ut_strlcpy_rev(
 	return(src_size);
 }
 
-/**********************************************************************//**
-Make a quoted copy of a NUL-terminated string.	Leading and trailing
-quotes will not be included; only embedded quotes will be escaped.
-See also ut_strlenq() and ut_memcpyq().
-@return	pointer to end of dest */
-UNIV_INTERN
-char*
-ut_strcpyq(
-/*=======*/
-	char*		dest,	/*!< in: output buffer */
-	char		q,	/*!< in: the quote character */
-	const char*	src)	/*!< in: null-terminated string */
-{
-	while (*src) {
-		if ((*dest++ = *src++) == q) {
-			*dest++ = q;
-		}
-	}
-
-	return(dest);
-}
-
-/**********************************************************************//**
-Make a quoted copy of a fixed-length string.  Leading and trailing
-quotes will not be included; only embedded quotes will be escaped.
-See also ut_strlenq() and ut_strcpyq().
-@return	pointer to end of dest */
-UNIV_INTERN
-char*
-ut_memcpyq(
-/*=======*/
-	char*		dest,	/*!< in: output buffer */
-	char		q,	/*!< in: the quote character */
-	const char*	src,	/*!< in: string to be quoted */
-	ulint		len)	/*!< in: length of src */
-{
-	const char*	srcend = src + len;
-
-	while (src < srcend) {
-		if ((*dest++ = *src++) == q) {
-			*dest++ = q;
-		}
-	}
-
-	return(dest);
-}
-
 #ifndef UNIV_HOTBACKUP
 /**********************************************************************//**
 Return the number of times s2 occurs in s1. Overlapping instances of s2

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2011-09-06 12:45:57 +0000
+++ b/storage/myisam/ha_myisam.cc	2011-09-21 11:01:41 +0000
@@ -2216,7 +2216,8 @@ mysql_declare_plugin(myisam)
   0x0100, /* 1.0 */
   NULL,                       /* status variables                */
   myisam_sysvars,             /* system variables                */
-  NULL
+  NULL,
+  0,
 }
 mysql_declare_plugin_end;
 

=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc	2011-07-22 15:52:42 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc	2011-09-21 11:01:41 +0000
@@ -1680,6 +1680,7 @@ mysql_declare_plugin(myisammrg)
   0x0100, /* 1.0 */
   NULL,                       /* status variables                */
   NULL,                       /* system variables                */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0,                          /* flags                           */
 }
 mysql_declare_plugin_end;

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2011-09-21 11:01:41 +0000
@@ -185,7 +185,8 @@ mysql_declare_plugin(perfschema)
   0x0001 /* 0.1 */,
   pfs_status_vars,                              /* status variables */
   NULL,                                         /* system variables */
-  NULL                                          /* config options */
+  NULL,                                         /* config options */
+  0,                                            /* flags */
 }
 mysql_declare_plugin_end;
 

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2011-09-20 15:49:37 +0000
+++ b/support-files/mysql.spec.sh	2011-09-23 10:55:10 +0000
@@ -961,7 +961,7 @@ echo "====="                            
 #  Files section
 ##############################################################################
 
-%files -n MySQL-server%{product_suffix}
+%files -n MySQL-server%{product_suffix} -f release/support-files/plugins.files
 %defattr(-,root,root,0755)
 
 %if %{defined license_files_server}
@@ -1002,6 +1002,7 @@ echo "====="                            
 %doc %attr(644, root, man) %{_mandir}/man1/replace.1*
 %doc %attr(644, root, man) %{_mandir}/man1/resolve_stack_dump.1*
 %doc %attr(644, root, man) %{_mandir}/man1/resolveip.1*
+%doc %attr(644, root, man) %{_mandir}/man1/mysql_plugin.1*
 
 %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
 
@@ -1019,6 +1020,7 @@ echo "====="                            
 %attr(755, root, root) %{_bindir}/mysql_setpermission
 %attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql
 %attr(755, root, root) %{_bindir}/mysql_upgrade
+%attr(755, root, root) %{_bindir}/mysql_plugin
 %attr(755, root, root) %{_bindir}/mysql_zap
 %attr(755, root, root) %{_bindir}/mysqlbug
 %attr(755, root, root) %{_bindir}/mysqld_multi
@@ -1034,29 +1036,7 @@ echo "====="                            
 %attr(755, root, root) %{_sbindir}/mysqld
 %attr(755, root, root) %{_sbindir}/mysqld-debug
 %attr(755, root, root) %{_sbindir}/rcmysql
-%attr(755, root, root) %{_libdir}/mysql/plugin/adt_null.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/libdaemon_example.so
 %attr(755, root, root) %{_libdir}/mysql/plugin/daemon_example.ini
-%attr(755, root, root) %{_libdir}/mysql/plugin/mypluglib.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_master.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/semisync_slave.so
-%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
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_master.so
-%attr(755, root, root) %{_libdir}/mysql/plugin/debug/semisync_slave.so
-%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}
@@ -1162,6 +1142,10 @@ echo "====="                            
 
 - "make_win_bin_dist" and its manual are dropped, cmake does it different.
 
+* Thu Sep 08 2011 Daniel Fischer <daniel.fischer@oracle.com>
+
+- Add mysql_plugin man page.
+
 * Tue Aug 30 2011 Joerg Bruehe <joerg.bruehe@stripped>
 
 - Add the manual page for "mysql_plugin" to the server package.
@@ -1171,6 +1155,10 @@ echo "====="                            
 - Null-upmerge the fix of bug#37165: This spec file is not affected.
 - Replace "/var/lib/mysql" by the spec file variable "%{mysqldatadir}".
 
+* Fri Aug 12 2011 Daniel Fischer <daniel.fischer@stripped>
+
+- Source plugin library files list from cmake-generated file.
+
 * Mon Jul 25 2011 Chuck Bell <chuck.bell@stripped>
 
 - Added the mysql_plugin client - enables or disables plugins.

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (magnus.blaudd:3435) magnus.blaudd29 Sep