Bug #13454 Windows MySQL server sets 'have_symlinks' but doesn't seem to have it
Submitted: 24 Sep 2005 5:58 Modified: 16 Nov 2005 16:07
Reporter: Kent Boortz Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.1.14-pre, 5.0.13 OS:Windows (Windows)
Assigned to: MySQL Verification Team CPU Architecture:Any

[24 Sep 2005 5:58] Kent Boortz
Description:
There is a test case 'symlink' that is only to be run when the
'have_symlinks' server variable is set. On Windows this variable
seem to be set, but the functionality is lacking.

Also the test case fails in a bit strange way, setting DATA 
DIRECTORY="tmp" succeeds instead of giving an error message.
This is likely confusing for the user, if the server lack this
functionality, giving an error message seems like the right
thing to do, instead of silently ignoring the argument. I suspect
this line in "sql_parse.cc" is causing this, just zeroing the 
directory strings

#ifndef HAVE_READLINK
    lex->create_info.data_file_name=lex->create_info.index_file_name=0;
#else

How to repeat:
Run the test case 'symlink' on Windows, using

  % cd mysq-test
  % ./mysql-test-run.pl symlinks

Suggested fix:
There seem to be some mix between HAVE_REALPATH and
HAVE_BROKEN_REALPATH. From reading the manual, having
realpath() seem to be a requirement to get symlink support.

It is not clear to me in what cases, when HAVE_REALPATH
is set, it is worth compiling in some of the support even if
HAVE_BROKEN_REALPATH is also set. So it migh be the
case that this is really about simplifying the code, like
in a header or configure set

#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH)
#define HAVE_SYMLINKS 1
#endif

and only test for HAVE_SYMLINKS in the code.

To solve the immediate Windows problem, the following patch
will make sure 'have_symlink' is not set, and then disable
the test case 'symlinks' when running tests on Windows

--- 1.601/sql/mysqld.cc 2005-09-23 23:39:47 +02:00
+++ edited/sql/mysqld.cc        2005-09-24 07:35:49 +02:00
@@ -5879,7 +5879,7 @@
 #else
   have_openssl=SHOW_OPTION_NO;
 #endif
-#ifdef HAVE_BROKEN_REALPATH
+#if !defined(HAVE_REALPATH) || defined(HAVE_BROKEN_REALPATH)
   have_symlink=SHOW_OPTION_NO;
 #else
   have_symlink=SHOW_OPTION_YES;
@@ -6550,7 +6550,7 @@
     usage();
     exit(0);
   }
-#if defined(HAVE_BROKEN_REALPATH)
+#if !defined(HAVE_REALPATH) || defined(HAVE_BROKEN_REALPATH)
   my_use_symdir=0;
   my_disable_symlinks=1;
   have_symlink=SHOW_OPTION_NO;
[24 Sep 2005 6:20] MySQL Verification Team
TEST                            RESULT
-------------------------------------------------------

symlink                         [ fail ]
Errors are (from D:/cygwin/home/miguel/mysql/mysql-test/var/log/mysqltest-time)
: