diff options
author | unknown <tnurnberg@mysql.com/sin.intern.azundris.com> | 2007-09-13 16:19:46 +0200 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/sin.intern.azundris.com> | 2007-09-13 16:19:46 +0200 |
commit | 78653bdf697b3047069affb8eb263a6058ab58ce (patch) | |
tree | 602e3e9d9862d8866b20f7d497d64c91d470ea4e /tests | |
parent | 0167bdd230278e6d0f8aed192dfb8d55e63b34dc (diff) | |
download | mariadb-git-78653bdf697b3047069affb8eb263a6058ab58ce.tar.gz |
Bug #15327: configure: --with-tcp-port option being partially ignored
make sure that if builder configured with a non-standard (!= 3306)
default TCP port that value actually gets used throughout. if they
didn't configure a value, assume "use a sensible default", which
will be read from /etc/services or, failing that, from the factory
default. That makes the order of preference
- command-line option
- my.cnf, where applicable
- $MYSQL_TCP_PORT environment variable
- /etc/services (unless configured --with-tcp-port)
- default port (--with-tcp-port=... or factory default)
client/mysql.cc:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysql_upgrade.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqladmin.cc:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqlbinlog.cc:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqlcheck.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqldump.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqlimport.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqlmanagerc.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
configure.in:
Bug #15327: configure: --with-tcp-port option being partially ignored
If MYSQL_TCP_PORT defaulted in configure (factory default 3306
at the time of this writing), set MYSQL_TCP_PORT to factory
default, then clear factory default after. That way, we lose no
information, and we can distinguish between "defaulted" and the
pathological case "builder specifically configured a port that
coincides with factory default." This can in theory happen if
builder configures and builds several servers from a script
(--with-tcp-port=3306, --with-tcp-port=3316, --with-tcp-port=3326).
Not all that probable, but much preferable to having more "magic"
happen in the server when we can solve this without any guesswork.
client/mysqlshow.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
client/mysqltest.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
include/mysql_version.h.in:
Bug #15327: configure: --with-tcp-port option being partially ignored
make factory default for TCP port available as MYSQL_PORT_DEFAULT
if build-time configured with a different default. (0 if unchanged)
libmysql/libmysql.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
initialize default tcp port for client, like so:
- if user configured --with-tcp-port, use that value as default
- otherwise assume "use a good default": search mysqld/tcp in
/etc/services; if that doesn't exist, use factory default (3306)
- environment variable MYSQL_TCP_PORT overrides this default
- command-line option overrides all of the above
mysql-test/Makefile.am:
Bug #15327: configure: --with-tcp-port option being partially ignored
make factory default for TCP port available as MYSQL_TCP_PORT_DEFAULT
if build-time configured with a different default. (0 if unchanged)
mysql-test/mysql-test-run-shell.sh:
Bug #15327: configure: --with-tcp-port option being partially ignored
set up MYSQL_TCP_PORT if not already set in environment:
- if user configured --with-tcp-port, use that value as default
- otherwise assume "use a good default": search mysqld/tcp in
/etc/services; if that doesn't exist, use factory default (3306)
netware/mysql_test_run.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
account for non-standard default port-no. configured at build-time
netware/mysqld_safe.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
account for non-standard default port-no. configured at build-time
scripts/Makefile.am:
Bug #15327: configure: --with-tcp-port option being partially ignored
make factory default for TCP port available as MYSQL_TCP_PORT_DEFAULT
if build-time configured with a different default. (0 if unchanged)
scripts/mysql_config.sh:
Bug #15327: configure: --with-tcp-port option being partially ignored
set up MYSQL_TCP_PORT if not already set in environment:
- if user configured --with-tcp-port, use that value as default
- otherwise assume "use a good default": search mysqld/tcp in
/etc/services; if that doesn't exist, use factory default (3306)
scripts/mysql_fix_privilege_tables.sh:
Bug #15327: configure: --with-tcp-port option being partially ignored
clarifying notice only
scripts/mysqld_safe-watch.sh:
Bug #15327: configure: --with-tcp-port option being partially ignored
account for non-standard default port-no. configured at build-time
server-tools/instance-manager/priv.h:
Bug #15327: configure: --with-tcp-port option being partially ignored
account for non-standard default port-no. configured at build-time
sql/mysqld.cc:
Bug #15327: configure: --with-tcp-port option being partially ignored
if builder specifically requested a default port, use that
(even if it coincides with our factory default).
only if they didn't do we check /etc/services (and, failing
on that, fall back to the factory default of 3306).
either default can be overridden by the environment variable
MYSQL_TCP_PORT, which in turn can be overridden with command
line options.
tests/mysql_client_test.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
tests/ssl_test.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
account for non-standard default port-no. configured at build-time
tests/thread_test.c:
Bug #15327: configure: --with-tcp-port option being partially ignored
make help on --port a little more clear
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 8 | ||||
-rw-r--r-- | tests/ssl_test.c | 2 | ||||
-rw-r--r-- | tests/thread_test.c | 8 |
3 files changed, 15 insertions, 3 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 75c86902972..4a1941a2cf8 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15759,7 +15759,13 @@ static struct my_option client_test_long_options[] = {"password", 'p', "Password to use when connecting to server. If password is not given it's asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"port", 'P', "Port number to use for connection", (char **) &opt_port, + {"port", 'P', "Port number to use for connection or 0 for default to, in " + "order of preference, my.cnf, $MYSQL_TCP_PORT, " +#if MYSQL_PORT_DEFAULT == 0 + "/etc/services, " +#endif + "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", + (char **) &opt_port, (char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-arg", 'A', "Send embedded server this as a parameter.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/tests/ssl_test.c b/tests/ssl_test.c index 136f0a83cbe..ad6bc925cc6 100644 --- a/tests/ssl_test.c +++ b/tests/ssl_test.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) "../SSL/MySQL-client-cert.pem", "../SSL/MySQL-ca-cert.pem", 0, 0); #endif - if (!(sock = mysql_real_connect(&mysql,"127.0.0.1",0,0,argv[1],3306,NULL,0))) + if (!(sock = mysql_real_connect(&mysql,"127.0.0.1",0,0,argv[1],MYSQL_PORT,NULL,0))) { fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql)); perror(""); diff --git a/tests/thread_test.c b/tests/thread_test.c index 0ad446282c2..0ba03694893 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -103,7 +103,13 @@ static struct my_option my_long_options[] = (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"query", 'Q', "Query to execute in each threads", (gptr*) &query, (gptr*) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"port", 'P', "Port number to use for connection", (gptr*) &tcp_port, + {"port", 'P', "Port number to use for connection or 0 for default to, in " + "order of preference, my.cnf, $MYSQL_TCP_PORT, " +#if MYSQL_PORT_DEFAULT == 0 + "/etc/services, " +#endif + "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", + (gptr*) &tcp_port, (gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, {"socket", 'S', "Socket file to use for connection", (gptr*) &unix_socket, (gptr*) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |