List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:October 27 2010 2:59pm
Subject:bzr push into mysql-5.1-innodb branch (vasil.dimov:3643 to 3644)
View as plain text  
 3644 Vasil Dimov	2010-10-27 [merge]
      Merge mysql-5.1-bugteam -> mysql-5.1-innodb

    added:
      mysql-test/extra/rpl_tests/rpl_stop_slave.test
      mysql-test/r/lowercase_table4.result
      mysql-test/suite/rpl/r/rpl_stop_slave.result
      mysql-test/suite/rpl/t/rpl_stop_slave.test
      mysql-test/t/lowercase_table4-master.opt
      mysql-test/t/lowercase_table4.test
    modified:
      BUILD/SETUP.sh
      client/mysql.cc
      client/mysqltest.cc
      client/sql_string.h
      cmd-line-utils/libedit/common.c
      cmd-line-utils/libedit/filecomplete.c
      cmd-line-utils/libedit/readline.c
      cmd-line-utils/libedit/vi.c
      cmd-line-utils/readline/complete.c
      cmd-line-utils/readline/histexpand.c
      cmd-line-utils/readline/histfile.c
      cmd-line-utils/readline/isearch.c
      cmd-line-utils/readline/parens.c
      cmd-line-utils/readline/readline.c
      cmd-line-utils/readline/terminal.c
      cmd-line-utils/readline/text.c
      config/ac-macros/maintainer.m4
      configure.in
      dbug/dbug.c
      include/my_compiler.h
      include/my_dbug.h
      include/my_pthread.h
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/include/check_concurrent_insert.inc
      mysql-test/include/check_no_concurrent_insert.inc
      mysql-test/include/get_relay_log_pos.inc
      mysql-test/include/kill_query.inc
      mysql-test/include/kill_query_and_diff_master_slave.inc
      mysql-test/include/setup_fake_relay_log.inc
      mysql-test/include/show_binlog_events.inc
      mysql-test/include/show_rpl_debug_info.inc
      mysql-test/include/wait_for_slave_io_error.inc
      mysql-test/include/wait_for_slave_param.inc
      mysql-test/include/wait_for_slave_sql_error.inc
      mysql-test/include/wait_for_status_var.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/grant3.result
      mysql-test/suite/binlog/t/disabled.def
      mysql-test/suite/rpl/r/rpl_do_grant.result
      mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
      mysql-test/suite/rpl/t/rpl_do_grant.test
      mysql-test/suite/rpl/t/rpl_killed_ddl.test
      mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
      mysql-test/t/disabled.def
      mysql-test/t/grant3.test
      mysql-test/t/mysqltest.test
      mysql-test/t/wait_timeout.test
      mysys/my_gethostbyname.c
      mysys/my_gethwaddr.c
      mysys/my_sync.c
      mysys/thr_mutex.c
      regex/main.c
      sql/ha_ndbcluster.cc
      sql/handler.cc
      sql/lock.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/my_decimal.h
      sql/set_var.cc
      sql/slave.cc
      sql/sql_acl.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_db.cc
      sql/sql_help.cc
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_union.cc
      storage/innobase/include/ut0dbg.h
      storage/innobase/os/os0file.c
      storage/innodb_plugin/os/os0file.c
      storage/myisam/myisamchk.c
      storage/myisammrg/ha_myisammrg.cc
      unittest/examples/skip-t.c
      unittest/examples/skip_all-t.c
      unittest/examples/todo-t.c
      unittest/mytap/t/basic-t.c
      unittest/mytap/tap.c
      unittest/mytap/tap.h
 3643 Inaam Rana	2010-10-26
      Bug #57611	ibdata file and continuous growing undo logs
      rb://498
      
      Fix handling of update_undo_logs at trx commit. Previously, when
      rseg->update_undo_list grows beyond 500 the update_undo_logs were
      marked with state TRX_UNDO_TO_FREE which should have been
      TRX_UNDO_TO_PURGE.
      
      Approved by: Sunny Bains

    modified:
      storage/innobase/trx/trx0undo.c
      storage/innodb_plugin/trx/trx0undo.c
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	revid:inaam.rana@stripped
+++ b/BUILD/SETUP.sh	revid:vasil.dimov@stripped
@@ -100,7 +100,7 @@ if [ "x$warning_mode" != "xpedantic" ]; 
 # C++ warnings
   cxx_warnings="$warnings -Wno-unused-parameter"
 # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
-  cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
+  cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
 # Added unless --with-debug=full
   debug_extra_cflags="-O0 -g3 -gdwarf-2"
 else

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	revid:inaam.rana@stripped
+++ b/client/mysql.cc	revid:vasil.dimov@stripped
@@ -3725,7 +3725,8 @@ print_tab_data(MYSQL_RES *result)
 }
 
 static int
