From ad94790f468bacb2cd62d02d3a6e7f012ca72e65 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 4 Feb 2016 14:47:46 +0100 Subject: MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb mysqlcheck tool can be used even if opt_systables_only is true (to upgrade views from mysql - that overrides opt_systables_only) --- client/mysql_upgrade.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0be8f91af59..bc9b3c5b149 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1051,16 +1051,11 @@ int main(int argc, char **argv) /* Find mysql */ find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); - if (!opt_systables_only) - { - /* Find mysqlcheck */ - find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); - } - else - { - if (!opt_silent) - printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); - } + /* Find mysqlcheck */ + find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + + if (opt_systables_only && !opt_silent) + printf("The --upgrade-system-tables option was used, user tables won't be touched.\n"); /* Read the mysql_upgrade_info file to check if mysql_upgrade -- cgit v1.2.1 From c4cb24006139bb6a619ca9d6b00d00c2275d2c28 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 6 Feb 2016 22:41:58 +0100 Subject: MDEV-9024 Build fails with VS2015 cherry-pick f1daf9ce from 10.0 branch ------------------------------------- Fix build failures caused by new C runtime library - isnan, snprintf, struct timespec are now defined, attempt to redefine them leads - P_tmpdir, tzname are no more defined - lfind() and lsearch() in lf_hash.c had to be renamed, declaration conflicts with some C runtime functions with the same name declared in a header included by stdlib.h Also fix couple of annoying warnings : - remove #define NOMINMAX from config.h to avoid "redefined" compiler warnings(NOMINMAX is already in compile flags) - disable incremental linker in Debug as well (feature not used much and compiler crashes often) Also simplify package building with Wix, require Wix 3.9 or later (VS2015 is not compatible with old Wix 3.5/3.6) --- client/mysql.cc | 2 +- client/mysqltest.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/mysql.cc b/client/mysql.cc index 8e40cf072cd..d33f8b186a0 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1107,7 +1107,7 @@ inline int get_command_index(char cmd_char) All client-specific commands are in the first part of commands array and have a function to implement it. */ - for (uint i= 0; *commands[i].func; i++) + for (uint i= 0; commands[i].func; i++) if (commands[i].cmd_char == cmd_char) return i; return -1; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9b925d6bfb8..8e8ddc8718b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5211,7 +5211,7 @@ static st_error global_error_names[] = #include static st_error handler_error_names[] = { - { "", -1U, "" }, + { "", UINT_MAX, "" }, #include { 0, 0, 0 } }; -- cgit v1.2.1 From 2a4781789612c6c53cbe12c1426f93b15737a148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 14 Feb 2016 18:33:20 +0200 Subject: MDEV-9225 mysql_upgrade segfault due to missing /etc/my.cnf.d In case of missing includedir file, we would attempt to free a NULL pointer. Make sure to guard against that. --- client/mysql_upgrade.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index bc9b3c5b149..8cfdac5b69a 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -182,7 +182,8 @@ static const char *load_default_groups[]= static void free_used_memory(void) { /* Free memory allocated by 'load_defaults' */ - free_defaults(defaults_argv); + if (defaults_argv) + free_defaults(defaults_argv); dynstr_free(&ds_args); dynstr_free(&conn_args); -- cgit v1.2.1 From 5a0f2f5ea80b63d937d48b00141c5fa92d6db9f2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 12 Feb 2016 17:46:34 +0100 Subject: MDEV-9149 Ctrl-C in MySQL client does not interrupt query, but interrupts the session instead mysql.cc: Unlike the main MYSQL structure, kill_mysql did not have MYSQL_OPT_PROTOCOL set. Move all connection-related settings to a separate function and use it both for the main MYSQL and for kill_mysql. --- client/mysql.cc | 77 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'client') diff --git a/client/mysql.cc b/client/mysql.cc index 71eac780262..f1346395dfe 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1346,6 +1346,44 @@ sig_handler mysql_end(int sig) exit(status.exit_status); } +/* + set connection-specific options and call mysql_real_connect +*/ +static bool do_connect(MYSQL *mysql, const char *host, const char *user, + const char *password, const char *database, ulong flags) +{ + if (opt_secure_auth) + mysql_options(mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth); +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + if (opt_use_ssl) + { + mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, + opt_ssl_capath, opt_ssl_cipher); + mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } + mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + (char*)&opt_ssl_verify_server_cert); +#endif + if (opt_protocol) + mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); +#ifdef HAVE_SMEM + if (shared_memory_base_name) + mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); +#endif + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + + mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, + "program_name", "mysql"); + return mysql_real_connect(mysql, host, user, password, database, + opt_mysql_port, opt_mysql_unix_port, flags); +} + /* This function handles sigint calls @@ -1367,11 +1405,7 @@ sig_handler handle_sigint(int sig) } kill_mysql= mysql_init(kill_mysql); - mysql_options(kill_mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); - mysql_options4(kill_mysql, MYSQL_OPT_CONNECT_ATTR_ADD, - "program_name", "mysql"); - if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, - "", opt_mysql_port, opt_mysql_unix_port,0)) + if (!do_connect(kill_mysql,current_host, current_user, opt_password, "", 0)) { tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n"); goto err; @@ -4580,27 +4614,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, } if (opt_compress) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); - if (opt_secure_auth) - mysql_options(&mysql, MYSQL_SECURE_AUTH, (char *) &opt_secure_auth); if (using_opt_local_infile) mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - if (opt_use_ssl) - { - mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, - opt_ssl_capath, opt_ssl_cipher); - mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); - mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); - } - mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, - (char*)&opt_ssl_verify_server_cert); -#endif - if (opt_protocol) - mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif if (safe_updates) { char init_command[100]; @@ -4612,18 +4627,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); - if (opt_plugin_dir && *opt_plugin_dir) - mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); - - if (opt_default_auth && *opt_default_auth) - mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); - - mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); - mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD, - "program_name", "mysql"); - if (!mysql_real_connect(&mysql, host, user, password, - database, opt_mysql_port, opt_mysql_unix_port, - connect_flag | CLIENT_MULTI_STATEMENTS)) + if (!do_connect(&mysql, host, user, password, database, + connect_flag | CLIENT_MULTI_STATEMENTS)) { if (!silent || (mysql_errno(&mysql) != CR_CONN_HOST_ERROR && -- cgit v1.2.1