Bug #86870 Possible unintended macro usage in "binlog.cc" line 6618
Submitted: 29 Jun 2017 11:12 Modified: 30 Oct 2017 15:03
Reporter: Petru-Florin Mihancea Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[29 Jun 2017 11:12] Petru-Florin Mihancea
Description:
While experimenting with a CodeSonar plugin we develop, we noticed a potential issue in file "mysql/mysql-server/sql/binlog.cc" line 6618 function  MYSQL_BIN_LOG::new_file_impl.

/*6618*/ my_printf_error(ER_ERROR_ON_WRITE, ER(ER_CANT_OPEN_FILE),
                      MYF(ME_FATALERROR), name,
                      errno, my_strerror(errbuf, sizeof(errbuf), errno));
goto end;

You should probably have ER(ER_ERROR_ON_WRITE) instead of ER(ER_CANT_OPEN_FILE).

Thanks,
Petru Florin Mihancea

How to repeat:
The issue has been detected automatically via static analysis.
[29 Jun 2017 12:35] MySQL Verification Team
Hello Petru,

Thank you for the report and feedback.
Verifying based on my internal discussion with Dev.

Thanks,
Umesh
[30 Oct 2017 15:03] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.4:

The binary log function MYSQL_BIN_LOG::new_file_impl returned the error "Can't open file" (ER_CANT_OPEN_FILE) when it should have returned "Error writing file" (ER_ERROR_ON_WRITE).