From b9f9fe2e1a8ce599140d38cfd8f7d58b5344e36e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Nov 2009 12:43:16 +0800 Subject: Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm The 'slave_patternload_file' is assigned to the real path of the load data file when initializing the object of Relay_log_info. But the path of the load data file is not formatted to real path when executing event from relay log. So the error will be encountered if the path of the load data file is a symbolic link. Actually the global 'opt_secure_file_priv' is not formatted to real path when loading data from file. So the same thing will happen too. To fix these errors, the path of the load data file should be formatted to real path when executing event from relay log. And the 'opt_secure_file_priv' should be formatted to real path when loading data infile. mysql-test/suite/rpl/r/rpl_loaddata_symlink.result: Test result for bug#43913. mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh: Added the test file to create a link from $MYSQLTEST_VARDIR/std_data to $MYSQLTEST_VARDIR/std_data_master_link mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh: Added the test file to create a link from $MYSQLTEST_VARDIR/std_data to $MYSQLTEST_VARDIR/std_data_slave_link mysql-test/suite/rpl/t/rpl_loaddata_symlink.test: Added the test file to verify if loading data infile will work fine if the path of the load data file is a symbolic link. sql/rpl_rli.cc: Added call 'my_realpath' function for avoiding sometimes the 'fn_format' function can't format real path rightly. --- sql/sql_load.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sql/sql_load.cc') diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 5500439b619..8109ca4313e 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -304,7 +304,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, else { (void) fn_format(name, ex->file_name, mysql_real_data_home, "", - MY_RELATIVE_PATH | MY_UNPACK_FILENAME); + MY_RELATIVE_PATH | MY_UNPACK_FILENAME | + MY_RETURN_REAL_PATH); #if !defined(__WIN__) && ! defined(__NETWARE__) MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(MY_WME))) @@ -347,12 +348,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, DBUG_ASSERT(FALSE); #endif } - else if (opt_secure_file_priv && - strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv))) + else if (opt_secure_file_priv) { - /* Read only allowed from within dir specified by secure_file_priv */ - my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); - DBUG_RETURN(TRUE); + char secure_file_real_path[FN_REFLEN]; + (void) my_realpath(secure_file_real_path, opt_secure_file_priv, 0); + if (strncmp(secure_file_real_path, name, strlen(secure_file_real_path))) + { + /* Read only allowed from within dir specified by secure_file_priv */ + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv"); + DBUG_RETURN(TRUE); + } } } -- cgit v1.2.1