Browse Source
BUG#57108: mysqld crashes when I attempt to install plugin
BUG#57108: mysqld crashes when I attempt to install plugin
If a relative path is supplied to option --defaults-file or --defaults-extra-file, the server will crash when executing an INSTALL PLUGIN command. The reason is that the defaults file is initially read relative the current working directory when the server is started, but when INSTALL PLUGIN is executed, the server has changed working directory to the data directory. Since there is no check that the call to my_load_defaults() inside mysql_install_plugin(), the subsequence call to free_defaults() will crash the server. This patch fixes the problem by: - Prepending the current working directory to the file name when a relative path is given to the --defaults-file or --defaults- extra-file option the first time my_load_defaults() is called, which is just after the server has started in main(). - Adding a check of the return value of my_load_defaults() inside mysql_install_plugin() and aborting command (with an error) if an error is returned. - It also adds a check of the return value for load_defaults in lib_sql.cc for the embedded server since that was missing. To test that the relative files for the options --defaults-file and --defaults-extra-file is handled properly, mysql-test-run.pl is also changed to not add a --defaults-file option if one is provided in the tests *.opt file.pull/374/head
9 changed files with 184 additions and 13 deletions
-
2include/my_sys.h
-
3libmysqld/lib_sql.cc
-
11mysql-test/mysql-test-run.pl
-
95mysql-test/std_data/bug57108.cnf
-
5mysql-test/suite/bugs/r/bug57108.result
-
2mysql-test/suite/bugs/t/bug57108-master.opt
-
12mysql-test/suite/bugs/t/bug57108.test
-
61mysys/default.c
-
6sql/sql_plugin.cc
@ -0,0 +1,95 @@ |
|||
[mysqld] |
|||
open-files-limit=1024 |
|||
character-set-server=latin1 |
|||
connect-timeout=4711 |
|||
log-bin-trust-function-creators=1 |
|||
key_buffer_size=1M |
|||
sort_buffer=256K |
|||
max_heap_table_size=1M |
|||
loose-innodb_data_file_path=ibdata1:10M:autoextend |
|||
loose-innodb_buffer_pool_size=8M |
|||
loose-innodb_write_io_threads=2 |
|||
loose-innodb_read_io_threads=2 |
|||
loose-innodb_log_buffer_size=1M |
|||
loose-innodb_log_file_size=5M |
|||
loose-innodb_additional_mem_pool_size=1M |
|||
loose-innodb_log_files_in_group=2 |
|||
slave-net-timeout=120 |
|||
log-bin=mysqld-bin |
|||
loose-enable-performance-schema |
|||
loose-performance-schema-max-mutex-instances=10000 |
|||
loose-performance-schema-max-rwlock-instances=10000 |
|||
loose-performance-schema-max-table-instances=500 |
|||
loose-performance-schema-max-table-handles=1000 |
|||
binlog-direct-non-transactional-updates |
|||
|
|||
[mysql] |
|||
default-character-set=latin1 |
|||
|
|||
[mysqlshow] |
|||
default-character-set=latin1 |
|||
|
|||
[mysqlimport] |
|||
default-character-set=latin1 |
|||
|
|||
[mysqlcheck] |
|||
default-character-set=latin1 |
|||
|
|||
[mysql_upgrade] |
|||
default-character-set=latin1 |
|||
tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp |
|||
|
|||
[mysqld.1] |
|||
#!run-master-sh |
|||
log-bin=master-bin |
|||
loose-enable-performance-schema |
|||
basedir=/home/bzr/bugs/b57108-5.5-bugteam |
|||
tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1 |
|||
character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets |
|||
lc-messages-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/ |
|||
datadir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/data |
|||
pid-file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/run/mysqld.1.pid |
|||
#host=localhost |
|||
port=13000 |
|||
socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock |
|||
#log-error=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/log/mysqld.1.err |
|||
general_log=1 |
|||
general_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld.log |
|||
slow_query_log=1 |
|||
slow_query_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld-slow.log |
|||
#user=root |
|||
#password= |
|||
server-id=1 |
|||
secure-file-priv=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var |
|||
ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem |
|||
ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-cert.pem |
|||
ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-key.pem |
|||
|
|||
[mysqlbinlog] |
|||
disable-force-if-open |
|||
character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets |
|||
|
|||
[ENV] |
|||
MASTER_MYPORT=13000 |
|||
MASTER_MYSOCK=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock |
|||
|
|||
[client] |
|||
password= |
|||
user=root |
|||
port=13000 |
|||
host=localhost |
|||
socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock |
|||
|
|||
[mysqltest] |
|||
ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem |
|||
ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-cert.pem |
|||
ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-key.pem |
|||
skip-ssl=1 |
|||
|
|||
[client.1] |
|||
password= |
|||
user=root |
|||
port=13000 |
|||
host=localhost |
|||
socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock |
|||
|
@ -0,0 +1,5 @@ |
|||
INSTALL PLUGIN example SONAME 'ha_example.so'; |
|||
SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile; |
|||
connect_timeout 4711 |
|||
local_infile 1 |
|||
UNINSTALL PLUGIN example; |
@ -0,0 +1,2 @@ |
|||
--defaults-file=std_data/bug57108.cnf |
|||
$EXAMPLE_PLUGIN_OPT |
@ -0,0 +1,12 @@ |
|||
--source include/not_windows_embedded.inc |
|||
--source include/have_example_plugin.inc |
|||
|
|||
# Test that we can install a plugin despite the fact that we have |
|||
# switched directory after starting the server and am using a relative |
|||
# --defaults-file. |
|||
--replace_regex /\.dll/.so/ |
|||
eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; |
|||
|
|||
--query_vertical SELECT @@global.connect_timeout AS connect_timeout, @@global.local_infile AS local_infile |
|||
|
|||
UNINSTALL PLUGIN example; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue