Bug #67903 Error return without giving a log message
Submitted: 14 Dec 2012 2:48 Modified: 14 Dec 2012 16:51
Reporter: Tianyin Xu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:mysql-5.5.28 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Needs Triage: D3 (Medium)

[14 Dec 2012 2:48] Tianyin Xu
Description:
===================The Story===================

Different from other key-value configuration options in the option file (i.e., my.cnf), "!include" and "!includedir" do not use the separator "=". It's quite confusing (at least to me). The worst thing is when having the following invalid configuration entry:

!include  = /etc/mysql/my.cnf.ext

The system just keeps silent when it met a read error. In my case, I changed the extended file a lot of times to let my setting take effect. But the problem is simply because mysqld fails to read the file "= /etc/mysql/my.cnf.ext" and fails silently.

Without a GDB tracing, it's impossible to know the root cause. 

So I suggest to add a logging statement after the read error. It's always a good practice to do so. And the logging is at the startup time, which won't cause much performance overhead.

Thanks a lot!
Tianyin

How to repeat:
Leave the following configuration in your my.cnf:

#/etc/mysql/my.cnf
[mysqld]
!include  = /etc/mysql/my.cnf.ext
basedir   = /home/tianyin/mysql-5.5.28/usr/local/mysql
datadir   = /home/tianyin/mysql-5.5.28/usr/local/mysql/data
...

Suggested fix:
--- ../mysql-5.5.28_org/mysql-5.5.28/mysys/default.c    2012-08-29 01:50:46.000000000 -0700
+++ mysys/default.c     2012-12-13 16:12:27.891494083 -0800
@@ -784,8 +784,11 @@
 #if !defined(__WIN__)
   {   
     MY_STAT stat_info;
-    if (!my_stat(name,&stat_info,MYF(0)))
+    if (!my_stat(name,&stat_info,MYF(0))) {
+      fprintf(stderr, "Info: '%s' is ignored because it is not accessible\n",
+             name);
       return 1;
+    }
     /*  
       Ignore world-writable regular files.
       This is mainly done to protect us to not read a file created by
[14 Dec 2012 16:51] Sveta Smirnova
Thank you for the report.

Verified as described.