Bug #25677 With --skip-symbolic-links option on, DATA DIRECTORY clause is silently ignored
Submitted: 17 Jan 2007 11:13 Modified: 27 Mar 2008 19:16
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.1/5.0/5.1BK OS:Linux (Linux)
Assigned to: Sergey Vojtovich CPU Architecture:Any

[17 Jan 2007 11:13] Konstantin Osipov
Description:
When for some reason symbolic links are not supported or disabled, DATA DIRECTORY option is silently ignored, with no warning or error produced.

How to repeat:
Start ./mysqld with option --skip-symbolic-links or compile with HAVE_purify on:

mysql> create table t1 (a int) data directory='/tmp';
Query OK, 0 rows affected (0.02 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

I will not go into what nasty side effects this may produce if a table was created
with --symbolic-links ON, and dropped with --symbolic-links off (the data file will be left hanging around).

The same behaviour is present in case of sql_mode NO_DIR_IN_CREATE:
mysql> create table t1 (a int) data directory='/tmp';
Query OK, 0 rows affected (0.02 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Suggested fix:
Produce a warning or an error if the request to create a table in a specified directory can not be fulfilled.
[17 Jan 2007 11:31] Sergey Vojtovich
Hi!

Looks like a dup of BUG#17498.
[17 Jan 2007 11:40] Konstantin Osipov
Judging by the patch for Bug#17498 it is not. The patch does not take into account the command line option and the sql mode, which can also influence the silent truncation of data_file_name.
[17 Jan 2007 11:47] Sergey Vojtovich
You're right. Sorry for confusion. This problem is relevant to command line option and sql mode.
[17 Jan 2007 13:00] MySQL Verification Team
Thank you for the bug report.
[7 Dec 2007 13:41] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/39529

ChangeSet@1.2677, 2007-12-07 17:40:42+04:00, svoj@mysql.com +4 -0
  BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY
              clause is silently ignored
  
  When symbolic links are disabled by command line option or
  NO_DIR_IN_CREATE sql mode, CREATE TABLE silently ignores
  DATA/INDEX DIRECTORY options.
  
  With this fix a warning is issued when symbolic links are disabled.
[27 Mar 2008 11:18] Bugs System
Pushed into 5.1.24-rc
[27 Mar 2008 17:49] Bugs System
Pushed into 6.0.5-alpha
[27 Mar 2008 19:16] Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs.

When symbolic links were disabled, either with a server startup
option or by enabling the NO_DIR_IN_CREATE SQL mode, CREATE TABLE
silently ignored the DATA DIRECTORY and INDEX DIRECTORY table
options. Now the server issues a warning if symbolic links are
disabled when these table options are used.
[30 Mar 2008 0:27] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11.