Commit a1db28a2 authored by unknown's avatar unknown

Don't try to create a symlink if the DATA DIRECTORY specified for a table

is the same as the normal datadir for that database. (Bug #8707)


mysys/my_symlink2.c:
  Expand path of linkname before checking it against filename to decide if
  we need to create a link.
mysql-test/t/symlink.test:
  Add new regression test
mysql-test/r/symlink.result:
  Add new results
parent 87762300
......@@ -84,3 +84,17 @@ t1 CREATE TABLE `t1` (
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (i int) data directory = "/home/jimw/my/mysql-4.1-8707/mysql-test/var/master-data/test/";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (i int) index directory = "/home/jimw/my/mysql-4.1-8707/mysql-test/var/master-data/test/";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -115,3 +115,14 @@ eval alter table t1 index directory="$MYSQL_TEST_DIR/var/log";
enable_query_log;
show create table t1;
drop table t1;
#
# Test specifying DATA DIRECTORY that is the same as what would normally
# have been chosen. (Bug #8707)
#
eval create table t1 (i int) data directory = "$MYSQL_TEST_DIR/var/master-data/test/";
show create table t1;
drop table t1;
eval create table t1 (i int) index directory = "$MYSQL_TEST_DIR/var/master-data/test/";
show create table t1;
drop table t1;
......@@ -32,6 +32,7 @@ File my_create_with_symlink(const char *linkname, const char *filename,
int tmp_errno;
/* Test if we should create a link */
int create_link;
char abs_linkname[FN_REFLEN];
DBUG_ENTER("my_create_with_symlink");
if (my_disable_symlinks)
......@@ -42,7 +43,11 @@ File my_create_with_symlink(const char *linkname, const char *filename,
filename= linkname;
}
else
create_link= (linkname && strcmp(linkname,filename));
{
if (linkname)
my_realpath(&abs_linkname, linkname, MYF(0));
create_link= (linkname && strcmp(abs_linkname,filename));
}
if (!(MyFlags & MY_DELETE_OLD))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment