Bug #53620 Configuration editor handles newlines wrong and breaks my.ini
Submitted: 13 May 2010 15:18 Modified: 20 May 2010 10:25
Reporter: charl retief Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S2 (Serious)
Version:5.2.21 OSS RC OS:Windows (WinXP)
Assigned to: Maksym Yehorov CPU Architecture:Any
Tags: my.ini newline

[13 May 2010 15:18] charl retief
Description:
The Workbench Server Administration tool destroys the my.ini file when applying changes.

When I change values under 'Configuration' -> 'General' and then click 'Apply...' at the bottom of the screen the list of changes is displayed all ending with a square.

If you use a ini file that does not end with a newline [see repeat instructions below] the actual file gets damaged after applying the changes.

How to repeat:
Step 1: Change your my.ini file to this basic one to clearly see the problem. NB: copy exactly the part between the pipes | | and do not add a newline at the bottom of the file.

|[wampmysqld]
port		= 3306
socket		= /tmp/mysql.sock
basedir		= c:/wamp/bin/mysql/mysql5.1.33
datadir		= c:/wamp/bin/mysql/mysql5.1.33/data|

Step 2: Change [wampmysqld] to your instance name and set basedir and datadir correctly for your installation.

Step 3: Restart your MySQL server to load the my.ini file

Step 4: Open the workbench 'Server Administration' for your server

Step 5: Go to 'Configuration' -> 'General'

Step 6: Check any new settings (example: 'Disable networking' and 'console')

Step 7: Click "Apply...' in the bottom right corner

Step 8: Observe the strange 'newline' square character after each new conf item

Step 9: Preview of the file will now look like this:

|[wampmysqld]
port		= 3306
socket		= /tmp/mysql.sock
basedir		= c:/wamp/bin/mysql/mysql5.1.33
datadir		= c:/wamp/bin/mysql/mysql5.1.33/dataconsole
skip-networking
|

Notice how 'console' is now part of 'datadir'. If you 'Apply' again this is exactly how the file is saved. 

MySQL won't restart with this newly created my.ini file.

Suggested fix:
I think this problem might be related to how newlines in text files are handled by different OS and text editors '\n' for UNIX and '\r\n' for windows.

Certain windows text editors use '\n' and others use '\r\n'.
[13 May 2010 15:47] Valeriy Kravchuk
Thank you for the problem report. Please, check with a newer version, 5.2.21, and inform about the results.
[14 May 2010 11:59] charl retief
This still happens in 5.2.21 OSS RC
[14 May 2010 12:36] Susanne Ebrecht
Verified as described by source code analysis.

The changes don't start with new line (\n or \r\n).
[16 May 2010 10:51] Maksym Yehorov
Fixed.
[18 May 2010 17:48] Johannes Taxacher
fix confirmed in repository
[20 May 2010 10:25] Tony Bedford
An entry has been added to the 5.2.22 changelog:

The MySQL configuration file was corrupted by the Administrator when changes were applied, if the configuration file was not terminated with a new line.