mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Cleanup of MDEV-14974: --port ignored for --host=localhost
The old code added to 10.6 was inconsisting in how TCP/IP and socket connection was chosen. One got also a confusing warning in some cases. Examples: > ../client/mysql --print-defaults ../client/mysql would have been started with the following arguments: --socket=/tmp/mariadbd.sock --port=3307 --no-auto-rehash > ../client/mysql ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mariadbd.sock' (2) > ../client/mysql --print-defaults ../client/mysql would have been started with the following arguments: --socket=/tmp/mariadbd.sock --port=3307 --no-auto-rehash > ../client/mysql --port=3333 WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol. ERROR 2002 (HY000): Can't connect to server on 'localhost' (111) > ../client/mysql --port=3333 --socket=sss ERROR 2002 (HY000): Can't connect to local server through socket 'sss' (2) > ../client/mysql --socket=sss --port=3333 ERROR 2002 (HY000): Can't connect to local server through socket 'sss' (2) Some notable things: - One gets a warning if one uses just --port if config file sets socket - Using port and socket gives no warning - Using socket and then port still uses socket This patch changes things the following ways: If --port= is given on the command line, the the protocol is automatically changed to "TCP/IP". - If --socket= is given on the command line, the protocol is automatically changed to "socket". - The last option wins - No warning is given if protocol changes automatically.
This commit is contained in:
@ -148,51 +148,3 @@ enum options_client
|
|||||||
#else
|
#else
|
||||||
#define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE
|
#define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Utility function to implicitly change the connection protocol to a
|
|
||||||
consistent value given the command line arguments. Additionally,
|
|
||||||
warns the user that the protocol has been changed.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
@param [in] host Name of the host to connect to
|
|
||||||
@param [in, out] opt_protocol Location of the protocol option
|
|
||||||
variable to update
|
|
||||||
@param [in] new_protocol New protocol to force
|
|
||||||
*/
|
|
||||||
static inline void warn_protocol_override(char *host,
|
|
||||||
uint *opt_protocol,
|
|
||||||
uint new_protocol)
|
|
||||||
{
|
|
||||||
DBUG_ASSERT(new_protocol == MYSQL_PROTOCOL_TCP
|
|
||||||
|| new_protocol == SOCKET_PROTOCOL_TO_FORCE);
|
|
||||||
|
|
||||||
|
|
||||||
if ((host == NULL
|
|
||||||
|| strncmp(host, LOCAL_HOST, sizeof(LOCAL_HOST)-1) == 0))
|
|
||||||
{
|
|
||||||
const char *protocol_name;
|
|
||||||
|
|
||||||
if (*opt_protocol == MYSQL_PROTOCOL_DEFAULT
|
|
||||||
#ifndef _WIN32
|
|
||||||
&& new_protocol == MYSQL_PROTOCOL_SOCKET
|
|
||||||
#else
|
|
||||||
&& new_protocol == MYSQL_PROTOCOL_TCP
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/* This is already the default behavior, do nothing */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
protocol_name= sql_protocol_typelib.type_names[new_protocol-1];
|
|
||||||
|
|
||||||
fprintf(stderr, "%s %s %s\n",
|
|
||||||
"WARNING: Forcing protocol to ",
|
|
||||||
protocol_name,
|
|
||||||
" due to option specification. "
|
|
||||||
"Please explicitly state intended protocol.");
|
|
||||||
|
|
||||||
*opt_protocol = new_protocol;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -210,8 +210,6 @@ static uint opt_protocol=0;
|
|||||||
static const char *opt_protocol_type= "";
|
static const char *opt_protocol_type= "";
|
||||||
static CHARSET_INFO *charset_info= &my_charset_latin1;
|
static CHARSET_INFO *charset_info= &my_charset_latin1;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
#include "sslopt-vars.h"
|
#include "sslopt-vars.h"
|
||||||
|
|
||||||
const char *default_dbug_option="d:t:o,/tmp/mariadb.trace";
|
const char *default_dbug_option="d:t:o,/tmp/mariadb.trace";
|
||||||
@ -1180,14 +1178,6 @@ int main(int argc,char *argv[])
|
|||||||
exit(status.exit_status);
|
exit(status.exit_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (status.batch && !status.line_buff &&
|
if (status.batch && !status.line_buff &&
|
||||||
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
|
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
|
||||||
{
|
{
|
||||||
@ -1737,11 +1727,9 @@ static void usage(int version)
|
|||||||
|
|
||||||
|
|
||||||
my_bool
|
my_bool
|
||||||
get_one_option(const struct my_option *opt, const char *argument, const char *filename)
|
get_one_option(const struct my_option *opt, const char *argument,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
/* Track when protocol is set via CLI to not force port TCP protocol override */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
case OPT_CHARSETS_DIR:
|
case OPT_CHARSETS_DIR:
|
||||||
strmake_buf(mysql_charsets_dir, argument);
|
strmake_buf(mysql_charsets_dir, argument);
|
||||||
@ -1802,18 +1790,11 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (!argument[0])
|
if (!argument[0])
|
||||||
opt_protocol= 0;
|
opt_protocol= 0;
|
||||||
else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
|
else if ((opt_protocol=
|
||||||
|
find_type_with_warning(argument, &sql_protocol_typelib,
|
||||||
opt->name)) <= 0)
|
opt->name)) <= 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case OPT_SERVER_ARG:
|
case OPT_SERVER_ARG:
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
@ -1913,13 +1894,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||||
opt_protocol_type= "pipe";
|
opt_protocol_type= "pipe";
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#include <sslopt-case.h>
|
#include <sslopt-case.h>
|
||||||
@ -1932,35 +1906,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
mysql_end(-1);
|
mysql_end(-1);
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
|
@ -54,8 +54,6 @@ static bool sql_log_bin_off= false;
|
|||||||
static uint opt_protocol=0;
|
static uint opt_protocol=0;
|
||||||
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
|
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
When using extended-status relatively, ex_val_max_len is the estimated
|
When using extended-status relatively, ex_val_max_len is the estimated
|
||||||
maximum length for any relative value printed by extended-status. The
|
maximum length for any relative value printed by extended-status. The
|
||||||
@ -243,12 +241,9 @@ static const char *load_default_groups[]=
|
|||||||
0 };
|
0 };
|
||||||
|
|
||||||
my_bool
|
my_bool
|
||||||
get_one_option(const struct my_option *opt, const char *argument, const char *filename)
|
get_one_option(const struct my_option *opt, const char *argument,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
case 'c':
|
case 'c':
|
||||||
opt_count_iterations= 1;
|
opt_count_iterations= 1;
|
||||||
@ -280,13 +275,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
case 'W':
|
case 'W':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
@ -322,45 +310,19 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -388,13 +350,6 @@ int main(int argc,char *argv[])
|
|||||||
temp_argv= mask_password(argc, &argv);
|
temp_argv= mask_password(argc, &argv);
|
||||||
temp_argc= argc;
|
temp_argc= argc;
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug_info_flag)
|
if (debug_info_flag)
|
||||||
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
||||||
if (debug_check_flag)
|
if (debug_check_flag)
|
||||||
|
@ -98,8 +98,6 @@ static const char *output_prefix= "";
|
|||||||
static char **defaults_argv= 0;
|
static char **defaults_argv= 0;
|
||||||
static MEM_ROOT glob_root;
|
static MEM_ROOT glob_root;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace";
|
static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace";
|
||||||
const char *current_dbug_option= default_dbug_option;
|
const char *current_dbug_option= default_dbug_option;
|
||||||
@ -1898,13 +1896,11 @@ static my_time_t convert_str_to_timestamp(const char* str)
|
|||||||
|
|
||||||
|
|
||||||
extern "C" my_bool
|
extern "C" my_bool
|
||||||
get_one_option(const struct my_option *opt, const char *argument, const char *filename)
|
get_one_option(const struct my_option *opt, const char *argument,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
bool tty_password=0;
|
bool tty_password=0;
|
||||||
|
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch (opt->id) {
|
switch (opt->id) {
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
case '#':
|
case '#':
|
||||||
@ -1954,14 +1950,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
die(1);
|
die(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#ifdef WHEN_FLASHBACK_REVIEW_READY
|
#ifdef WHEN_FLASHBACK_REVIEW_READY
|
||||||
case opt_flashback_review:
|
case opt_flashback_review:
|
||||||
@ -2039,35 +2027,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
|
|||||||
print_row_event_positions_used= 1;
|
print_row_event_positions_used= 1;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
@ -3043,13 +3013,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
parse_args(&argc, (char***)&argv);
|
parse_args(&argc, (char***)&argv);
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!argc || opt_version)
|
if (!argc || opt_version)
|
||||||
{
|
{
|
||||||
if (!opt_version)
|
if (!opt_version)
|
||||||
|
@ -57,8 +57,6 @@ DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
|
|||||||
DYNAMIC_ARRAY views4repair;
|
DYNAMIC_ARRAY views4repair;
|
||||||
static uint opt_protocol=0;
|
static uint opt_protocol=0;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES };
|
enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES };
|
||||||
const char *operation_name[]=
|
const char *operation_name[]=
|
||||||
{
|
{
|
||||||
@ -291,10 +289,6 @@ get_one_option(const struct my_option *opt,
|
|||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
int orig_what_to_do= what_to_do;
|
int orig_what_to_do= what_to_do;
|
||||||
|
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
DBUG_ENTER("get_one_option");
|
DBUG_ENTER("get_one_option");
|
||||||
|
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
@ -357,13 +351,6 @@ get_one_option(const struct my_option *opt,
|
|||||||
case 'W':
|
case 'W':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
@ -387,45 +374,19 @@ get_one_option(const struct my_option *opt,
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1248,14 +1209,6 @@ int main(int argc, char **argv)
|
|||||||
if (get_options(&argc, &argv))
|
if (get_options(&argc, &argv))
|
||||||
goto end1;
|
goto end1;
|
||||||
|
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_leaking_memory=0; /* from now on we cleanup properly */
|
sf_leaking_memory=0; /* from now on we cleanup properly */
|
||||||
|
|
||||||
ret= EX_MYSQLERR;
|
ret= EX_MYSQLERR;
|
||||||
|
@ -194,12 +194,10 @@ FILE *stderror_file=0;
|
|||||||
static uint opt_protocol= 0;
|
static uint opt_protocol= 0;
|
||||||
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
|
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Dynamic_string wrapper functions. In this file use these
|
Dynamic_string wrapper functions. In this file use these
|
||||||
wrappers, they will terminate the process if there is
|
wrappers, they will terminate the process if there is
|
||||||
an allocation failure.
|
an allocation failure.
|
||||||
*/
|
*/
|
||||||
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
|
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
|
||||||
size_t init_alloc, size_t alloc_increment);
|
size_t init_alloc, size_t alloc_increment);
|
||||||
@ -871,9 +869,6 @@ get_one_option(const struct my_option *opt,
|
|||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch (opt->id) {
|
switch (opt->id) {
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument == disabled_my_option)
|
if (argument == disabled_my_option)
|
||||||
@ -904,13 +899,6 @@ get_one_option(const struct my_option *opt,
|
|||||||
case 'W':
|
case 'W':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol= MYSQL_PROTOCOL_PIPE;
|
opt_protocol= MYSQL_PROTOCOL_PIPE;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
@ -1061,49 +1049,23 @@ get_one_option(const struct my_option *opt,
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (int) OPT_DEFAULT_CHARSET:
|
case (int) OPT_DEFAULT_CHARSET:
|
||||||
if (default_charset == disabled_my_option)
|
if (default_charset == disabled_my_option)
|
||||||
default_charset= (char *)mysql_universal_client_charset;
|
default_charset= (char *)mysql_universal_client_charset;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1152,19 +1114,9 @@ static int get_options(int *argc, char ***argv)
|
|||||||
return(ho_error);
|
return(ho_error);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Command line options override configured protocol
|
Dumping under --system=stats with --replace or --insert-ignore is
|
||||||
*/
|
safe and will not result into race condition. Otherwise dump only
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
structure and ignore data by default while dumping.
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Dumping under --system=stats with --replace or --insert-ignore is safe and will not
|
|
||||||
result into race condition. Otherwise dump only structure and ignore data by default
|
|
||||||
while dumping.
|
|
||||||
*/
|
*/
|
||||||
if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into))
|
if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into))
|
||||||
{
|
{
|
||||||
|
@ -64,8 +64,6 @@ static char * opt_mysql_unix_port=0;
|
|||||||
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
|
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
|
||||||
static longlong opt_ignore_lines= -1;
|
static longlong opt_ignore_lines= -1;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
#include <sslopt-vars.h>
|
#include <sslopt-vars.h>
|
||||||
|
|
||||||
static char **argv_to_free;
|
static char **argv_to_free;
|
||||||
@ -227,9 +225,6 @@ static my_bool
|
|||||||
get_one_option(const struct my_option *opt, const char *argument,
|
get_one_option(const struct my_option *opt, const char *argument,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument == disabled_my_option)
|
if (argument == disabled_my_option)
|
||||||
@ -256,14 +251,6 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
case 'W':
|
case 'W':
|
||||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||||
opt_local_file=1;
|
opt_local_file=1;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
@ -273,45 +260,19 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
@ -709,13 +670,6 @@ int main(int argc, char **argv)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_leaking_memory=0; /* from now on we cleanup properly */
|
sf_leaking_memory=0; /* from now on we cleanup properly */
|
||||||
|
|
||||||
if (opt_use_threads && !lock_tables)
|
if (opt_use_threads && !lock_tables)
|
||||||
|
@ -41,8 +41,6 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
|
|||||||
|
|
||||||
static uint opt_protocol=0;
|
static uint opt_protocol=0;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
static void get_options(int *argc,char ***argv);
|
static void get_options(int *argc,char ***argv);
|
||||||
static uint opt_mysql_port=0;
|
static uint opt_mysql_port=0;
|
||||||
static int list_dbs(MYSQL *mysql,const char *wild);
|
static int list_dbs(MYSQL *mysql,const char *wild);
|
||||||
@ -81,14 +79,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
get_options(&argc,&argv);
|
get_options(&argc,&argv);
|
||||||
|
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_leaking_memory=0; /* from now on we cleanup properly */
|
sf_leaking_memory=0; /* from now on we cleanup properly */
|
||||||
wild=0;
|
wild=0;
|
||||||
if (argc)
|
if (argc)
|
||||||
@ -307,9 +297,6 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
case 'v':
|
case 'v':
|
||||||
opt_verbose++;
|
opt_verbose++;
|
||||||
@ -338,13 +325,6 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
case 'W':
|
case 'W':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
opt_protocol = MYSQL_PROTOCOL_PIPE;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
@ -354,47 +334,22 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : "d:t:o");
|
DBUG_PUSH(argument ? argument : "d:t:o");
|
||||||
debug_check_flag= 1;
|
debug_check_flag= 1;
|
||||||
|
@ -172,8 +172,6 @@ File csv_file;
|
|||||||
|
|
||||||
static uint opt_protocol= 0;
|
static uint opt_protocol= 0;
|
||||||
|
|
||||||
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
|
|
||||||
static int get_options(int *argc,char ***argv);
|
static int get_options(int *argc,char ***argv);
|
||||||
static uint opt_mysql_port= 0;
|
static uint opt_mysql_port= 0;
|
||||||
|
|
||||||
@ -335,13 +333,6 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command line options override configured protocol */
|
|
||||||
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
|
|
||||||
&& protocol_to_force != opt_protocol)
|
|
||||||
{
|
|
||||||
warn_protocol_override(host, &opt_protocol, protocol_to_force);
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_leaking_memory=0; /* from now on we cleanup properly */
|
sf_leaking_memory=0; /* from now on we cleanup properly */
|
||||||
|
|
||||||
/* Seed the random number generator if we will be using it. */
|
/* Seed the random number generator if we will be using it. */
|
||||||
@ -744,9 +735,6 @@ static my_bool
|
|||||||
get_one_option(const struct my_option *opt, const char *argument,
|
get_one_option(const struct my_option *opt, const char *argument,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
/* Track when protocol is set via CLI to not force overrides */
|
|
||||||
static my_bool ignore_protocol_override = FALSE;
|
|
||||||
|
|
||||||
DBUG_ENTER("get_one_option");
|
DBUG_ENTER("get_one_option");
|
||||||
switch(opt->id) {
|
switch(opt->id) {
|
||||||
case 'v':
|
case 'v':
|
||||||
@ -776,13 +764,6 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
case 'W':
|
case 'W':
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
opt_protocol= MYSQL_PROTOCOL_PIPE;
|
opt_protocol= MYSQL_PROTOCOL_PIPE;
|
||||||
|
|
||||||
/* Prioritize pipe if explicit via command line */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case OPT_MYSQL_PROTOCOL:
|
case OPT_MYSQL_PROTOCOL:
|
||||||
@ -792,45 +773,19 @@ get_one_option(const struct my_option *opt, const char *argument,
|
|||||||
sf_leaking_memory= 1; /* no memory leak reports here */
|
sf_leaking_memory= 1; /* no memory leak reports here */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specification of protocol via CLI trumps implicit overrides */
|
|
||||||
if (filename[0] == '\0')
|
|
||||||
{
|
|
||||||
ignore_protocol_override = TRUE;
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Port given on command line, switch protocol to use TCP */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_TCP;
|
||||||
}
|
|
||||||
|
|
||||||
/* If port is set via CLI, try to force protocol to TCP */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = MYSQL_PROTOCOL_TCP;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
/* If port and socket are set, fall back to default behavior */
|
if (filename[0] == '\0')
|
||||||
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
|
|
||||||
{
|
{
|
||||||
ignore_protocol_override = TRUE;
|
/* Socket given on command line, switch protocol to use SOCKETSt */
|
||||||
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
|
opt_protocol= MYSQL_PROTOCOL_SOCKET;
|
||||||
}
|
|
||||||
|
|
||||||
/* Prioritize socket if set via command line */
|
|
||||||
if (filename[0] == '\0' &&
|
|
||||||
!ignore_protocol_override &&
|
|
||||||
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
|
|
||||||
{
|
|
||||||
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
|
@ -4,21 +4,19 @@
|
|||||||
#
|
#
|
||||||
# The following group of tests should produce no warnings
|
# The following group of tests should produce no warnings
|
||||||
#
|
#
|
||||||
# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: Localhost via UNIX socket
|
Connection: Localhost via UNIX socket
|
||||||
# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: localhost via TCP/IP
|
Connection: localhost via TCP/IP
|
||||||
# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: Localhost via UNIX socket
|
Connection: Localhost via UNIX socket
|
||||||
# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: 127.0.0.1 via TCP/IP
|
Connection: 127.0.0.1 via TCP/IP
|
||||||
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: Localhost via UNIX socket
|
Connection: localhost via TCP/IP
|
||||||
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
Connection: Localhost via UNIX socket
|
Connection: Localhost via UNIX socket
|
||||||
#
|
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
# The remaining tests should produce warnings
|
Connection: Localhost via UNIX socket
|
||||||
#
|
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
|
||||||
WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol.
|
|
||||||
Connection: localhost via TCP/IP
|
Connection: localhost via TCP/IP
|
||||||
|
@ -10,28 +10,26 @@
|
|||||||
--echo # The following group of tests should produce no warnings
|
--echo # The following group of tests should produce no warnings
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
--exec $MYSQL --host=localhost --port=MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
|
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
|
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
|
||||||
|
|
||||||
--echo #
|
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
--echo # The remaining tests should produce warnings
|
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
|
||||||
--echo #
|
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
|
||||||
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
|
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
#
|
#
|
||||||
# MDEV-14974: --port ignored for --host=localhost
|
# MDEV-14974: --port ignored for --host=localhost
|
||||||
#
|
#
|
||||||
#
|
# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
# The following group of tests should produce no warnings
|
|
||||||
#
|
|
||||||
# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
Connection: localhost via TCP/IP
|
Connection: localhost via TCP/IP
|
||||||
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
Connection: localhost via TCP/IP
|
Connection: localhost via TCP/IP
|
||||||
# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
Connection: localhost via TCP/IP
|
Connection: localhost via TCP/IP
|
||||||
# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
Connection: localhost via named pipe
|
Connection: localhost via named pipe
|
||||||
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
Connection: localhost via named pipe
|
|
||||||
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
Connection: localhost via named pipe
|
|
||||||
#
|
|
||||||
# The remaining tests should produce warnings
|
|
||||||
#
|
|
||||||
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
WARNING: Forcing protocol to PIPE due to option specification. Please explicitly state intended protocol.
|
|
||||||
Connection: localhost via named pipe
|
Connection: localhost via named pipe
|
||||||
|
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
Connection: localhost via TCP/IP
|
||||||
|
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
Connection: localhost via TCP/IP
|
||||||
|
@ -5,33 +5,23 @@
|
|||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
--source include/windows.inc
|
--source include/windows.inc
|
||||||
|
|
||||||
|
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo #
|
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--echo # The following group of tests should produce no warnings
|
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--echo #
|
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
|
||||||
--echo # The remaining tests should produce warnings
|
|
||||||
--echo #
|
|
||||||
|
|
||||||
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
|
|
||||||
|
Reference in New Issue
Block a user