mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -4406,7 +4406,13 @@ sub mysqld_arguments ($$$) {
|
||||
my $mysqld= shift;
|
||||
my $extra_opts= shift;
|
||||
|
||||
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
|
||||
my @defaults = grep(/^--defaults-file=/, @$extra_opts);
|
||||
if (@defaults > 0) {
|
||||
mtr_add_arg($args, pop(@defaults))
|
||||
}
|
||||
else {
|
||||
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
|
||||
}
|
||||
|
||||
# When mysqld is run by a root user(euid is 0), it will fail
|
||||
# to start unless we specify what user to run as, see BUG#30630
|
||||
@ -4442,6 +4448,9 @@ sub mysqld_arguments ($$$) {
|
||||
my $found_skip_core= 0;
|
||||
foreach my $arg ( @$extra_opts )
|
||||
{
|
||||
# Skip --defaults-file option since it's handled above.
|
||||
next if $arg =~ /^--defaults-file/;
|
||||
|
||||
# Allow --skip-core-file to be set in <testname>-[master|slave].opt file
|
||||
if ($arg eq "--skip-core-file")
|
||||
{
|
||||
|
Reference in New Issue
Block a user