Bug #20263 mysql.cnf line break incompatibility
Submitted: 5 Jun 2006 2:35 Modified: 3 Jan 2008 20:35
Reporter: Marcus Bointon Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.0.22 OS:Any
Assigned to: CPU Architecture:Any

[5 Jun 2006 2:35] Marcus Bointon
Description:
A my.cnf file will not work if it uses MacOS line breaks. On platforms other than OS X I would not consider this a problem, but it should be a trivial fix to make it work in all formats everywhere, so here's the report!

How to repeat:
Change the line break format of a my.cnf file to MacOS.
Restart MySQL.
Notice that my.cnf values have not been read.
[6 Jun 2006 15:30] Mark Leith
Hi,

Could you tell me how you are creating the my.cnf file please?

Perhaps upload a copy of yours which is causing the failure?

Thanks

Mark
[6 Jun 2006 16:18] Marcus Bointon
Here's a my.cnf

[mysqld]
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old-passwords=1
max-connections=150
default-character-set=latin1
default-collation=latin1_bin
long-query-time=2
log-slow-queries=slow_queries2.log
#log-warnings
#log
log-bin
log-error
query_cache_size = 2000000
query_cache_type = 2 #on-demand caching only

I found that 'mysqld --print-defaults' also illustrates the bug, so that's an easier way of testing it. If I paste the above into BBEdit and save with Mac line breaks, I get an empty response from that command. If I switch line break formats to unix and re-save, it works properly - simply and easily reproducible.
[6 Jun 2006 18:43] Mark Leith
Hi,

Unfortunately I sitll can't reproduce this:

[markleith@medusa:~/mysql] $ sudo mysqld_safe --defaults-extra-file=/Users/markleith/mysql/my-osx-line-endings.cnf --user=mysql &
[4] 794
[3]   Done                    sudo mysqld_safe --defaults-extra-file=/Users/markleith/mysql/my-force-osx.cnf --user=mysql
[markleith@medusa:~/mysql] $ Starting mysqld daemon with databases from /usr/local/mysql/data

[markleith@medusa:~/mysql] $ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22-max-log

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

mysql> exit
Bye
[markleith@medusa:~/mysql] $ mysqladmin -u root shutdown
[markleith@medusa:~/mysql] $ STOPPING server from pid file /usr/local/mysql/data/medusa.pid
060606 19:41:32  mysqld ended

[5]-  Done                    sudo mysqld_safe --defaults-extra-file=/Users/markleith/mysql/my-osx-line-endings.cnf --user=mysql
[markleith@medusa:~/mysql] $ sudo mysqld --defaults-extra-file=/Users/markleith/mysql/my-osx-line-endings.cnf --user=mysql &
[2] 861
[markleith@medusa:~/mysql] $ 060606 19:41:49 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-max-5.0.22-osx10.4-i686/data/ is case insensitive

[markleith@medusa:~/mysql] $ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22-max-log

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

mysql> exit
Bye
[markleith@medusa:~/mysql] $ uname -a
Darwin medusa 8.6.1 Darwin Kernel Version 8.6.1: Tue Mar  7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386 i386 i386

I have even downloaded BBEdit, and set the preferences specifically for Mac OSX line endings in the preferences there, to no avail. 

Do you by chance have another OSX system to test this on?

I will see if I can get another colleage to try and verify this as well.

Best regards

Mark
[7 Jun 2006 10:41] Marcus Bointon
I've reproduced this on another Mac (PPC this time), and just for good measure, also in RedHat Linux on a PC. I think you might be doing it wrong in BBEdit. If you change the line break setting in prefs, it only sets the defaults, and doesn't necessarily alter existing/open files. When you have a doc open in BBEdit there is a small document menu in the toolbar. In there you will find the setting for the current document. If you change that and save it, it will set the break type explicitly.
[7 Jun 2006 12:45] Mark Leith
Actually the output that I pasted was from a new my.cnf file that I had created, after setting the default option in preferences (I pretty much assumed that it would not apply to a current document).

However, I have tried to create a new file given the directions you gave (using the file button), and still get the same results:

medusa:/Users/markleith/mysql root# /usr/local/mysql/bin/mysqld --defaults-extra-file=/Users/markleith/mysql/my-osx-endings-new.cnf --user=mysql &
[1] 1723
medusa:/Users/markleith/mysql root# 060607 13:35:39 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-max-5.0.22-osx10.4-i686/data/ is case insensitive

medusa:/Users/markleith/mysql root# /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22-max-log

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

mysql> 

The my.cnf file was:

[mysqld]
log_slow_queries
long_query_time=9

As you have verified this on two systems however I'm going to see if another person with an intel mac can try and verify this (yes, perhaps I am doing something wrong).

Regards

Mark
[7 Jun 2006 12:57] Marcus Bointon
It looks like you're loading the my.cnf as an additional file - will it not therefore show your actual defaults (in your normal /etc/my.cnf) and not just those defined in that file? Can you try making it the only my.cnf and just try 'mysqld --print-defaults'?
[12 Jun 2006 12:58] Mark Leith
Verifying after further testing and chatting with colleague
[3 Jan 2008 20:35] Marcus Bointon
As per my earlier reports - though this was originally spotted on OS X, and is most likely to be seen on there (other OSs are very unlikely to create files with Mac-style line breaks), the bug itself seems to affect all tested operating systems equally.