Bug #49455 CR+LF at the end of binlog.index file on Windows
Submitted: 4 Dec 2009 10:58 Modified: 30 Jan 2013 16:12
Reporter: Andrii Nikitin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:*,5.0.83,5.1.41 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[4 Dec 2009 10:58] Andrii Nikitin
Description:
When manually editing binlog.index file on Windows, most editors will change "newline" symbol to CR+LF .
MySQL handles this situation OK unless CR+LF are last characters in file.

How to repeat:
1. Stop server with binary logging enabled
2. Open binlog.index file (specified by option bin-index) using Wordpad.exe 
3. Add empty line at the end and save.
4. (optional) make sure CR+LF appear at the end of file using some binary editor
5. start server -> error is shown:

C:\mysql\mysql-enterprise-gpl-5.0.83-winx64\bin>mysqld.exe --verbose --console
091204 11:31:18  InnoDB: Started; log sequence number 0 48871
' not found (Errcode: 22)-gpl-5.0.83-winx64\bin\mysqld.exe: File '.\mysql-bin.000017
', errno 22):18 [ERROR] Failed to open log (file '.\mysql-bin.000017
091204 11:31:18 [ERROR] Could not open log file
091204 11:31:18 [ERROR] Can't init tc log
091204 11:31:18 [ERROR] Aborting

Suggested fix:
trim CR at the end of filename
[4 Dec 2009 11:20] Andrii Nikitin
To work around this one should remove last empty line from binlog.index file
[30 Jan 2013 16:12] Jon Stephens
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 bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[30 Jan 2013 16:12] Jon Stephens
Fixed in 5.7. Documented in the 5.7.1 changelog as follows:

        When the binlog.index file ended with \r\n (CR+LF), MySQL wrongly
        included the \r character in the name of the file it tried to open,
        causing replication to fail. This caused problems with restarting the
        server after editing this file on Windows.

Closed.