From a6eb0991c92c4b46b0372ed080fa226b73fbc0dc Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Dec 2011 00:39:34 +0100 Subject: [PATCH 1/8] LPBUG#886526: Add propoer shebang to scripts --- mysql-test/t/long_tmpdir-master.sh | 1 + mysql-test/t/lowercase_mixed_tmpdir-master.sh | 1 + sql-bench/graph-compare-results.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh index 318955fbcca..7bcbee26105 100644 --- a/mysql-test/t/long_tmpdir-master.sh +++ b/mysql-test/t/long_tmpdir-master.sh @@ -1,3 +1,4 @@ +#!/bin/sh d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789" test -d "$d" || mkdir "$d" rm -f "$d"/* diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.sh b/mysql-test/t/lowercase_mixed_tmpdir-master.sh index 95c26e3aa02..9330d0581ee 100644 --- a/mysql-test/t/lowercase_mixed_tmpdir-master.sh +++ b/mysql-test/t/lowercase_mixed_tmpdir-master.sh @@ -1,3 +1,4 @@ +#!/bin/sh # This test requires a non-lowercase tmpdir directory on a case-sensitive # filesystem. diff --git a/sql-bench/graph-compare-results.sh b/sql-bench/graph-compare-results.sh index 317ef583886..ddc9080acd6 100644 --- a/sql-bench/graph-compare-results.sh +++ b/sql-bench/graph-compare-results.sh @@ -1,3 +1,4 @@ +#!/usr/bin/perl #### #### Hello ... this is a heavily hacked script by Luuk #### instead of printing the result it makes a nice gif From 4c6426fc751374aaa89c54d9d4d616c026cdd725 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Dec 2011 01:14:54 +0100 Subject: [PATCH 2/8] Fix LPBUG# : allow chain certificate files to work. Contributed by Maarten Vanraes (AL13N) Fix things so that chains of certificates work in the server and client certificate files. This only really works for OpenSSL-based builds, as yassl is unable to read multiple certificates from a file. The patch below to yassl/src/ssl.cpp doesn't fix that, but just arranges that the viosslfactories.c patch won't have any ill effects in a yassl build. --- extra/yassl/src/ssl.cpp | 6 +++--- vio/viosslfactories.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 67d2d428e51..05c260e80ca 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -1607,10 +1607,10 @@ unsigned long ERR_get_error() } - int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) + int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) { - // TDOD: - return SSL_SUCCESS; + // For the moment, treat like use_certificate_file + return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); } diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index d71021452d1..7c9269de853 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -100,7 +100,7 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file, (long) ctx, cert_file, key_file)); if (cert_file) { - if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) + if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) { *error= SSL_INITERR_CERT; DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); From e72a6096f29a82081bffdd1b5f9fd4b322478457 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Dec 2011 17:44:14 +0100 Subject: [PATCH 3/8] Fix RQG in 5.5, make mtr MTR_VERSION=1 functional. Patch by elenst --- mysql-test/lib/v1/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 61ec3476ed7..f20eab80ae9 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -150,7 +150,7 @@ our $default_vardir; our $opt_usage; our $opt_list_options; our $opt_suites; -our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run +our $opt_suites_default= "main,binlog,rpl,maria"; # Default suites to run our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_verbose= 0; # Verbose output, enable with --verbose From e6f5fc1c02bfbfde6322fb44d108e6de60b4f92f Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 27 Dec 2011 20:55:21 +0200 Subject: [PATCH 4/8] Fixed lp:909051 Options --debug and --disable-debug are known but ambiguous in RelWithDebInfo build Fixed memory leak printing when doing 'mysqld --version', 'mysqld --debug --help' and 'mysqld --debug --help --verbose' mysys/my_init.c: Moved checking if we should call DBUG_END() before my_thread_end() as otherwise we will not free DBUG variables and files. mysys/thr_lock.c: Fixed compiler warning sql/mysqld.cc: Fixed memory leaks when using mysqld --help and mysqld --version Added --debug as an option that works for all builds. For non debug builds we now get a warning. strings/dtoa.c: Fixed valgrind warning (c could contain data outside of the given string) --- mysys/my_init.c | 6 +++--- mysys/thr_lock.c | 2 +- sql/mysqld.cc | 43 ++++++++++++++++++++++++++----------------- strings/dtoa.c | 8 ++++---- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/mysys/my_init.c b/mysys/my_init.c index 9e437162633..6a56396bd5a 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -199,6 +199,9 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", #endif } + if (!(infoflag & MY_DONT_FREE_DBUG)) + DBUG_END(); /* Must be done as late as possible */ + my_thread_end(); my_thread_global_end(); my_mutex_end(); @@ -216,9 +219,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", WSACleanup(); #endif /* __WIN__ */ - if (!(infoflag & MY_DONT_FREE_DBUG)) - DBUG_END(); /* Must be done as late as possible */ - my_init_done=0; } /* my_end */ diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 61f18d9dddf..fdcdd29fc1a 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -1386,7 +1386,7 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data, enum thr_lock_type new_lock_type) { THR_LOCK *lock=in_data->lock; -#ifndef DBUG_OFF +#ifdef EXTRA_DEBUG enum thr_lock_type old_lock_type= in_data->type; #endif DBUG_ENTER("thr_downgrade_write_only_lock"); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6f5f7640ab6..d3b7e1e7085 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -356,11 +356,12 @@ static I_List thread_cache; static bool binlog_format_used= false; LEX_STRING opt_init_connect, opt_init_slave; static mysql_cond_t COND_thread_cache, COND_flush_thread_cache; +static DYNAMIC_ARRAY all_options; /* Global variables */ bool opt_bin_log, opt_ignore_builtin_innodb= 0; -my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0; +my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0, opt_abort; ulonglong log_output_options; my_bool opt_userstat_running; my_bool opt_log_queries_not_using_indexes= 0; @@ -1177,8 +1178,9 @@ bool mysqld_embedded=1; static my_bool plugins_are_initialized= FALSE; #ifndef DBUG_OFF -static const char* default_dbug_option, *current_dbug_option; +static const char* default_dbug_option; #endif +static const char *current_dbug_option; #ifdef HAVE_LIBWRAP const char *libwrapName= NULL; int allow_severity = LOG_INFO; @@ -1709,7 +1711,7 @@ extern "C" void unireg_abort(int exit_code) usage(); if (exit_code) sql_print_error("Aborting\n"); - clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */ + clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); mysqld_exit(exit_code); } @@ -1725,9 +1727,8 @@ static void mysqld_exit(int exit_code) mysql_audit_finalize(); clean_up_mutexes(); clean_up_error_log_mutex(); - my_end((opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0) | MY_DONT_FREE_DBUG); + my_end((opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0)); shutdown_performance_schema(); // we do it as late as possible - DBUG_END(); // but this - even later exit(exit_code); /* purecov: inspected */ } @@ -1802,6 +1803,7 @@ void clean_up(bool print_message) free_global_client_stats(); free_global_table_stats(); free_global_index_stats(); + delete_dynamic(&all_options); #ifdef HAVE_REPLICATION end_slave_list(); #endif @@ -3645,7 +3647,7 @@ static int init_common_variables() set_server_version(); #ifndef EMBEDDED_LIBRARY - if (opt_help && !opt_verbose) + if (opt_abort && !opt_verbose) unireg_abort(0); #endif /*!EMBEDDED_LIBRARY*/ @@ -4206,7 +4208,7 @@ static int init_server_components() help information. Since the implementation of plugin server variables the help output is now written much later. */ - if (opt_error_log && !opt_help) + if (opt_error_log && !opt_abort) { if (!log_error_file_ptr[0]) fn_format(log_error_file, pidfile_name, mysql_data_home, ".err", @@ -4365,7 +4367,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); if (plugin_init(&remaining_argc, remaining_argv, (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) | - (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) + (opt_abort ? PLUGIN_INIT_SKIP_INITIALIZATION : 0))) { sql_print_error("Failed to initialize plugins."); unireg_abort(1); @@ -4409,7 +4411,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); } } - if (opt_help) + if (opt_abort) unireg_abort(0); /* if the errmsg.sys is not loaded, terminate to maintain behaviour */ @@ -4914,7 +4916,7 @@ int mysqld_main(int argc, char **argv) We have enough space for fiddling with the argv, continue */ check_data_home(mysql_real_data_home); - if (my_setwd(mysql_real_data_home, opt_help ? 0 : MYF(MY_WME)) && !opt_help) + if (my_setwd(mysql_real_data_home, opt_abort ? 0 : MYF(MY_WME)) && !opt_abort) unireg_abort(1); /* purecov: inspected */ if ((user_info= check_user(mysqld_user))) @@ -6159,8 +6161,6 @@ error: Handle start options ******************************************************************************/ -DYNAMIC_ARRAY all_options; - /** System variables are automatically command-line options (few exceptions are documented in sys_var.h), so don't need @@ -6172,6 +6172,11 @@ struct my_option my_long_options[]= {"help", '?', "Display this help and exit.", &opt_help, &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef DBUG_OFF + {"debug", '#', "Built in DBUG debugger. Disabled in this build.", + ¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG, + 0, 0, 0, 0, 0, 0}, +#endif #ifdef HAVE_REPLICATION {"debug-abort-slave-event-count", 0, "Option used by mysql-test for debugging and testing of replication.", @@ -7203,7 +7208,6 @@ static void print_help() my_print_variables((my_option*) all_options.buffer); free_root(&mem_root, MYF(0)); - delete_dynamic(&all_options); } static void usage(void) @@ -7471,8 +7475,8 @@ mysqld_get_one_option(int optid, char *argument) { switch(optid) { -#ifndef DBUG_OFF case '#': +#ifndef DBUG_OFF if (!argument) argument= (char*) default_dbug_option; if (argument[0] == '0' && !argument[1]) @@ -7485,8 +7489,10 @@ mysqld_get_one_option(int optid, break; DBUG_SET_INITIAL(argument); opt_endinfo=1; /* unireg: memory allocation */ - break; +#else + sql_print_warning("'%s' is disabled in this build", opt->name); #endif + break; case OPT_DEPRECATED_OPTION: sql_print_warning("'%s' is deprecated. It does nothing and exists only " "for compatiblity with old my.cnf files.", @@ -7529,7 +7535,8 @@ mysqld_get_one_option(int optid, #ifndef EMBEDDED_LIBRARY case 'V': print_version(); - exit(0); + opt_abort= 1; // Abort after parsing all options + break; #endif /*EMBEDDED_LIBRARY*/ case 'W': if (!argument) @@ -7872,6 +7879,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) if (!opt_help) delete_dynamic(&all_options); + else + opt_abort= 1; /* Add back the program name handle_options removes */ (*argc_ptr)++; @@ -8272,7 +8281,7 @@ static int test_if_case_insensitive(const char *dir_name) if ((file= mysql_file_create(key_file_casetest, buff, 0666, O_RDWR, MYF(0))) < 0) { - if (!opt_help) + if (!opt_abort) sql_print_warning("Can't create test file %s", buff); DBUG_RETURN(-1); } diff --git a/strings/dtoa.c b/strings/dtoa.c index e6339bab1d9..a6912859c7f 100644 --- a/strings/dtoa.c +++ b/strings/dtoa.c @@ -1398,12 +1398,12 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s nd0= nd; if (s < end - 1 && c == '.') { - c= *++s; + ++s; if (!nd) { - for (; s < end && c == '0'; c= *++s) + for (; s < end && (c= *s) == '0'; ++s) nz++; - if (s < end && c > '0' && c <= '9') + if (s < end && (c= *s) > '0' && c <= '9') { s0= s; nf+= nz; @@ -1412,7 +1412,7 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s } goto dig_done; } - for (; s < end && c >= '0' && c <= '9'; c = *++s) + for (; s < end && (c= *s) >= '0' && c <= '9'; ++s) { have_dig: nz++; From f4486c37b35c3ec4dd7008629cede508b2f00293 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 27 Dec 2011 20:59:05 +0200 Subject: [PATCH 5/8] Added ignore of generated file --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index a2947f9afe3..4dca2e49338 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1132,3 +1132,4 @@ plugin/handler_socket/perl-Net-HandlerSocket/blib plugin/handler_socket/perl-Net-HandlerSocket/pm_to_blib plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.bs plugin/handler_socket/perl-Net-HandlerSocket/Makefile.PL +libmysqld/libmysqld_exports_file.cc From 0cd5cce7a8baf57f0b912c38a5fdb798c88080e0 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Dec 2011 20:54:29 +0100 Subject: [PATCH 6/8] Fix compile error --- mysys/thr_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index fdcdd29fc1a..61f18d9dddf 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -1386,7 +1386,7 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data, enum thr_lock_type new_lock_type) { THR_LOCK *lock=in_data->lock; -#ifdef EXTRA_DEBUG +#ifndef DBUG_OFF enum thr_lock_type old_lock_type= in_data->type; #endif DBUG_ENTER("thr_downgrade_write_only_lock"); From aa5623ce33db1e206bc702d7b4c74181a91378a0 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 28 Dec 2011 22:47:27 +0100 Subject: [PATCH 7/8] Fix oqgraph build . Plugin does not need rtti, and does not load if rtti compile settings are different from server's --- storage/oqgraph/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt index 35a105f4baa..91704d75750 100644 --- a/storage/oqgraph/CMakeLists.txt +++ b/storage/oqgraph/CMakeLists.txt @@ -18,7 +18,6 @@ IF(BOOST_OK) ELSE(MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - STRING(REPLACE "-fno-rtti" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ENDIF(MSVC) From e45a6a17022f9b83d4968b0a1a034ab25f2d1123 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 28 Dec 2011 23:20:39 +0100 Subject: [PATCH 8/8] Correct search path for plugins, in out-of-source build --- mysql-test/mysql-test-run.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ad64e6e37d7..2ec52f952ab 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2726,9 +2726,9 @@ sub setup_vardir() { <../plugin/*/.libs/*.so>, <../plugin/*/*/.libs/*.so>, <../sql/.libs/*.so>, - <../storage/*/*.so>, - <../plugin/*/*.so>, - <../sql/*.so>) + <$bindir/storage/*/*.so>, + <$bindir/plugin/*/*.so>, + <$bindir/sql/*.so>) { my $pname=basename($_); symlink rel2abs($_), "$plugindir/$pname";