-com_tee(String *buffer, char *line __attribute__((unused)))
+com_tee(String *buffer __attribute__((unused)),
+        char *line __attribute__((unused)))
 {
   char file_name[FN_REFLEN], *end, *param;
 
@@ -3784,7 +3785,8 @@ com_notee(String *buffer __attribute__((
 
 #ifdef USE_POPEN
 static int
-com_pager(String *buffer, char *line __attribute__((unused)))
+com_pager(String *buffer __attribute__((unused)),
+          char *line __attribute__((unused)))
 {
   char pager_name[FN_REFLEN], *end, *param;
 
@@ -3911,7 +3913,8 @@ com_rehash(String *buffer __attribute__(
 
 #ifdef USE_POPEN
 static int
-com_shell(String *buffer, char *line __attribute__((unused)))
+com_shell(String *buffer __attribute__((unused)),
+          char *line __attribute__((unused)))
 {
   char *shell_cmd;
 
@@ -4003,7 +4006,8 @@ com_connect(String *buffer, char *line)
 }
 
 
-static int com_source(String *buffer, char *line)
+static int com_source(String *buffer __attribute__((unused)),
+                      char *line)
 {
   char source_name[FN_REFLEN], *end, *param;
   LINE_BUFFER *line_buff;
@@ -4908,7 +4912,8 @@ static void init_username()
   }
 }
 
-static int com_prompt(String *buffer, char *line)
+static int com_prompt(String *buffer __attribute__((unused)),
+                      char *line)
 {
   char *ptr=strchr(line, ' ');
   prompt_counter = 0;

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	revid:inaam.rana@stripped
+++ b/client/mysqltest.cc	revid:vasil.dimov@stripped
@@ -5258,8 +5258,13 @@ void do_connect(struct st_command *comma
                   opt_charsets_dir);
 
 #ifdef HAVE_OPENSSL
-  if (opt_use_ssl || con_ssl)
+  if (opt_use_ssl)
+    con_ssl= 1;
+#endif
+
+  if (con_ssl)
   {
+#ifdef HAVE_OPENSSL
     mysql_ssl_set(&con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
 		  opt_ssl_capath, opt_ssl_cipher);
 #if MYSQL_VERSION_ID >= 50000
@@ -5268,36 +5273,37 @@ void do_connect(struct st_command *comma
     mysql_options(&con_slot->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                   &opt_ssl_verify_server_cert);
 #endif
-  }
 #endif
+  }
 
-#ifdef __WIN__
   if (con_pipe)
   {
+#ifdef __WIN__
     opt_protocol= MYSQL_PROTOCOL_PIPE;
-  }
 #endif
+  }
 
   if (opt_protocol)
     mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
 
-#ifdef HAVE_SMEM
   if (con_shm)
   {
+#ifdef HAVE_SMEM
     uint protocol= MYSQL_PROTOCOL_MEMORY;
     if (!ds_shm.length)
       die("Missing shared memory base name");
     mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
     mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
+#endif
   }
-  else if(shared_memory_base_name)
+#ifdef HAVE_SMEM
+  else if (shared_memory_base_name)
   {
     mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
-      shared_memory_base_name);
+                  shared_memory_base_name);
   }
 #endif
 
-
   /* Use default db name */
   if (ds_database.length == 0)
     dynstr_set(&ds_database, opt_db);
@@ -5719,7 +5725,7 @@ int read_line(char *buf, int size)
       /* Could be a multibyte character */
       /* This code is based on the code in "sql_load.cc" */
 #ifdef USE_MB
-      int charlen = my_mbcharlen(charset_info, c);
+      int charlen = my_mbcharlen(charset_info, (unsigned char) c);
       /* We give up if multibyte character is started but not */
       /* completed before we pass buf_end */
       if ((charlen > 1) && (p + charlen) <= buf_end)
@@ -5731,16 +5737,16 @@ int read_line(char *buf, int size)
 
 	for (i= 1; i < charlen; i++)
 	{
+	  c= my_getc(cur_file->file);
 	  if (feof(cur_file->file))
 	    goto found_eof;
-	  c= my_getc(cur_file->file);
 	  *p++ = c;
 	}
 	if (! my_ismbchar(charset_info, mb_start, p))
 	{
 	  /* It was not a multiline char, push back the characters */
 	  /* We leave first 'c', i.e. pretend it was a normal char */
-	  while (p > mb_start)
+	  while (p-1 > mb_start)
 	    my_ungetc(*--p);
 	}
       }
@@ -9777,6 +9783,7 @@ void free_pointer_array(POINTER_ARRAY *p
 void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
                                const char *val, int len)
 {
+  char lower[512];
 #ifdef __WIN__
   fix_win_paths(val, len);
 #endif
@@ -9784,7 +9791,6 @@ void replace_dynstr_append_mem(DYNAMIC_S
   if (display_result_lower) 
   {
     /* Convert to lower case, and do this first */
-    char lower[512];
     char *c= lower;
     for (const char *v= val;  *v;  v++)
       *c++= my_tolower(charset_info, *v);

=== modified file 'client/sql_string.h'
--- a/client/sql_string.h	revid:inaam.rana@stripped
+++ b/client/sql_string.h	revid:vasil.dimov@stripped
@@ -70,9 +70,13 @@ public:
   }
   static void *operator new(size_t size, MEM_ROOT *mem_root)
   { return (void*) alloc_root(mem_root, (uint) size); }
-  static void operator delete(void *ptr_arg,size_t size)
-  { TRASH(ptr_arg, size); }
-  static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
+  static void operator delete(void *ptr_arg, size_t size)
+  {
+    (void) ptr_arg;
+    (void) size;
+    TRASH(ptr_arg, size);
+  }
+  static void operator delete(void *, MEM_ROOT *)
   { /* never called */ }
   ~String() { free(); }
 

=== modified file 'cmd-line-utils/libedit/common.c'
--- a/cmd-line-utils/libedit/common.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/libedit/common.c	revid:vasil.dimov@stripped
@@ -136,7 +136,7 @@ ed_delete_prev_word(EditLine *el, int c 
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_delete_next_char(EditLine *el, int c)
+ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
 {
 #ifdef notdef			/* XXX */
 #define	EL	el->el_line
@@ -431,7 +431,8 @@ ed_argument_digit(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_unassigned(EditLine *el, int c __attribute__((__unused__)))
+ed_unassigned(EditLine *el __attribute__((__unused__)),
+	      int c __attribute__((__unused__)))
 {
 
 	return (CC_ERROR);

=== modified file 'cmd-line-utils/libedit/filecomplete.c'
--- a/cmd-line-utils/libedit/filecomplete.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/libedit/filecomplete.c	revid:vasil.dimov@stripped
@@ -95,10 +95,9 @@ static char break_chars[] = { ' ', '\t',
 char *
 fn_tilde_expand(const char *txt)
 {
-	struct passwd pwres, *pass;
+	struct passwd *pass;
 	char *temp;
 	size_t len = 0;
-	char pwbuf[1024];
 
 	if (txt[0] != '~')
 		return (strdup(txt));

=== modified file 'cmd-line-utils/libedit/readline.c'
--- a/cmd-line-utils/libedit/readline.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/libedit/readline.c	revid:vasil.dimov@stripped
@@ -202,7 +202,7 @@ _move_history(int op)
  */
 static int
 /*ARGSUSED*/
-_getc_function(EditLine *el, char *c)
+_getc_function(EditLine *el __attribute__((__unused__)), char *c)
 {
 	int i;
 
@@ -1613,7 +1613,8 @@ rl_insert(int count, int c)
 
 /*ARGSUSED*/
 int
-rl_newline(int count, int c)
+rl_newline(int count __attribute__((__unused__)),
+	   int c __attribute__((__unused__)))
 {
 	/*
 	 * Readline-4.0 appears to ignore the args.
@@ -1623,7 +1624,7 @@ rl_newline(int count, int c)
 
 /*ARGSUSED*/
 static unsigned char
-rl_bind_wrapper(EditLine *el, unsigned char c)
+rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c)
 {
 	if (map[c] == NULL)
 	    return CC_ERROR;
@@ -1718,7 +1719,7 @@ rl_get_previous_history(int count, int k
 
 void
 /*ARGSUSED*/
-rl_prep_terminal(int meta_flag)
+rl_prep_terminal(int meta_flag __attribute__((__unused__)))
 {
 	el_set(e, EL_PREP_TERM, 1);
 }
@@ -1922,7 +1923,8 @@ _rl_qsort_string_compare(char **s1, char
 
 int
 /*ARGSUSED*/
-rl_kill_text(int from, int to)
+rl_kill_text(int from __attribute__((__unused__)),
+	     int to __attribute__((__unused__)))
 {
 	return 0;
 }
@@ -1941,20 +1943,25 @@ rl_get_keymap(void)
 
 void
 /*ARGSUSED*/
-rl_set_keymap(Keymap k)
+rl_set_keymap(Keymap k __attribute__((__unused__)))
 {
 }
 
 int
 /*ARGSUSED*/
-rl_generic_bind(int type, const char * keyseq, const char * data, Keymap k)
+rl_generic_bind(int type __attribute__((__unused__)),
+		const char * keyseq __attribute__((__unused__)),
+		const char * data __attribute__((__unused__)),
+		Keymap k __attribute__((__unused__)))
 {
 	return 0;
 }
 
 int
 /*ARGSUSED*/
-rl_bind_key_in_map(int key, Function *fun, Keymap k)
+rl_bind_key_in_map(int key __attribute__((__unused__)),
+		   Function *fun __attribute__((__unused__)),
+		   Keymap k __attribute__((__unused__)))
 {
 	return 0;
 }

=== modified file 'cmd-line-utils/libedit/vi.c'
--- a/cmd-line-utils/libedit/vi.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/libedit/vi.c	revid:vasil.dimov@stripped
@@ -145,7 +145,7 @@ vi_paste_prev(EditLine *el, int c __attr
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_prev_big_word(EditLine *el, int c)
+vi_prev_big_word(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	if (el->el_line.cursor == el->el_line.buffer)
@@ -195,7 +195,7 @@ vi_prev_word(EditLine *el, int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_next_big_word(EditLine *el, int c)
+vi_next_big_word(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	if (el->el_line.cursor >= el->el_line.lastchar - 1)
@@ -462,7 +462,7 @@ vi_delete_meta(EditLine *el, int c __att
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_end_big_word(EditLine *el, int c)
+vi_end_big_word(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	if (el->el_line.cursor == el->el_line.lastchar)
@@ -797,7 +797,7 @@ vi_repeat_prev_char(EditLine *el, int c 
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_match(EditLine *el, int c)
+vi_match(EditLine *el, int c __attribute__((__unused__)))
 {
 	const char match_chars[] = "()[]{}";
 	char *cp;
@@ -844,7 +844,7 @@ vi_match(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_undo_line(EditLine *el, int c)
+vi_undo_line(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	cv_undo(el);
@@ -858,7 +858,7 @@ vi_undo_line(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_to_column(EditLine *el, int c)
+vi_to_column(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	el->el_line.cursor = el->el_line.buffer;
@@ -872,7 +872,7 @@ vi_to_column(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_yank_end(EditLine *el, int c)
+vi_yank_end(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	cv_yank(el, el->el_line.cursor,
@@ -886,7 +886,7 @@ vi_yank_end(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_yank(EditLine *el, int c)
+vi_yank(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	return cv_action(el, YANK);
@@ -898,7 +898,7 @@ vi_yank(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_comment_out(EditLine *el, int c)
+vi_comment_out(EditLine *el, int c __attribute__((__unused__)))
 {
 
 	el->el_line.cursor = el->el_line.buffer;
@@ -919,7 +919,8 @@ extern char *get_alias_text(const char *
 #endif
 protected el_action_t
 /*ARGSUSED*/
-vi_alias(EditLine *el, int c)
+vi_alias(EditLine *el __attribute__((__unused__)),
+	 int c __attribute__((__unused__)))
 {
 #if defined(__weak_reference) && !defined(__FreeBSD__)
 	char alias_name[3];
@@ -949,7 +950,7 @@ vi_alias(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_to_history_line(EditLine *el, int c)
+vi_to_history_line(EditLine *el, int c __attribute__((__unused__)))
 {
 	int sv_event_no = el->el_history.eventno;
 	el_action_t rval;
@@ -994,7 +995,7 @@ vi_to_history_line(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_histedit(EditLine *el, int c)
+vi_histedit(EditLine *el, int c __attribute__((__unused__)))
 {
 	int fd;
 	pid_t pid;
@@ -1050,7 +1051,7 @@ vi_histedit(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_history_word(EditLine *el, int c)
+vi_history_word(EditLine *el, int c __attribute__((__unused__)))
 {
 	const char *wp = HIST_FIRST(el);
 	const char *wep, *wsp;
@@ -1099,7 +1100,7 @@ vi_history_word(EditLine *el, int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_redo(EditLine *el, int c)
+vi_redo(EditLine *el, int c __attribute__((__unused__)))
 {
 	c_redo_t *r = &el->el_chared.c_redo;
 

=== modified file 'cmd-line-utils/readline/complete.c'
--- a/cmd-line-utils/readline/complete.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/complete.c	revid:vasil.dimov@stripped
@@ -1839,8 +1839,11 @@ rl_username_completion_function (text, s
 #else /* !__WIN32__ && !__OPENNT) */
   static char *username = (char *)NULL;
   static struct passwd *entry;
-  static int namelen, first_char, first_char_loc;
+  static int first_char, first_char_loc;
   char *value;
+#if defined (HAVE_GETPWENT)
+  static int namelen;
+#endif
 
   if (state == 0)
     {
@@ -1850,7 +1853,9 @@ rl_username_completion_function (text, s
       first_char_loc = first_char == '~';
 
       username = savestring (&text[first_char_loc]);
+#if defined (HAVE_GETPWENT)
       namelen = strlen (username);
+#endif
       setpwent ();
     }
 

=== modified file 'cmd-line-utils/readline/histexpand.c'
--- a/cmd-line-utils/readline/histexpand.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/histexpand.c	revid:vasil.dimov@stripped
@@ -693,7 +693,7 @@ history_expand_internal (string, start, 
 	case 's':
 	  {
 	    char *new_event;
-	    int delimiter, failed, si, l_temp, ws, we;
+	    int delimiter, failed, si, l_temp, we;
 
 	    if (c == 's')
 	      {
@@ -792,7 +792,6 @@ history_expand_internal (string, start, 
 		  {
 		    for (; temp[si] && whitespace (temp[si]); si++)
 		      ;
-		    ws = si;
 		    we = history_tokenize_word (temp, si);
 		  }
 

=== modified file 'cmd-line-utils/readline/histfile.c'
--- a/cmd-line-utils/readline/histfile.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/histfile.c	revid:vasil.dimov@stripped
@@ -402,6 +402,7 @@ history_truncate_file (fname, lines)
   if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
     {
       bytes_written= write (file, bp, chars_read - (bp - buffer));
+      (void) bytes_written;
 
 #if defined (__BEOS__)
       /* BeOS ignores O_TRUNC. */

=== modified file 'cmd-line-utils/readline/isearch.c'
--- a/cmd-line-utils/readline/isearch.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/isearch.c	revid:vasil.dimov@stripped
@@ -617,7 +617,7 @@ rl_search_history (direction, invoking_k
      int direction, invoking_key __attribute__((unused));
 {
   _rl_search_cxt *cxt;		/* local for now, but saved globally */
-  int c, r;
+  int r;
 
   RL_SETSTATE(RL_STATE_ISEARCH);
   cxt = _rl_isearch_init (direction);
@@ -632,7 +632,7 @@ rl_search_history (direction, invoking_k
   r = -1;
   for (;;)
     {
-      c = _rl_search_getchar (cxt);
+      _rl_search_getchar (cxt);
       /* We might want to handle EOF here (c == 0) */
       r = _rl_isearch_dispatch (cxt, cxt->lastc);
       if (r <= 0)
@@ -655,9 +655,9 @@ int
 _rl_isearch_callback (cxt)
      _rl_search_cxt *cxt;
 {
-  int c, r;
+  int r;
 
-  c = _rl_search_getchar (cxt);
+  _rl_search_getchar (cxt);
   /* We might want to handle EOF here */
   r = _rl_isearch_dispatch (cxt, cxt->lastc);
 

=== modified file 'cmd-line-utils/readline/parens.c'
--- a/cmd-line-utils/readline/parens.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/parens.c	revid:vasil.dimov@stripped
@@ -115,7 +115,7 @@ rl_insert_close (count, invoking_key)
   else
     {
 #if defined (HAVE_SELECT)
-      int orig_point, match_point, ready;
+      int orig_point, match_point;
       struct timeval timer;
       fd_set readfds;
 
@@ -136,7 +136,7 @@ rl_insert_close (count, invoking_key)
       orig_point = rl_point;
       rl_point = match_point;
       (*rl_redisplay_function) ();
-      ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+      select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
       rl_point = orig_point;
 #else /* !HAVE_SELECT */
       _rl_insert_char (count, invoking_key);

=== modified file 'cmd-line-utils/readline/readline.c'
--- a/cmd-line-utils/readline/readline.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/readline.c	revid:vasil.dimov@stripped
@@ -447,11 +447,10 @@ readline_internal_char ()
 readline_internal_charloop ()
 #endif
 {
-  static int lastc, eof_found;
+  static int lastc;
   int c, code, lk;
 
   lastc = -1;
-  eof_found = 0;
 
 #if !defined (READLINE_CALLBACKS)
   while (rl_done == 0)

=== modified file 'cmd-line-utils/readline/terminal.c'
--- a/cmd-line-utils/readline/terminal.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/terminal.c	revid:vasil.dimov@stripped
@@ -268,7 +268,7 @@ _rl_get_screen_size (tty, ignore_env)
 
 #if !defined (__DJGPP__)
       if (_rl_screenwidth <= 0 && term_string_buffer)
-	_rl_screenwidth = tgetnum ("co");
+	_rl_screenwidth = tgetnum ((char *)"co");
 #endif
     }
 
@@ -284,7 +284,7 @@ _rl_get_screen_size (tty, ignore_env)
 
 #if !defined (__DJGPP__)
       if (_rl_screenheight <= 0 && term_string_buffer)
-	_rl_screenheight = tgetnum ("li");
+	_rl_screenheight = tgetnum ((char *)"li");
 #endif
     }
 
@@ -516,7 +516,7 @@ _rl_init_terminal_io (terminal_name)
   if (!_rl_term_cr)
     _rl_term_cr = "\r";
 
-  _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
+  _rl_term_autowrap = tgetflag ((char *)"am") && tgetflag ((char *)"xn");
 
   /* Allow calling application to set default height and width, using
      rl_set_screen_size */
@@ -531,7 +531,7 @@ _rl_init_terminal_io (terminal_name)
 
   /* Check to see if this terminal has a meta key and clear the capability
      variables if there is none. */
-  term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
+  term_has_meta = (tgetflag ((char *)"km") || tgetflag ((char *)"MT"));
   if (!term_has_meta)
     _rl_term_mm = _rl_term_mo = (char *)NULL;
 

=== modified file 'cmd-line-utils/readline/text.c'
--- a/cmd-line-utils/readline/text.c	revid:inaam.rana@stripped
+++ b/cmd-line-utils/readline/text.c	revid:vasil.dimov@stripped
@@ -811,11 +811,10 @@ _rl_overwrite_char (count, c)
   int i;
 #if defined (HANDLE_MULTIBYTE)
   char mbkey[MB_LEN_MAX];
-  int k;
 
   /* Read an entire multibyte character sequence to insert COUNT times. */
   if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-    k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
+    _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
 #endif
 
   rl_begin_undo_group ();

=== modified file 'config/ac-macros/maintainer.m4'
--- a/config/ac-macros/maintainer.m4	revid:inaam.rana@stripped
+++ b/config/ac-macros/maintainer.m4	revid:vasil.dimov@stripped
@@ -8,7 +8,8 @@ AC_DEFUN([MY_MAINTAINER_MODE], [
     [AS_HELP_STRING([--enable-mysql-maintainer-mode],
                     [Enable a MySQL maintainer-specific development environment])],
     [USE_MYSQL_MAINTAINER_MODE=$enableval],
-    [USE_MYSQL_MAINTAINER_MODE=no])
+    [AS_IF([test "$with_debug" != "no"],
+      [USE_MYSQL_MAINTAINER_MODE=yes], [USE_MYSQL_MAINTAINER_MODE=no])])
   AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE])
 ])
 

=== modified file 'configure.in'
--- a/configure.in	revid:inaam.rana@stripped
+++ b/configure.in	revid:vasil.dimov@stripped
@@ -103,6 +103,13 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 AC_SUBST(SHARED_LIB_VERSION)
 AC_SUBST(AVAILABLE_LANGUAGES)
 
+# Check whether a debug mode should be enabled.
+AC_ARG_WITH([debug],
+    AS_HELP_STRING([--with-debug@<:@=full@:>@],
+      [Enable various amounts of debugging support (full adds a slow memory checker).]),
+    [with_debug=$withval],
+    [with_debug=no])
+
 # Whether the maintainer mode should be enabled.
 MY_MAINTAINER_MODE
 
@@ -1674,11 +1681,6 @@ then
   DEBUG_OPTIMIZE_CXX=""
 fi
 
-AC_ARG_WITH(debug,
-    [  --with-debug            Add debug code
-  --with-debug=full       Add debug code (adds memory checker, very slow)],
-    [with_debug=$withval],
-    [with_debug=no])
 if test "$with_debug" = "yes"
 then
   # Medium debug.
@@ -2071,6 +2073,13 @@ MYSQL_TYPE_QSORT
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
 
+AC_CHECK_DECLS([fdatasync],,,
+[
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+])
+
 AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
   chsize cuserid fchmod fcntl \
   fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \

=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	revid:inaam.rana@stripped
+++ b/dbug/dbug.c	revid:vasil.dimov@stripped
@@ -744,6 +744,7 @@ void _db_set_init_(const char *control)
   CODE_STATE tmp_cs;
   bzero((uchar*) &tmp_cs, sizeof(tmp_cs));
   tmp_cs.stack= &init_settings;
+  tmp_cs.process= db_process ? db_process : "dbug";
   DbugParse(&tmp_cs, control);
 }
 
@@ -2267,6 +2268,14 @@ static void dbug_flush(CODE_STATE *cs)
 } /* dbug_flush */
 
 
+void _db_flush_()
+{
+  CODE_STATE *cs= NULL;
+  get_code_state_or_return;
+  (void) fflush(cs->stack->out_file);
+}
+
+
 void _db_lock_file_()
 {
   CODE_STATE *cs=0;

=== modified file 'include/my_compiler.h'
--- a/include/my_compiler.h	revid:inaam.rana@stripped
+++ b/include/my_compiler.h	revid:vasil.dimov@stripped
@@ -32,8 +32,15 @@
 
 /* GNU C/C++ */
 #if defined __GNUC__
+/* Convenience macro to test the minimum required GCC version. */
+# define MY_GNUC_PREREQ(maj, min) \
+    ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 /* Any after 2.95... */
 # define MY_ALIGN_EXT
+/* Comunicate to the compiler the unreachability of the code. */
+# if MY_GNUC_PREREQ(4,5)
+#   define MY_ASSERT_UNREACHABLE()   __builtin_unreachable()
+# endif
 
 /* Microsoft Visual C++ */
 #elif defined _MSC_VER
@@ -67,7 +74,7 @@
 #endif
 
 /**
-  Generic compiler-dependent features.
+  Generic (compiler-independent) features.
 */
 #ifndef MY_ALIGNOF
 # ifdef __cplusplus
@@ -79,6 +86,10 @@
 # endif
 #endif
 
+#ifndef MY_ASSERT_UNREACHABLE
+# define MY_ASSERT_UNREACHABLE()  do { assert(0); } while (0)
+#endif
+
 /**
   C++ Type Traits
 */

=== modified file 'include/my_dbug.h'
--- a/include/my_dbug.h	revid:inaam.rana@stripped
+++ b/include/my_dbug.h	revid:vasil.dimov@stripped
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2010, 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
@@ -13,8 +13,18 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#ifndef _dbug_h
-#define _dbug_h
+#ifndef MY_DBUG_INCLUDED
+#define MY_DBUG_INCLUDED
+
+#ifndef __WIN__
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#endif  /* not __WIN__ */
 
 #if defined(__cplusplus) && !defined(DBUG_OFF)
 class Dbug_violation_helper
@@ -69,6 +79,7 @@ extern	void _db_end_(void);
 extern	void _db_lock_file_(void);
 extern	void _db_unlock_file_(void);
 extern FILE *_db_fp_(void);
+extern  void _db_flush_();
 
 #ifdef __cplusplus
 
@@ -124,6 +135,34 @@ extern FILE *_db_fp_(void);
 #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
 #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
 #define IF_DBUG(A) A
+#ifndef __WIN__
+#define DBUG_ABORT()                    (_db_flush_(), abort())
+#else
+/*
+  Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
+  call abort() instead of _exit(3) (now it would cause a "test signal" popup).
+*/
+#include <crtdbg.h>
+#define DBUG_ABORT() (_db_flush_(),\
+                     (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
+                     (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
+                     _exit(3))
+#endif
+
+/*
+  Make the program fail, without creating a core file.
+  abort() will send SIGABRT which (most likely) generates core.
+  Use SIGKILL instead, which cannot be caught.
+  We also pause the current thread, until the signal is actually delivered.
+  An alternative would be to use _exit(EXIT_FAILURE),
+  but then valgrind would report lots of memory leaks.
+ */
+#ifdef __WIN__
+#define DBUG_SUICIDE() DBUG_ABORT()
+#else
+#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL), pause())
+#endif
+
 #else						/* No debugger */
 
 #define DBUG_ENTER(a1)
@@ -152,8 +191,12 @@ extern FILE *_db_fp_(void);
 #define DBUG_EXPLAIN(buf,len)
 #define DBUG_EXPLAIN_INITIAL(buf,len)
 #define IF_DBUG(A)
+#define DBUG_ABORT()                    do { } while(0)
+#define DBUG_SUICIDE()                  do { } while(0)
+
 #endif
 #ifdef	__cplusplus
 }
 #endif
-#endif
+
+#endif /* MY_DBUG_INCLUDED */

=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	revid:inaam.rana@stripped
+++ b/include/my_pthread.h	revid:vasil.dimov@stripped
@@ -492,7 +492,8 @@ int safe_mutex_destroy(safe_mutex_t *mp,
 int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
 		   uint line);
 int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
-			struct timespec *abstime, const char *file, uint line);
+                        const struct timespec *abstime,
+                        const char *file, uint line);
 void safe_mutex_global_init(void);
 void safe_mutex_end(FILE *file);
 

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	revid:inaam.rana@stripped
+++ b/mysql-test/collections/default.experimental	revid:vasil.dimov@stripped
@@ -43,8 +43,6 @@ parts.partition_mgm_lc1_ndb             
 parts.partition_mgm_lc2_ndb              # joro : NDB tests marked as experimental as agreed with bochklin
 parts.partition_syntax_ndb               # joro : NDB tests marked as experimental as agreed with bochklin
 parts.partition_value_ndb                # joro : NDB tests marked as experimental as agreed with bochklin
-main.mysqlhotcopy_myisam                 # horst: due to bug#54129
-main.mysqlhotcopy_archive                # horst: due to bug#54129
 main.gis-rtree                           # svoj: due to BUG#38965
 main.type_float                          # svoj: due to BUG#38965
 main.type_newdecimal                     # svoj: due to BUG#38965

=== modified file 'mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test'
--- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test	revid:inaam.rana@stripped
+++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test	revid:vasil.dimov@stripped
@@ -34,7 +34,7 @@
 #
 
 connection slave;
-if (`SELECT $debug_sync_action = ''`)
+if (!$debug_sync_action)
 {
     --die Cannot continue. Please set value for debug_sync_action.
 }

=== modified file 'mysql-test/extra/rpl_tests/rpl_loaddata.test'
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test	revid:inaam.rana@stripped
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test	revid:vasil.dimov@stripped
@@ -24,7 +24,7 @@ connection master;
 # MTR is not case-sensitive.
 let $lower_stmt_head= load data;
 let $UPPER_STMT_HEAD= LOAD DATA;
-if (`SELECT '$lock_option' <> ''`)
+if ($lock_option)
 {
   #if $lock_option is null, an extra blank is added into the statement,
   #this will change the result of rpl_loaddata test case. so $lock_option

=== added file 'mysql-test/extra/rpl_tests/rpl_stop_slave.test'
--- a/mysql-test/extra/rpl_tests/rpl_stop_slave.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test	revid:vasil.dimov@stripped
@@ -0,0 +1,61 @@
+#
+# Auxiliary file which is used to test BUG#56118 
+#
+# Slave should apply all statements in the transaction before stop if any
+# temporary table is created or dropped.
+#
+# USEAGE: 
+# --let $tmp_table_stm= a SQL statement 
+# --source extra/rpl_tests/rpl_stop_slave.test
+#
+
+if (`SELECT "$tmp_table_stm" = ''`)
+{
+  --echo \$tmp_table_stm is NULL
+  --die $tmp_table_stm is NULL
+}
+
+--echo
+--echo [ On Master ]
+connection master;
+BEGIN;
+DELETE FROM t1;
+eval $tmp_table_stm;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+--echo
+--echo [ On Slave ]
+connection slave;
+
+# To check if slave SQL thread is applying INSERT statement
+let $show_statement= SHOW PROCESSLIST;
+let $field= Info;
+let $condition= LIKE 'INSERT%';
+source include/wait_show_condition.inc;
+
+send STOP SLAVE SQL_THREAD;
+
+--echo
+--echo [ On Slave1 ]
+connection slave1;
+--echo # To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+--echo
+--echo [ On Slave ]
+connection slave;
+reap;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo # Slave should stop after the transaction has committed.
+--echo # So t1 on master is same to t1 on slave.
+let diff_table_1=master:test.t1;
+let diff_table_2=slave:test.t1;
+source include/diff_tables.inc;
+
+connection slave;
+START SLAVE SQL_THREAD;
+source include/wait_for_slave_sql_to_start.inc;

=== modified file 'mysql-test/include/check_concurrent_insert.inc'
--- a/mysql-test/include/check_concurrent_insert.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/check_concurrent_insert.inc	revid:vasil.dimov@stripped
@@ -23,7 +23,7 @@
 # Reset DEBUG_SYNC facility for safety.
 set debug_sync= "RESET";
 
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
 {
 --eval create temporary table t_backup select * from $restore_table;
 }
@@ -82,7 +82,7 @@ connection default;
 
 --eval delete from $table where i = 0;
 
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
 {
 --eval truncate table $restore_table;
 --eval insert into $restore_table select * from t_backup;

=== modified file 'mysql-test/include/check_no_concurrent_insert.inc'
--- a/mysql-test/include/check_no_concurrent_insert.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/check_no_concurrent_insert.inc	revid:vasil.dimov@stripped
@@ -23,7 +23,7 @@
 # Reset DEBUG_SYNC facility for safety.
 set debug_sync= "RESET";
 
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
 {
 --eval create temporary table t_backup select * from $restore_table;
 }
@@ -67,7 +67,7 @@ if (!$success)
 
 --eval delete from $table where i = 0;
 
-if (`SELECT '$restore_table' <> ''`)
+if ($restore_table)
 {
 --eval truncate table $restore_table;
 --eval insert into $restore_table select * from t_backup;

=== modified file 'mysql-test/include/get_relay_log_pos.inc'
--- a/mysql-test/include/get_relay_log_pos.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/get_relay_log_pos.inc	revid:vasil.dimov@stripped
@@ -10,12 +10,12 @@
 #   # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
 #   # in $relay_log_file: $relay_log_pos. 
 
-if (`SELECT '$relay_log_file' = ''`)
+if (!$relay_log_file)
 {
   --die 'variable $relay_log_file is null'
 }
 
-if (`SELECT '$master_log_pos' = ''`)
+if (!$master_log_pos)
 {
   --die 'variable $master_log_pos is null'
 }

=== modified file 'mysql-test/include/kill_query.inc'
--- a/mysql-test/include/kill_query.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/kill_query.inc	revid:vasil.dimov@stripped
@@ -44,7 +44,7 @@ connection master;
 # kill the query that is waiting
 eval kill query $connection_id;
 
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
 {
   # release the lock to allow binlog continue
   eval SELECT RELEASE_LOCK($debug_lock);
@@ -57,7 +57,7 @@ reap;
 
 connection master;
 
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
 {
   # get lock again to make the next query wait
   eval SELECT GET_LOCK($debug_lock, 10);

=== modified file 'mysql-test/include/kill_query_and_diff_master_slave.inc'
--- a/mysql-test/include/kill_query_and_diff_master_slave.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/kill_query_and_diff_master_slave.inc	revid:vasil.dimov@stripped
@@ -25,7 +25,7 @@ source include/kill_query.inc;
 connection master;
 disable_query_log;
 disable_result_log;
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
 {
   eval SELECT RELEASE_LOCK($debug_lock);
 }
@@ -36,8 +36,8 @@ source include/diff_master_slave.inc;
 
 # Acquire the debug lock again if used
 connection master;
-disable_query_log; disable_result_log; if (`SELECT '$debug_lock' !=
-''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log;
-enable_query_log;
+disable_query_log; disable_result_log;
+if ($debug_lock) { eval SELECT GET_LOCK($debug_lock, 10); }
+enable_result_log; enable_query_log;
 
 connection $connection_name;

=== modified file 'mysql-test/include/setup_fake_relay_log.inc'
--- a/mysql-test/include/setup_fake_relay_log.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/setup_fake_relay_log.inc	revid:vasil.dimov@stripped
@@ -56,7 +56,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "
 # Read server variables.
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1);
-if (`SELECT '$_fake_filename' = ''`) {
+if (!$_fake_filename) {
   --echo Badly written test case: relay_log variable is empty. Please use the
   --echo server option --relay-log=FILE.
 }

=== modified file 'mysql-test/include/show_binlog_events.inc'
--- a/mysql-test/include/show_binlog_events.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/show_binlog_events.inc	revid:vasil.dimov@stripped
@@ -27,14 +27,14 @@ if (!$binlog_start)
 }
 
 --let $_statement=show binlog events
-if (`SELECT '$binlog_file' <> ''`)
+if ($binlog_file)
 {
   --let $_statement= $_statement in '$binlog_file'
 }
 
 --let $_statement= $_statement from $binlog_start
 
-if (`SELECT '$binlog_limit' <> ''`)
+if ($binlog_limit)
 {
   --let $_statement= $_statement limit $binlog_limit
 }

=== modified file 'mysql-test/include/show_rpl_debug_info.inc'
--- a/mysql-test/include/show_rpl_debug_info.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/show_rpl_debug_info.inc	revid:vasil.dimov@stripped
@@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW 
 eval SHOW BINLOG EVENTS IN '$binlog_name';
 
 let $_master_con= $master_connection;
-if (`SELECT '$_master_con' = ''`)
+if (!$_master_con)
 {
   if (`SELECT '$_con' = 'slave'`)
   {
     let $_master_con= master;
   }
-  if (`SELECT '$_master_con' = ''`)
+  if (!$_master_con)
   {
     --echo Unable to determine master connection. No debug info printed for master.
     --echo Please fix the test case by setting $master_connection before sourcing
@@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`)
   }
 }
 
-if (`SELECT '$_master_con' != ''`)
+if ($_master_con)
 {
 
   let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);

=== modified file 'mysql-test/include/wait_for_slave_io_error.inc'
--- a/mysql-test/include/wait_for_slave_io_error.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/wait_for_slave_io_error.inc	revid:vasil.dimov@stripped
@@ -31,7 +31,7 @@
 # $master_connection
 #   See wait_for_slave_param.inc for description.
 
-if (`SELECT '$slave_io_errno' = ''`) {
+if (!$slave_io_errno) {
   --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
 }
 

=== modified file 'mysql-test/include/wait_for_slave_param.inc'
--- a/mysql-test/include/wait_for_slave_param.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/wait_for_slave_param.inc	revid:vasil.dimov@stripped
@@ -51,7 +51,7 @@ if (!$_slave_timeout_counter)
 }
 
 let $_slave_param_comparison= $slave_param_comparison;
-if (`SELECT '$_slave_param_comparison' = ''`)
+if (!$_slave_param_comparison)
 {
   let $_slave_param_comparison= =;
 }
@@ -71,7 +71,7 @@ while (`SELECT NOT('$_show_slave_status_
 if (!$_slave_timeout_counter)
 {
   --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
-  if (`SELECT '$slave_error_message' != ''`)
+  if ($slave_error_message)
   {
     --echo Message: $slave_error_message
   }

=== modified file 'mysql-test/include/wait_for_slave_sql_error.inc'
--- a/mysql-test/include/wait_for_slave_sql_error.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/wait_for_slave_sql_error.inc	revid:vasil.dimov@stripped
@@ -24,7 +24,7 @@
 # $master_connection
 #   See wait_for_slave_param.inc for description.
 
-if (`SELECT '$slave_sql_errno' = ''`) {
+if (!$slave_sql_errno) {
   --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc
 }
 

=== modified file 'mysql-test/include/wait_for_status_var.inc'
--- a/mysql-test/include/wait_for_status_var.inc	revid:inaam.rana@stripped
+++ b/mysql-test/include/wait_for_status_var.inc	revid:vasil.dimov@stripped
@@ -45,7 +45,7 @@ if (!$_status_timeout_counter)
 }
 
 let $_status_var_comparsion= $status_var_comparsion;
-if (`SELECT '$_status_var_comparsion' = ''`)
+if (!$_status_var_comparsion)
 {
   let $_status_var_comparsion= =;
 }

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	revid:inaam.rana@stripped
+++ b/mysql-test/mysql-test-run.pl	revid:vasil.dimov@stripped
@@ -587,13 +587,15 @@ sub run_test_server ($$$) {
 	  if ($test_has_failed and $retries <= $opt_retry){
 	    # Test should be run one more time unless it has failed
 	    # too many times already
+	    my $tname= $result->{name};
 	    my $failures= $result->{failures};
 	    if ($opt_retry > 1 and $failures >= $opt_retry_failure){
-	      mtr_report("\nTest has failed $failures times,",
+	      mtr_report("\nTest $tname has failed $failures times,",
 			 "no more retries!\n");
 	    }
 	    else {
-	      mtr_report("\nRetrying test, attempt($retries/$opt_retry)...\n");
+	      mtr_report("\nRetrying test $tname, ".
+			 "attempt($retries/$opt_retry)...\n");
 	      delete($result->{result});
 	      $result->{retries}= $retries+1;
 	      $result->write_test($sock, 'TESTCASE');
@@ -3101,7 +3103,8 @@ sub check_testcase($$)
 	    "\nMTR's internal check of the test case '$tname' failed.
 This means that the test case does not preserve the state that existed
 before the test case was executed.  Most likely the test case did not
-do a proper clean-up.
+do a proper clean-up. It could also be caused by the previous test run
+by this thread, if the server wasn't restarted.
 This is the diff of the states of the servers before and after the
 test case was executed:\n";
 	  $tinfo->{check}.= $report;
@@ -3143,6 +3146,10 @@ test case was executed:\n";
     # Kill any check processes still running
     map($_->kill(), values(%started));
 
+    mtr_warning("Check-testcase failed, this could also be caused by the" .
+		" previous test run by this worker thread")
+      if $result > 1 && $mode eq "before";
+
     return $result;
   }
 
@@ -3796,7 +3803,9 @@ sub get_log_from_proc ($$) {
   foreach my $mysqld (mysqlds()) {
     if ($mysqld->{proc} eq $proc) {
       my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
-      $srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
+      $srv_log= "\nServer log from this test:\n" .
+	"----------SERVER LOG START-----------\n". join ("", @srv_lines) .
+	"----------SERVER LOG END-------------\n";
       last;
     }
   }

=== modified file 'mysql-test/r/grant3.result'
--- a/mysql-test/r/grant3.result	revid:inaam.rana@stripped
+++ b/mysql-test/r/grant3.result	revid:vasil.dimov@stripped
@@ -21,123 +21,108 @@ grant select on test.* to CUser@LOCALHOS
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
 user	host	db	select_priv
-CUser	LOCALHOST	test	Y
 CUser	localhost	test	Y
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
 user	host	db	select_priv
-CUser	localhost	test	Y
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
 user	host	db	select_priv
 DROP USER CUser@localhost;
 DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
 create table t1 (a int);
 grant select on test.t1 to CUser@localhost;
 grant select on test.t1 to CUser@LOCALHOST;
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
-CUser	LOCALHOST	test	t1	Select	
 CUser	localhost	test	t1	Select	
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
-CUser	localhost	test	t1	Select	
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
 DROP USER CUser@localhost;
 DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
 grant select(a) on test.t1 to CUser@localhost;
 grant select(a) on test.t1 to CUser@LOCALHOST;
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
-CUser	LOCALHOST	test	t1		Select
 CUser	localhost	test	t1		Select
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
-CUser	localhost	test	t1		Select
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
 user	host
-CUser	LOCALHOST
 CUser	localhost
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 user	host	db	Table_name	Table_priv	Column_priv
 DROP USER CUser@localhost;
 DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
 drop table t1;
 grant select on test.* to CUser2@localhost;
 grant select on test.* to CUser2@LOCALHOST;
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
 user	host
-CUser2	LOCALHOST
 CUser2	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
 user	host	db	select_priv
-CUser2	LOCALHOST	test	Y
 CUser2	localhost	test	Y
 REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST';
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
 user	host
-CUser2	LOCALHOST
 CUser2	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
 user	host	db	select_priv
-CUser2	localhost	test	Y
 REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
+ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost'
 flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
 user	host
-CUser2	LOCALHOST
 CUser2	localhost
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
 user	host	db	select_priv
 DROP USER CUser2@localhost;
 DROP USER CUser2@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser2'@'localhost'
 CREATE DATABASE mysqltest_1;
 CREATE TABLE mysqltest_1.t1 (a INT);
 CREATE USER 'mysqltest1'@'%';

=== added file 'mysql-test/r/lowercase_table4.result'
--- a/mysql-test/r/lowercase_table4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/lowercase_table4.result	revid:vasil.dimov@stripped
@@ -0,0 +1,7 @@
+#
+# Bug#46941 crash with lower_case_table_names=2 and
+#           foreign data dictionary confusion
+#
+CREATE DATABASE XY;
+USE XY;
+DROP DATABASE XY;

=== modified file 'mysql-test/suite/binlog/t/disabled.def'
--- a/mysql-test/suite/binlog/t/disabled.def	revid:inaam.rana@stripped
+++ b/mysql-test/suite/binlog/t/disabled.def	revid:vasil.dimov@stripped
@@ -9,5 +9,6 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-binlog_truncate_innodb	: BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
+binlog_truncate_innodb	: BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
+
 

=== modified file 'mysql-test/suite/rpl/r/rpl_do_grant.result'
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result	revid:inaam.rana@stripped
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result	revid:vasil.dimov@stripped
@@ -260,4 +260,27 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	use `test`; grant all on *.* to foo@"1.2.3.4"
 master-bin.000001	#	Query	#	#	use `test`; revoke all privileges, grant option from "foo"
 DROP USER foo@"1.2.3.4";
+
+# Bug#27606 GRANT statement should be replicated with DEFINER information
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+DROP USER user_bug27606@localhost;
 "End of test"

=== added file 'mysql-test/suite/rpl/r/rpl_stop_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result	revid:vasil.dimov@stripped
@@ -0,0 +1,127 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+# BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
+#
+# If a temporary table is created or dropped, the transaction should be
+# regarded similarly that a non-transactional table is modified. So 
+# STOP SLAVE should wait until the transaction has finished.
+CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
+CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
+SET DEBUG_SYNC= 'RESET';
+include/stop_slave.inc
+
+# Suspend the INSERT statement in current transaction on SQL thread.
+# It guarantees that SQL thread is applying the transaction when
+# STOP SLAVE command launchs.
+SET GLOBAL debug= 'd,after_mysql_insert';
+include/start_slave.inc
+
+# CREATE TEMPORARY TABLE with InnoDB engine
+# -----------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+
+# CREATE TEMPORARY TABLE with MyISAM engine
+# -----------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+
+# CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
+# ----------------------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
+SELECT c1 FROM t2;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+
+# CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
+# ----------------------------------------------------
+
+[ On Master ]
+BEGIN;
+DELETE FROM t1;
+CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
+SELECT 1 AS c1;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+[ On Slave ]
+STOP SLAVE SQL_THREAD;
+
+[ On Slave1 ]
+# To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+[ On Slave ]
+# Slave should stop after the transaction has committed.
+# So t1 on master is same to t1 on slave.
+Comparing tables master:test.t1 and slave:test.t1
+START SLAVE SQL_THREAD;
+# Test end
+SET GLOBAL debug= '$debug_save';
+DROP TABLE t1, t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result'
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	revid:inaam.rana@stripped
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	revid:vasil.dimov@stripped
@@ -69,3 +69,47 @@ slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
 slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE t3, t1
+
+# Bug#55478 Row events wrongly apply on the temporary table of the same name
+# ==========================================================================
+# The statement should be binlogged
+CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
+
+# Case 1: CREATE TABLE t1 ... SELECT
+# ----------------------------------
+
+# The statement generates row events on t1. And the rows events should
+# be inserted into the base table on slave.
+CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE `t1` (
+  `rand()` double NOT NULL DEFAULT '0'
+) ENGINE=MyISAM
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+
+# Case 2: DROP TEMPORARY TABLE in a transacation(happens only on 5.5+)
+# --------------------------------------------------------------------
+
+BEGIN;
+DROP TEMPORARY TABLE t1;
+# The statement will binlogged after 'DROP TEMPORARY TABLE t1'
+INSERT INTO t1 VALUES(1);
+# The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
+INSERT INTO t1 VALUES(Rand());
+COMMIT;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(1)
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+# Compare the base table.
+Comparing tables master:test.t1 and slave:test.t1
+
+DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/t/rpl_do_grant.test'
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test	revid:inaam.rana@stripped
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test	revid:vasil.dimov@stripped
@@ -355,4 +355,25 @@ revoke all privileges, grant option from
 DROP USER foo@"1.2.3.4";
 -- sync_slave_with_master
 
+--echo 
+--echo # Bug#27606 GRANT statement should be replicated with DEFINER information
+--connection master
+--source include/master-slave-reset.inc
+--connection master
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+sync_slave_with_master;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+
+--connection master
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+sync_slave_with_master;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+
+--connection master
+DROP USER user_bug27606@localhost;
+
+--source include/master-slave-end.inc
 --echo "End of test"

=== modified file 'mysql-test/suite/rpl/t/rpl_killed_ddl.test'
--- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test	revid:inaam.rana@stripped
+++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test	revid:vasil.dimov@stripped
@@ -119,7 +119,7 @@ echo [on master];
 
 # This will block the execution of a statement at the DBUG_SYNC_POINT
 # with given lock name
-if (`SELECT '$debug_lock' != ''`)
+if ($debug_lock)
 {
   disable_query_log;
   disable_result_log;

=== added file 'mysql-test/suite/rpl/t/rpl_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test	revid:vasil.dimov@stripped
@@ -0,0 +1,60 @@
+source include/master-slave.inc;
+source include/have_innodb.inc;
+source include/have_debug.inc;
+source include/have_debug_sync.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
+
+--echo
+--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
+--echo #
+--echo # If a temporary table is created or dropped, the transaction should be
+--echo # regarded similarly that a non-transactional table is modified. So 
+--echo # STOP SLAVE should wait until the transaction has finished.
+
+CREATE TABLE t1(c1 INT) ENGINE=InnoDB;
+CREATE TABLE t2(c1 INT) ENGINE=InnoDB;
+
+sync_slave_with_master;
+SET DEBUG_SYNC= 'RESET';
+source include/stop_slave.inc;
+
+--echo
+--echo # Suspend the INSERT statement in current transaction on SQL thread.
+--echo # It guarantees that SQL thread is applying the transaction when
+--echo # STOP SLAVE command launchs.
+let $debug_save= `SELECT @@GLOBAL.debug`;
+SET GLOBAL debug= 'd,after_mysql_insert';
+source include/start_slave.inc;
+
+--echo
+--echo # CREATE TEMPORARY TABLE with InnoDB engine
+--echo # -----------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+--echo
+--echo # CREATE TEMPORARY TABLE with MyISAM engine
+--echo # -----------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+--echo
+--echo # CREATE TEMPORARY TABLE ... SELECT with InnoDB engine
+--echo # ----------------------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = InnoDB
+                    SELECT c1 FROM t2;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+--echo
+--echo # CREATE TEMPORARY TABLE ... SELECT with MyISAM engine
+--echo # ----------------------------------------------------
+let $tmp_table_stm= CREATE TEMPORARY TABLE tt1(c1 INT) ENGINE = MyISAM
+                    SELECT 1 AS c1;
+source extra/rpl_tests/rpl_stop_slave.test;
+
+--echo # Test end
+SET GLOBAL debug= '$debug_save';
+
+connection master;
+DROP TABLE t1, t2;
+source include/master-slave-end.inc;

=== modified file 'mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test'
--- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test	revid:inaam.rana@stripped
+++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test	revid:vasil.dimov@stripped
@@ -11,6 +11,7 @@
 
 source include/master-slave.inc;
 source include/have_binlog_format_mixed.inc;
+source include/have_innodb.inc;
 
 --echo ==== Initialize ====
 
@@ -146,3 +147,55 @@ DROP TABLE t3, t1;
 -- sync_slave_with_master
 
 -- source include/show_binlog_events.inc
+
+--echo
+--echo # Bug#55478 Row events wrongly apply on the temporary table of the same name
+--echo # ==========================================================================
+connection master;
+
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo # The statement should be binlogged
+CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
+
+--echo
+--echo # Case 1: CREATE TABLE t1 ... SELECT
+--echo # ----------------------------------
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # The statement generates row events on t1. And the rows events should
+--echo # be inserted into the base table on slave.
+CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
+
+source include/show_binlog_events.inc;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Case 2: DROP TEMPORARY TABLE in a transacation(happens only on 5.5+)
+--echo # --------------------------------------------------------------------
+--echo
+
+BEGIN;
+DROP TEMPORARY TABLE t1;
+
+--echo # The statement will binlogged after 'DROP TEMPORARY TABLE t1'
+INSERT INTO t1 VALUES(1);
+
+--echo # The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
+INSERT INTO t1 VALUES(Rand());
+COMMIT;
+
+source include/show_binlog_events.inc;
+
+--echo # Compare the base table.
+let diff_table= test.t1;
+source include/rpl_diff_tables.inc;
+
+--echo
+connection master;
+DROP TABLE t1;
+source include/master-slave-end.inc;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	revid:inaam.rana@stripped
+++ b/mysql-test/t/disabled.def	revid:vasil.dimov@stripped
@@ -11,5 +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
-main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst
-main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst
+main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
+main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails

=== modified file 'mysql-test/t/grant3.test'
--- a/mysql-test/t/grant3.test	revid:inaam.rana@stripped
+++ b/mysql-test/t/grant3.test	revid:vasil.dimov@stripped
@@ -64,6 +64,7 @@ SELECT user, host FROM mysql.user where 
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
 
 DROP USER CUser@localhost;
+--error ER_CANNOT_USER
 DROP USER CUser@LOCALHOST;
 
 #### table grants
@@ -88,6 +89,7 @@ SELECT user, host FROM mysql.user where 
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 
 DROP USER CUser@localhost;
+--error ER_CANNOT_USER
 DROP USER CUser@LOCALHOST;
 
 ### column grants
@@ -112,6 +114,7 @@ SELECT user, host FROM mysql.user where 
 SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
 
 DROP USER CUser@localhost;
+--error ER_CANNOT_USER
 DROP USER CUser@LOCALHOST;
 
 drop table t1;
@@ -131,6 +134,7 @@ flush privileges;
 SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
 
+--error ER_NONEXISTING_GRANT
 REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
 flush privileges;
 
@@ -138,6 +142,7 @@ SELECT user, host FROM mysql.user where 
 SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
 
 DROP USER CUser2@localhost;
+--error ER_CANNOT_USER
 DROP USER CUser2@LOCALHOST;
 
 

=== added file 'mysql-test/t/lowercase_table4-master.opt'
--- a/mysql-test/t/lowercase_table4-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_table4-master.opt	revid:vasil.dimov@stripped
@@ -0,0 +1 @@
+--lower-case-table-names=2

=== added file 'mysql-test/t/lowercase_table4.test'
--- a/mysql-test/t/lowercase_table4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_table4.test	revid:vasil.dimov@stripped
@@ -0,0 +1,56 @@
+--source include/have_case_insensitive_file_system.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug#46941 crash with lower_case_table_names=2 and
+--echo #           foreign data dictionary confusion
+--echo #
+
+CREATE DATABASE XY;
+USE XY;
+
+#
+# Logs are disabled, since the number of creates tables
+# and subsequent select statements may vary between
+# versions
+#
+--disable_query_log
+--disable_result_log
+
+let $tcs = `SELECT @@table_open_cache + 1`;
+
+let $i = $tcs;
+
+while ($i)
+{
+  eval CREATE TABLE XY.T_$i (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, 
+                             primary key(a, b), unique(b)) ENGINE=InnoDB;
+  dec $i;
+}
+
+eval ALTER TABLE XY.T_$tcs ADD INDEX I1 (c, b), 
+                           ADD CONSTRAINT C1 FOREIGN KEY (c, b) REFERENCES XY.T_1 (a, b);
+                   
+eval ALTER TABLE XY.T_$tcs ADD INDEX I2 (b),
+                           ADD CONSTRAINT C2 FOREIGN KEY (b) REFERENCES XY.T_1(a);
+ 
+let $i = $tcs;
+while ($i)
+{
+  eval SELECT * FROM XY.T_$i LIMIT 1;
+  dec $i;
+}
+
+DROP DATABASE XY;
+CREATE DATABASE XY;
+USE XY;
+eval CREATE TABLE XY.T_$tcs (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT, 
+                             PRIMARY KEY(a, b), UNIQUE(b)) ENGINE=InnoDB;
+#
+# The bug causes this SELECT to err
+eval SELECT * FROM XY.T_$tcs LIMIT 1;
+
+--enable_query_log
+--enable_result_log
+DROP DATABASE XY;
+

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	revid:inaam.rana@stripped
+++ b/mysql-test/t/mysqltest.test	revid:vasil.dimov@stripped
@@ -331,7 +331,7 @@ eval select $mysql_errno as "after_!errn
 --exec illegal_command
 --cat_file does_not_exist
 --perl
-  exit(1);
+  exit(2);
 EOF
 
 # ----------------------------------------------------------------------------

=== modified file 'mysql-test/t/wait_timeout.test'
--- a/mysql-test/t/wait_timeout.test	revid:inaam.rana@stripped
+++ b/mysql-test/t/wait_timeout.test	revid:vasil.dimov@stripped
@@ -53,7 +53,7 @@ while (!`select @aborted_clients`)
   dec $retries;
   if (!$retries)
   {
-    Failed to detect that client has been aborted;
+    die Failed to detect that client has been aborted;
   }
 }
 --enable_query_log
@@ -108,7 +108,7 @@ while (!`select @aborted_clients`)
   dec $retries;
   if (!$retries)
   {
-    Failed to detect that client has been aborted;
+    die Failed to detect that client has been aborted;
   }
 }
 --enable_query_log

=== modified file 'mysys/my_gethostbyname.c'
--- a/mysys/my_gethostbyname.c	revid:inaam.rana@stripped
+++ b/mysys/my_gethostbyname.c	revid:vasil.dimov@stripped
@@ -92,8 +92,10 @@ extern pthread_mutex_t LOCK_gethostbynam
 */
 
 struct hostent *my_gethostbyname_r(const char *name,
-				   struct hostent *result, char *buffer,
-				   int buflen, int *h_errnop)
+                                   struct hostent *res __attribute__((unused)),
+                                   char *buffer __attribute__((unused)),
+                                   int buflen __attribute__((unused)),
+                                   int *h_errnop)
 {
   struct hostent *hp;
   pthread_mutex_lock(&LOCK_gethostbyname_r);

=== modified file 'mysys/my_gethwaddr.c'
--- a/mysys/my_gethwaddr.c	revid:inaam.rana@stripped
+++ b/mysys/my_gethwaddr.c	revid:vasil.dimov@stripped
@@ -21,18 +21,6 @@
 
 #ifndef MAIN
 
-#if defined(__FreeBSD__) || defined(__linux__)
-static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
-{
-  uint i, res=1;
-
-  for (i=0; i < len; i++)
-    if ((*to++= *from++))
-      res=0;
-  return res;
-}
-#endif   /* FreeBSD || linux */
-
 #ifdef __FreeBSD__
 
 #include <net/ethernet.h>
@@ -44,10 +32,11 @@ static my_bool memcpy_and_test(uchar *to
 my_bool my_gethwaddr(uchar *to)
 {
   size_t len;
-  uchar  *buf, *next, *end, *addr;
+  char *buf, *next, *end;
   struct if_msghdr *ifm;
   struct sockaddr_dl *sdl;
   int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
+  char zero_array[ETHER_ADDR_LEN] = {0};
 
   if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
     goto err;
@@ -63,9 +52,9 @@ my_bool my_gethwaddr(uchar *to)
     ifm = (struct if_msghdr *)next;
     if (ifm->ifm_type == RTM_IFINFO)
     {
-      sdl = (struct sockaddr_dl *)(ifm + 1);
-      addr=LLADDR(sdl);
-      res=memcpy_and_test(to, addr, ETHER_ADDR_LEN);
+      sdl= (struct sockaddr_dl *)(ifm + 1);
+      memcpy(to, LLADDR(sdl), ETHER_ADDR_LEN);
+      res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
     }
   }
 
@@ -81,8 +70,9 @@ err:
 
 my_bool my_gethwaddr(uchar *to)
 {
-  int fd, res=1;
+  int fd, res= 1;
   struct ifreq ifr;
+  char zero_array[ETHER_ADDR_LEN] = {0};
 
   fd = socket(AF_INET, SOCK_DGRAM, 0);
   if (fd < 0)
@@ -91,9 +81,13 @@ my_bool my_gethwaddr(uchar *to)
   bzero(&ifr, sizeof(ifr));
   strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1);
 
-  do {
+  do
+  {
     if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0)
-      res=memcpy_and_test(to, (uchar *)&ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+    {
+      memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+      res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
+    }
   } while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6');
 
   close(fd);

=== modified file 'mysys/my_sync.c'
--- a/mysys/my_sync.c	revid:inaam.rana@stripped
+++ b/mysys/my_sync.c	revid:vasil.dimov@stripped
@@ -58,7 +58,7 @@ int my_sync(File fd, myf my_flags)
     /* Some file systems don't support F_FULLFSYNC and fail above: */
     DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
 #endif
-#if defined(HAVE_FDATASYNC)
+#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
     res= fdatasync(fd);
 #elif defined(HAVE_FSYNC)
     res= fsync(fd);
@@ -89,6 +89,8 @@ int my_sync(File fd, myf my_flags)
 
 
 static const char cur_dir_name[]= {FN_CURLIB, 0};
+
+
 /*
   Force directory information to disk.
 
@@ -100,9 +102,11 @@ static const char cur_dir_name[]= {FN_CU
   RETURN
     0 if ok, !=0 if error
 */
+
+#ifdef NEED_EXPLICIT_SYNC_DIR
+
 int my_sync_dir(const char *dir_name, myf my_flags)
 {
-#ifdef NEED_EXPLICIT_SYNC_DIR
   File dir_fd;
   int res= 0;
   const char *correct_dir_name;
@@ -124,11 +128,18 @@ int my_sync_dir(const char *dir_name, my
   else
     res= 1;
   DBUG_RETURN(res);
-#else
+}
+
+#else /* NEED_EXPLICIT_SYNC_DIR */
+
+int my_sync_dir(const char *dir_name __attribute__((unused)),
+                myf my_flags __attribute__((unused)))
+{
   return 0;
-#endif
 }
 
+#endif /* NEED_EXPLICIT_SYNC_DIR */
+
 
 /*
   Force directory information to disk.
@@ -141,15 +152,24 @@ int my_sync_dir(const char *dir_name, my
   RETURN
     0 if ok, !=0 if error
 */
+
+#ifdef NEED_EXPLICIT_SYNC_DIR
+
 int my_sync_dir_by_file(const char *file_name, myf my_flags)
 {
-#ifdef NEED_EXPLICIT_SYNC_DIR
   char dir_name[FN_REFLEN];
   size_t dir_name_length;
   dirname_part(dir_name, file_name, &dir_name_length);
   return my_sync_dir(dir_name, my_flags);
-#else
+}
+
+#else /* NEED_EXPLICIT_SYNC_DIR */
+
+int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
+                        myf my_flags __attribute__((unused)))
+{
   return 0;
-#endif
 }
 
+#endif /* NEED_EXPLICIT_SYNC_DIR */
+

=== modified file 'mysys/thr_mutex.c'
--- a/mysys/thr_mutex.c	revid:inaam.rana@stripped
+++ b/mysys/thr_mutex.c	revid:vasil.dimov@stripped
@@ -259,8 +259,8 @@ int safe_cond_wait(pthread_cond_t *cond,
 
 
 int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
-			struct timespec *abstime,
-			const char *file, uint line)
+                        const struct timespec *abstime,
+                        const char *file, uint line)
 {
   int error;
   pthread_mutex_lock(&mp->global);

=== modified file 'regex/main.c'
--- a/regex/main.c	revid:inaam.rana@stripped
+++ b/regex/main.c	revid:vasil.dimov@stripped
@@ -17,8 +17,8 @@ regoff_t startoff = 0;
 regoff_t endoff = 0;
 
 
-extern int split();
-extern void regprint();
+extern int split(char *string, char *fields[], int nfields, char *sep);
+extern void regprint(my_regex_t *r, FILE *d);
 
 /*
  - main - do the simple case, hand off to regress() for regression
@@ -145,7 +145,7 @@ FILE *in;
 		inbuf[strlen(inbuf)-1] = '\0';	/* get rid of stupid \n */
 		if (debug)
 			fprintf(stdout, "%d:\n", line);
-		nf = split(inbuf, f, MAXF, "\t\t");
+		nf = split(inbuf, f, MAXF, (char*) "\t\t");
 		if (nf < 3) {
 			fprintf(stderr, "bad input, line %d\n", line);
 			exit(1);
@@ -288,7 +288,7 @@ int opts;			/* may not match f1 */
 
 	for (i = 1; i < NSHOULD; i++)
 		should[i] = NULL;
-	nshould = split(f4, should+1, NSHOULD-1, ",");
+	nshould = split(f4, should+1, NSHOULD-1, (char*) ",");
 	if (nshould == 0) {
 		nshould = 1;
 		should[1] = (char*) "";

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	revid:inaam.rana@stripped
+++ b/sql/ha_ndbcluster.cc	revid:vasil.dimov@stripped
@@ -1293,10 +1293,12 @@ int ha_ndbcluster::open_indexes(Ndb *ndb
   for (i= 0; i < tab->s->keys; i++, key_info++, key_name++)
   {
     if ((error= add_index_handle(thd, dict, key_info, *key_name, i)))
+    {
       if (ignore_error)
         m_index[i].index= m_index[i].unique_index= NULL;
       else
         break;
+    }
     m_index[i].null_in_unique_index= FALSE;
     if (check_index_fields_not_null(key_info))
       m_index[i].null_in_unique_index= TRUE;
@@ -6265,8 +6267,8 @@ void ha_ndbcluster::get_auto_increment(u
   for (;;)
   {
     Ndb_tuple_id_range_guard g(m_share);
-    if (m_skip_auto_increment &&
-        ndb->readAutoIncrementValue(m_table, g.range, auto_value) ||
+    if ((m_skip_auto_increment &&
+        ndb->readAutoIncrementValue(m_table, g.range, auto_value)) ||
         ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size, increment, offset))
     {
       if (--retries &&
@@ -9916,8 +9918,8 @@ bool ha_ndbcluster::check_if_incompatibl
   {
     Field *field= table->field[i];
     const NDBCOL *col= tab->getColumn(i);
-    if (col->getStorageType() == NDB_STORAGETYPE_MEMORY && create_info->storage_media != HA_SM_MEMORY ||
-        col->getStorageType() == NDB_STORAGETYPE_DISK && create_info->storage_media != HA_SM_DISK)
+    if ((col->getStorageType() == NDB_STORAGETYPE_MEMORY && create_info->storage_media != HA_SM_MEMORY) ||
+        (col->getStorageType() == NDB_STORAGETYPE_DISK && create_info->storage_media != HA_SM_DISK))
     {
       DBUG_PRINT("info", ("Column storage media is changed"));
       DBUG_RETURN(COMPATIBLE_DATA_NO);

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	revid:inaam.rana@stripped
+++ b/sql/handler.cc	revid:vasil.dimov@stripped
@@ -1127,7 +1127,7 @@ int ha_commit_trans(THD *thd, bool all)
     uint rw_ha_count;
     bool rw_trans;
 
-    DBUG_EXECUTE_IF("crash_commit_before", abort(););
+    DBUG_EXECUTE_IF("crash_commit_before", DBUG_SUICIDE(););
 
     /* Close all cursors that can not survive COMMIT */
     if (is_real_trans)                          /* not a statement commit */
@@ -1179,7 +1179,7 @@ int ha_commit_trans(THD *thd, bool all)
         }
         status_var_increment(thd->status_var.ha_prepare_count);
       }
-      DBUG_EXECUTE_IF("crash_commit_after_prepare", abort(););
+      DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_SUICIDE(););
       if (error || (is_real_trans && xid &&
                     (error= !(cookie= tc_log->log_xid(thd, xid)))))
       {
@@ -1187,13 +1187,13 @@ int ha_commit_trans(THD *thd, bool all)
         error= 1;
         goto end;
       }
-      DBUG_EXECUTE_IF("crash_commit_after_log", abort(););
+      DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_SUICIDE(););
     }
     error=ha_commit_one_phase(thd, all) ? (cookie ? 2 : 1) : 0;
-    DBUG_EXECUTE_IF("crash_commit_before_unlog", abort(););
+    DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_SUICIDE(););
     if (cookie)
       tc_log->unlog(cookie, xid);
-    DBUG_EXECUTE_IF("crash_commit_after", abort(););
+    DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
 end:
     if (rw_trans)
       start_waiting_global_read_lock(thd);

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	revid:inaam.rana@stripped
+++ b/sql/lock.cc	revid:vasil.dimov@stripped
@@ -693,7 +693,6 @@ TABLE_LIST *mysql_lock_have_duplicate(TH
                                       TABLE_LIST *haystack)
 {
   MYSQL_LOCK            *mylock;
-  TABLE                 **lock_tables;
   TABLE                 *table;
   TABLE                 *table2;
   THR_LOCK_DATA         **lock_locks;
@@ -722,12 +721,11 @@ TABLE_LIST *mysql_lock_have_duplicate(TH
   if (mylock->table_count < 2)
     goto end;
 
-  lock_locks=  mylock->locks;
-  lock_tables= mylock->table;
+  lock_locks= mylock->locks;
 
   /* Prepare table related variables that don't change in loop. */
   DBUG_ASSERT((table->lock_position < mylock->table_count) &&
-              (table == lock_tables[table->lock_position]));
+              (table == mylock->table[table->lock_position]));
   table_lock_data= lock_locks + table->lock_data_start;
   end_data= table_lock_data + table->lock_count;
 
@@ -741,7 +739,7 @@ TABLE_LIST *mysql_lock_have_duplicate(TH
 
     /* All tables in list must be in lock. */
     DBUG_ASSERT((table2->lock_position < mylock->table_count) &&
-                (table2 == lock_tables[table2->lock_position]));
+                (table2 == mylock->table[table2->lock_position]));
 
     for (lock_data2=  lock_locks + table2->lock_data_start,
            end_data2= lock_data2 + table2->lock_count;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	revid:inaam.rana@stripped
+++ b/sql/log.cc	revid:vasil.dimov@stripped
@@ -1217,7 +1217,7 @@ void LOGGER::deactivate_log_handler(THD 
     file_log= file_log_handler->get_mysql_log();
     break;
   default:
-    assert(0);                                  // Impossible
+    MY_ASSERT_UNREACHABLE();
   }
 
   if (!(*tmp_opt))
@@ -2600,7 +2600,7 @@ bool MYSQL_BIN_LOG::open(const char *log
     sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file.");
     DBUG_RETURN(1);
   }
-  DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", abort(););
+  DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_SUICIDE(););
 #endif
 
   write_error= 0;
@@ -2697,7 +2697,7 @@ bool MYSQL_BIN_LOG::open(const char *log
     if (write_file_name_to_index_file)
     {
 #ifdef HAVE_REPLICATION
-      DBUG_EXECUTE_IF("crash_create_critical_before_update_index", abort(););
+      DBUG_EXECUTE_IF("crash_create_critical_before_update_index", DBUG_SUICIDE(););
 #endif
 
       DBUG_ASSERT(my_b_inited(&index_file) != 0);
@@ -2716,7 +2716,7 @@ bool MYSQL_BIN_LOG::open(const char *log
         goto err;
 
 #ifdef HAVE_REPLICATION
-      DBUG_EXECUTE_IF("crash_create_after_update_index", abort(););
+      DBUG_EXECUTE_IF("crash_create_after_update_index", DBUG_SUICIDE(););
 #endif
     }
   }
@@ -3168,7 +3168,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay
   /* Store where we are in the new file for the execution thread */
   flush_relay_log_info(rli);
 
-  DBUG_EXECUTE_IF("crash_before_purge_logs", abort(););
+  DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE(););
 
   pthread_mutex_lock(&rli->log_space_lock);
   rli->relay_log.purge_logs(to_purge_if_included, included,
@@ -3296,7 +3296,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
       break;
   }
 
-  DBUG_EXECUTE_IF("crash_purge_before_update_index", abort(););
+  DBUG_EXECUTE_IF("crash_purge_before_update_index", DBUG_SUICIDE(););
 
   if ((error= sync_purge_index_file()))
   {
@@ -3311,7 +3311,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
     goto err;
   }
 
-  DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", abort(););
+  DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", DBUG_SUICIDE(););
 
 err:
   /* Read each entry from purge_index_file and delete the file. */
@@ -3321,7 +3321,7 @@ err:
                     " that would be purged.");
   close_purge_index_file();
 
-  DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", abort(););
+  DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", DBUG_SUICIDE(););
 
   if (need_mutex)
     pthread_mutex_unlock(&LOCK_index);
@@ -4832,7 +4832,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
                           DBUG_PRINT("info", ("error writing binlog cache: %d",
                                                write_error));
                         DBUG_PRINT("info", ("crashing before writing xid"));
-                        abort();
+                        DBUG_SUICIDE();
                       });
 
       if ((write_error= write_cache(cache, false, false)))
@@ -4846,7 +4846,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_C
 
       if (flush_and_sync())
         goto err;
-      DBUG_EXECUTE_IF("half_binlogged_transaction", abort(););
+      DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_SUICIDE(););
       if (cache->error)				// Error on read
       {
         sql_print_error(ER(ER_ERROR_ON_READ), cache->file_name, errno);

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	revid:inaam.rana@stripped
+++ b/sql/log_event.cc	revid:vasil.dimov@stripped
@@ -2314,7 +2314,7 @@ bool Query_log_event::write(IO_CACHE* fi
     start+= 4;
   }
 
-  if (thd && thd->is_current_user_used())
+  if (thd && thd->need_binlog_invoker())
   {
     LEX_STRING user;
     LEX_STRING host;
@@ -8258,6 +8258,7 @@ int Table_map_log_event::do_apply_event(
                 m_field_metadata, m_field_metadata_size,
                 m_null_bits, m_flags);
     table_list->m_tabledef_valid= TRUE;
+    table_list->skip_temporary= 1;
 
     /*
       We record in the slave's information that the table should be
@@ -8362,7 +8363,7 @@ void Table_map_log_event::pack_info(Prot
 
 
 #ifdef MYSQL_CLIENT
-void Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
+void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info)
 {
   if (!print_event_info->short_form)
   {

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	revid:inaam.rana@stripped
+++ b/sql/log_event.h	revid:vasil.dimov@stripped
@@ -979,9 +979,9 @@ public:
     return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE));
   }
 
-  static void operator delete(void *ptr, size_t size)
+  static void operator delete(void *ptr, size_t)
   {
-    my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+    my_free(ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
   }
 
   /* Placement version of the above operators */

=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h	revid:inaam.rana@stripped
+++ b/sql/my_decimal.h	revid:vasil.dimov@stripped
@@ -308,7 +308,7 @@ int my_decimal2int(uint mask, const my_d
 
 
 inline
-int my_decimal2double(uint mask, const my_decimal *d, double *result)
+int my_decimal2double(uint, const my_decimal *d, double *result)
 {
   /* No need to call check_result as this will always succeed */
   return decimal2double((decimal_t*) d, result);

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	revid:inaam.rana@stripped
+++ b/sql/set_var.cc	revid:vasil.dimov@stripped
@@ -2559,7 +2559,7 @@ bool update_sys_var_str_path(THD *thd, s
     file_log= logger.get_log_file_handler();
     break;
   default:
-    assert(0);                                  // Impossible
+    MY_ASSERT_UNREACHABLE();
   }
 
   if (!old_value)

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	revid:inaam.rana@stripped
+++ b/sql/slave.cc	revid:vasil.dimov@stripped
@@ -740,8 +740,17 @@ static bool sql_slave_killed(THD* thd, R
   DBUG_ASSERT(rli->slave_running == 1);// tracking buffer overrun
   if (abort_loop || thd->killed || rli->abort_slave)
   {
+    /*
+      The transaction should always be binlogged if OPTION_KEEP_LOG is set
+      (it implies that something can not be rolled back). And such case
+      should be regarded similarly as modifing a non-transactional table
+      because retrying of the transaction will lead to an error or inconsistency
+      as well.
+      Example: OPTION_KEEP_LOG is set if a temporary table is created or dropped.
+    */
     if (rli->abort_slave && rli->is_in_group() &&
-        thd->transaction.all.modified_non_trans_table)
+        (thd->transaction.all.modified_non_trans_table ||
+         (thd->options & OPTION_KEEP_LOG)))
       DBUG_RETURN(0);
     /*
       If we are in an unsafe situation (stopping could corrupt replication),

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	revid:inaam.rana@stripped
+++ b/sql/sql_acl.cc	revid:vasil.dimov@stripped
@@ -5479,7 +5479,7 @@ static int handle_grant_struct(uint stru
       host= grant_name->host.hostname;
       break;
     default:
-      assert(0);
+      MY_ASSERT_UNREACHABLE();
     }
     if (! user)
       user= "";

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	revid:inaam.rana@stripped
+++ b/sql/sql_class.cc	revid:vasil.dimov@stripped
@@ -738,7 +738,7 @@ THD::THD()
   thr_lock_owner_init(&main_lock_id, &lock_info);
 
   m_internal_handler= NULL;
-  current_user_used= FALSE;
+  m_binlog_invoker= FALSE;
   memset(&invoker_user, 0, sizeof(invoker_user));
   memset(&invoker_host, 0, sizeof(invoker_host));
 }
@@ -1247,7 +1247,7 @@ void THD::cleanup_after_query()
   where= THD::DEFAULT_WHERE;
   /* reset table map for multi-table update */
   table_map_for_update= 0;
-  clean_current_user_used();
+  m_binlog_invoker= FALSE;
 }
 
 
@@ -3281,7 +3281,7 @@ void THD::set_query(char *query_arg, uin
 
 void THD::get_definer(LEX_USER *definer)
 {
-  set_current_user_used();
+  binlog_invoker();
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
   if (slave_thread && has_invoker())
   {

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	revid:inaam.rana@stripped
+++ b/sql/sql_class.h	revid:vasil.dimov@stripped
@@ -2344,9 +2344,8 @@ public:
     Protected with LOCK_thd_data mutex.
   */
   void set_query(char *query_arg, uint32 query_length_arg);
-  void set_current_user_used() { current_user_used= TRUE; }
-  bool is_current_user_used() { return current_user_used; }
-  void clean_current_user_used() { current_user_used= FALSE; }
+  void binlog_invoker() { m_binlog_invoker= TRUE; }
+  bool need_binlog_invoker() { return m_binlog_invoker; }
   void get_definer(LEX_USER *definer);
   void set_invoker(const LEX_STRING *user, const LEX_STRING *host)
   {
@@ -2384,7 +2383,7 @@ private:
     Current user will be binlogged into Query_log_event if current_user_used
     is TRUE; It will be stored into invoker_host and invoker_user by SQL thread.
    */
-  bool current_user_used;
+  bool m_binlog_invoker;
 
   /**
     It points to the invoker in the Query_log_event.

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	revid:inaam.rana@stripped
+++ b/sql/sql_db.cc	revid:vasil.dimov@stripped
@@ -1197,6 +1197,12 @@ static long mysql_rm_known_files(THD *th
       VOID(filename_to_tablename(file->name, table_list->table_name,
                                  MYSQL50_TABLE_NAME_PREFIX_LENGTH +
                                  strlen(file->name) + 1));
+
+      /* To be able to correctly look up the table in the table cache. */
+      if (lower_case_table_names)
+        table_list->table_name_length= my_casedn_str(files_charset_info,
+                                                     table_list->table_name);
+
       table_list->alias= table_list->table_name;	// If lower_case_table_names=2
       table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix);
       /* Link into list */

=== modified file 'sql/sql_help.cc'
--- a/sql/sql_help.cc	revid:inaam.rana@stripped
+++ b/sql/sql_help.cc	revid:vasil.dimov@stripped
@@ -686,7 +686,7 @@ bool mysqld_help(THD *thd, const char *m
 
   if (count_topics == 0)
   {
-    int key_id;
+    int UNINIT_VAR(key_id);
     if (!(select=
           prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
                                   used_fields[help_keyword_name].field,

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	revid:inaam.rana@stripped
+++ b/sql/sql_parse.cc	revid:vasil.dimov@stripped
@@ -27,6 +27,7 @@
 #include "sp_cache.h"
 #include "events.h"
 #include "sql_trigger.h"
+#include "debug_sync.h"
 
 /**
   @defgroup Runtime_Environment Runtime Environment
@@ -3258,6 +3259,15 @@ end_with_restore_list:
       thd->first_successful_insert_id_in_cur_stmt=
         thd->first_successful_insert_id_in_prev_stmt;
 
+    DBUG_EXECUTE_IF("after_mysql_insert",
+                    {
+                      const char act[]=
+                        "now "
+                        "wait_for signal.continue";
+                      DBUG_ASSERT(opt_debug_sync_timeout > 0);
+                      DBUG_ASSERT(!debug_sync_set_action(current_thd,
+                                                         STRING_WITH_LEN(act)));
+                    };);
     break;
   }
   case SQLCOM_REPLACE_SELECT:
@@ -3913,6 +3923,10 @@ end_with_restore_list:
     if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) &&
         check_global_access(thd,CREATE_USER_ACL))
       break;
+
+    /* Replicate current user as grantor */
+    thd->binlog_invoker();
+
     /* Conditionally writes to binlog */
     if (!(res = mysql_revoke_all(thd, lex->users_list)))
       my_ok(thd);
@@ -3933,6 +3947,9 @@ end_with_restore_list:
                      is_schema_db(select_lex->db) : 0))
       goto error;
 
+    /* Replicate current user as grantor */
+    thd->binlog_invoker();
+
     if (thd->security_ctx->user)              // If not replication
     {
       LEX_USER *user, *tmp_user;

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	revid:inaam.rana@stripped
+++ b/sql/sql_partition.cc	revid:vasil.dimov@stripped
@@ -6786,8 +6786,8 @@ int get_part_iter_for_interval_via_mappi
     }
   }
   else
-    assert(0);
-  
+    MY_ASSERT_UNREACHABLE();
+
   can_match_multiple_values= (flags || !min_value || !max_value ||
                               memcmp(min_value, max_value, field_len));
   if (can_match_multiple_values &&

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	revid:inaam.rana@stripped
+++ b/sql/sql_string.h	revid:vasil.dimov@stripped
@@ -84,9 +84,13 @@ public:
   }
   static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return (void*) alloc_root(mem_root, (uint) size); }
-  static void operator delete(void *ptr_arg,size_t size)
-  { TRASH(ptr_arg, size); }
-  static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
+  static void operator delete(void *ptr_arg, size_t size)
+  {
+    (void) ptr_arg;
+    (void) size;
+    TRASH(ptr_arg, size);
+  }
+  static void operator delete(void *, MEM_ROOT *)
   { /* never called */ }
   ~String() { free(); }
 

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	revid:inaam.rana@stripped
+++ b/sql/sql_table.cc	revid:vasil.dimov@stripped
@@ -3896,7 +3896,7 @@ bool mysql_create_table_no_lock(THD *thd
       Then she could create the table. This case is pretty obscure and
       therefore we don't introduce a new error message only for it.
     */
-    if (get_cached_table_share(db, alias))
+    if (get_cached_table_share(db, table_name))
     {
       my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
       goto unlock_and_end;

=== modified file 'sql/sql_union.cc'
--- a/sql/sql_union.cc	revid:inaam.rana@stripped
+++ b/sql/sql_union.cc	revid:vasil.dimov@stripped
@@ -173,7 +173,6 @@ bool st_select_lex_unit::prepare(THD *th
   SELECT_LEX *sl, *first_sl= first_select();
   select_result *tmp_result;
   bool is_union_select;
-  TABLE *empty_table= 0;
   DBUG_ENTER("st_select_lex_unit::prepare");
 
   describe= test(additional_options & SELECT_DESCRIBE);
@@ -275,14 +274,6 @@ bool st_select_lex_unit::prepare(THD *th
       types= first_sl->item_list;
     else if (sl == first_sl)
     {
-      /*
-        We need to create an empty table object. It is used
-        to create tmp_table fields in Item_type_holder.
-        The main reason of this is that we can't create
-        field object without table.
-      */
-      DBUG_ASSERT(!empty_table);
-      empty_table= (TABLE*) thd->calloc(sizeof(TABLE));
       types.empty();
       List_iterator_fast<Item> it(sl->item_list);
       Item *item_tmp;

=== modified file 'storage/innobase/include/ut0dbg.h'
--- a/storage/innobase/include/ut0dbg.h	revid:inaam.rana@stripped
+++ b/storage/innobase/include/ut0dbg.h	revid:vasil.dimov@stripped
@@ -39,7 +39,7 @@ extern ibool	panic_shutdown;
 void ut_dbg_panic(void);
 # define UT_DBG_PANIC ut_dbg_panic()
 /* Stop threads in ut_a(). */
-# define UT_DBG_STOP	while (0)	/* We do not do this on NetWare */
+# define UT_DBG_STOP	do {} while (0)	/* We do not do this on NetWare */
 #else /* __NETWARE__ */
 # if defined(__WIN__) || defined(__INTEL_COMPILER)
 #  undef UT_DBG_USE_ABORT
@@ -71,7 +71,7 @@ ut_dbg_stop_thread(
 /* Abort the execution. */
 #  define UT_DBG_PANIC abort()
 /* Stop threads (null operation) */
-#  define UT_DBG_STOP while (0)
+#  define UT_DBG_STOP do {} while (0)
 # else /* UT_DBG_USE_ABORT */
 /* Abort the execution. */
 #  define UT_DBG_PANIC					\

=== modified file 'storage/innobase/os/os0file.c'
--- a/storage/innobase/os/os0file.c	revid:inaam.rana@stripped
+++ b/storage/innobase/os/os0file.c	revid:vasil.dimov@stripped
@@ -1138,9 +1138,12 @@ Tries to disable OS caching on an opened
 void
 os_file_set_nocache(
 /*================*/
-	int		fd,		/* in: file descriptor to alter */
-	const char*	file_name,	/* in: used in the diagnostic message */
-	const char*	operation_name)	/* in: used in the diagnostic message,
+	int		fd		/* in: file descriptor to alter */
+	__attribute__((unused)),
+	const char*	file_name	/* in: used in the diagnostic message */
+	__attribute__((unused)),
+	const char*	operation_name __attribute__((unused)))
+					/* in: used in the diagnostic message,
 					we call os_file_set_nocache()
 					immediately after opening or creating
 					a file, so this is either "open" or

=== modified file 'storage/innodb_plugin/os/os0file.c'
--- a/storage/innodb_plugin/os/os0file.c	revid:inaam.rana@stripped
+++ b/storage/innodb_plugin/os/os0file.c	revid:vasil.dimov@stripped
@@ -1182,10 +1182,12 @@ UNIV_INTERN
 void
 os_file_set_nocache(
 /*================*/
-	int		fd,		/*!< in: file descriptor to alter */
-	const char*	file_name,	/*!< in: file name, used in the
-					diagnostic message */
-	const char*	operation_name)	/*!< in: "open" or "create"; used in the
+	int		fd		/*!< in: file descriptor to alter */
+	__attribute__((unused)),
+	const char*	file_name	/*!< in: used in the diagnostic message */
+	__attribute__((unused)),
+	const char*	operation_name __attribute__((unused)))
+					/*!< in: "open" or "create"; used in the
 					diagnostic message */
 {
 	/* some versions of Solaris may not have DIRECTIO_ON */

=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c	revid:inaam.rana@stripped
+++ b/storage/myisam/myisamchk.c	revid:vasil.dimov@stripped
@@ -697,8 +697,7 @@ get_one_option(int optid,
   case OPT_STATS_METHOD:
   {
     int method;
-    enum_mi_stats_method method_conv;
-    LINT_INIT(method_conv);
+    enum_mi_stats_method UNINIT_VAR(method_conv);
     myisam_stats_method_str= argument;
     if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
     {

=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc	revid:inaam.rana@stripped
+++ b/storage/myisammrg/ha_myisammrg.cc	revid:vasil.dimov@stripped
@@ -415,7 +415,7 @@ static MI_INFO *myisammrg_attach_childre
     my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
   }
   DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx  my_errno: %d",
-                      my_errno ? NULL : (long) myisam, my_errno));
+                      my_errno ? 0L : (long) myisam, my_errno));
 
  err:
   DBUG_RETURN(my_errno ? NULL : myisam);

=== modified file 'unittest/examples/skip-t.c'
--- a/unittest/examples/skip-t.c	revid:inaam.rana@stripped
+++ b/unittest/examples/skip-t.c	revid:vasil.dimov@stripped
@@ -18,11 +18,11 @@
 
 int main() {
   plan(4);
-  ok(1, NULL);
-  ok(1, NULL);
+  ok1(1);
+  ok1(1);
   SKIP_BLOCK_IF(1, 2, "Example of skipping a few test points in a test") {
-    ok(1, NULL);
-    ok(1, NULL);
+    ok1(1);
+    ok1(1);
   }
   return exit_status();
 }

=== modified file 'unittest/examples/skip_all-t.c'
--- a/unittest/examples/skip_all-t.c	revid:inaam.rana@stripped
+++ b/unittest/examples/skip_all-t.c	revid:vasil.dimov@stripped
@@ -31,9 +31,9 @@ int main() {
   if (!has_feature())
     skip_all("Example of skipping an entire test");
   plan(4);
-  ok(1, NULL);
-  ok(1, NULL);
-  ok(1, NULL);
-  ok(1, NULL);
+  ok1(1);
+  ok1(1);
+  ok1(1);
+  ok1(1);
   return exit_status();
 }

=== modified file 'unittest/examples/todo-t.c'
--- a/unittest/examples/todo-t.c	revid:inaam.rana@stripped
+++ b/unittest/examples/todo-t.c	revid:vasil.dimov@stripped
@@ -21,15 +21,15 @@
 int main()
 {
   plan(4);
-  ok(1, NULL);
-  ok(1, NULL);
+  ok1(1);
+  ok1(1);
   /*
     Tests in the todo region is expected to fail. If they don't,
     something is strange.
   */
   todo_start("Need to fix these");
-  ok(0, NULL);
-  ok(0, NULL);
+  ok1(0);
+  ok1(0);
   todo_end();
   return exit_status();
 }

=== modified file 'unittest/mytap/t/basic-t.c'
--- a/unittest/mytap/t/basic-t.c	revid:inaam.rana@stripped
+++ b/unittest/mytap/t/basic-t.c	revid:vasil.dimov@stripped
@@ -22,7 +22,7 @@ int main() {
   plan(5);
   ok(1 == 1, "testing basic functions");
   ok(2 == 2, " ");
-  ok(3 == 3, NULL);
+  ok1(3 == 3);
   if (1 == 1)
     skip(2, "Sensa fragoli");
   else {

=== modified file 'unittest/mytap/tap.c'
--- a/unittest/mytap/tap.c	revid:inaam.rana@stripped
+++ b/unittest/mytap/tap.c	revid:vasil.dimov@stripped
@@ -223,6 +223,23 @@ ok(int const pass, char const *fmt, ...)
   emit_endl();
 }
 
+void
+ok1(int const pass)
+{
+  va_list ap;
+
+  memset(&ap, 0, sizeof(ap));
+
+  if (!pass && *g_test.todo == '\0')
+    ++g_test.failed;
+
+  vemit_tap(pass, NULL, ap);
+
+  if (*g_test.todo != '\0')
+    emit_dir("todo", g_test.todo);
+
+  emit_endl();
+}
 
 void
 skip(int how_many, char const *fmt, ...)

=== modified file 'unittest/mytap/tap.h'
--- a/unittest/mytap/tap.h	revid:inaam.rana@stripped
+++ b/unittest/mytap/tap.h	revid:vasil.dimov@stripped
@@ -98,8 +98,8 @@ void plan(int const count);
    @endcode
 
    @param pass Zero if the test failed, non-zero if it passed.
-   @param fmt  Format string in printf() format. NULL is allowed, in
-               which case nothing is printed.
+   @param fmt  Format string in printf() format. NULL is not allowed,
+               use ok1() in this case.
 */
 
 void ok(int const pass, char const *fmt, ...)
@@ -107,6 +107,17 @@ void ok(int const pass, char const *fmt,
 
 
 /**
+   Report test result as a TAP line.
+
+   Same as ok() but does not take a message to be printed.
+
+   @param pass Zero if the test failed, non-zero if it passed.
+*/
+
+void ok1(int const pass);
+
+
+/**
    Skip a determined number of tests.
 
    Function to print that <em>how_many</em> tests have been skipped.

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-innodb branch (vasil.dimov:3643 to 3644) vasil.dimov27 Oct