Bug #2179 Setting lower_case_table_names to 0 in my.ini crashes mysqld
Submitted: 21 Dec 2003 12:01 Modified: 3 Mar 2004 5:57
Reporter: Richard Hansen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.17 OS:Windows (Windows XP)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[21 Dec 2003 12:01] Richard Hansen
Description:
If I put "set-variable=lower_case_table_names=0" in c:\windows\my.ini, mysqld will crash at startup.  The call to sql_print_error() in sql/mysqld.cpp on line 4958 seems to cause the crash.  After doing some research, I found that the crash happens on line 1689 of sql/log.cpp.

Since sql_print_error() is called without crashing later on (for example, during a normal shutdown), maybe something hasn't been fully initialized by the time sql_print_error is called on line 4958 of sql/mysqld.cpp.

How to repeat:
Set the variable lower_case_table_names to 0 and run mysqld (make sure the tables are on a case-insensitive file system).  When line 4958 of sql/mysqld.cpp is executed, mysqld will crash.
[21 Dec 2003 13:15] MySQL Verification Team
Thank you for the bug report. I was able to repeat:

/sql/mysqld.cc
~4958

 if (!lower_case_table_names &&
      test_if_case_insensitive(mysql_real_data_home) == 1)
  {
    sql_print_error("Warning: Setting lower_case_table_names=1 becasue file system %s is case insensitve", mysql_real_data_home);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  }

CALL STACK:

 	ntdll.dll!77f69ecd() 	
 	ntdll.dll!77f5b2e6() 	
	mysqld.exe!fix_paths()  Line 4958 + 0xf	C++
 	mysqld.exe!get_options(int argc=0, char * * argv=0x013d6fd4)  Line 4857	C++
 	mysqld.exe!win_main(int argc=4, char * * argv=0x013d6fd0)  Line 2061 + 0xd	C++
 	mysqld.exe!mysql_service(void * p=0x00000000)  Line 2508 + 0x12	C++
 	mysqld.exe!main(int argc=3, char * * argv=0x013d2d90)  Line 2659 + 0x7	C++
 	mysqld.exe!mainCRTStartup()  Line 206 + 0x19	C
 	kernel32.dll!77e714c7()
[9 Jan 2004 5:44] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[11 Feb 2004 12:24] [ name withheld ]
I develop on Windows XP and deploy on Linux, so this fix was important to me.

I downloaded 4.1.1a-alpha-nt which no longer crashes when mysql starts up, but whatever I set lower_case_table_names to, the table names (and file names) on my Windows XP system are forced to lowercase.

With lower_case_table_names=2 in my.ini:

mysql> create table XyZ ( a int );
Query OK, 0 rows affected (0.06 sec)

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| xyz            |
+----------------+
1 row in set (0.00 sec)

Am I missing something somewhere?

Thanks in advance!
[11 Feb 2004 12:51] MySQL Verification Team
D:\start\4.1.1a>"d:\arquivos de programas\4.1.1a\bin\mysql" --defaults-file="d:\arquivos de programas\4.1.1a\my.cnf" -uroot

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.1-alpha-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test;
Database changed
mysql> show variables like "%lower%";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | OFF   |
+------------------------+-------+
1 row in set (0.00 sec)

mysql> create table ZZZzzzZZZ (id int);
Query OK, 0 rows affected (0.05 sec)

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| ZZZzzzZZZ      |
+----------------+
1 row in set (0.01 sec)
[13 Feb 2004 9:06] [ name withheld ]
Sorry folks, but I am not having any luck here:

C:\mysql\bin>type c:\windows\my.ini
[mysqld]
basedir=C:/mysql
datadir=D:/mysqldata

set-variable = lower_case_table_names=0

[WinMySQLadmin]
Server=C:/mysql/bin/mysqld-nt.exe
user=root
password=

C:\mysql\bin>mysql --defaults-file="c:\windows\my.ini"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.1a-alpha-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test
Database changed
mysql> show variables like "%lower%";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | ON    |
+------------------------+-------+
1 row in set (0.00 sec)

Then I stop mysql, remove the service, edit the my.ini file, install mysqld-nt, start the service:

C:\mysql\bin>net stop mysql
The MySQL service is stopping.
The MySQL service was stopped successfully.

C:\mysql\bin>mysqld-nt --remove
Service successfully removed.

C:\mysql\bin>notepad c:\windows\my.ini

C:\mysql\bin>type c:\windows\my.ini
[mysqld]
basedir=C:/mysql
datadir=D:/mysqldata

set-variable = lower_case_table_names=2

[WinMySQLadmin]
Server=C:/mysql/bin/mysqld-nt.exe
user=root
password=

C:\mysql\bin>mysqld-nt --install
Service successfully installed.

C:\mysql\bin>net start mysql
The MySQL service is starting.
The MySQL service was started successfully.

C:\mysql\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.1a-alpha-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test
Database changed
mysql> show variables like "%lower%";
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | ON    |
+------------------------+-------+
1 row in set (0.00 sec)

So the setting of lower_case_table_names in my.ini does not seem to make a difference.  I checked - there is no my.cnf file on the disk.
[17 Feb 2004 17:10] MySQL Verification Team
I did again the test and you are right, the message sends by the server
explains all:

C:\mysql\bin>type my.ini
[mysqld]
basedir=c:/mysql
datadir=c:/mysql/data
port=3306
skip-innodb
lower_case_table_names=0

C:\mysql\bin>mysqld-nt --defaults-file=c:\mysql\bin\my.ini --standalone --console
040217 22:04:59  Warning: Setting lower_case_table_names=1 becasue file system c:\mysql\data\ is
 case insensitive
mysqld-nt: ready for connections.
Version: '4.1.1a-alpha-nt'  socket: ''  port: 3306
[3 Mar 2004 3:44] Ben Sauer
Miguel,

Did you use a build or version 4.0.17?
[3 Mar 2004 5:57] MySQL Verification Team
Ben,

Sorry I didn't run a 4.0.17 server which it crashes. So you need
to use 4.0.18 but you will have the behavior I showed you for
the 4.1.1a.