Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 5.5.32
-
Fix Version/s: 5.5.34
-
Component/s: None
-
Labels:None
-
Environment:Linux, RPM
Description
As mentioned in https://kb.askmonty.org/en/mysqld-startup-options/:
Default options are read from the following files in the given order:
- /etc/my.cnf
- /etc/mysql/my.cnf
- user-home-dir/.my.cnf
But when defining -DINSTALL_LAYOUT=RPM in cmake call we end up with the following output of mysqld:
$ /usr/libexec/mysqld --help --verbose 2>/dev/null|grep --after=1 '^Default options'|tail -n 1
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
... which is wrong.
What is happening... "RPM" layout defines DEFAULT_SYSCONFDIR macro to "/etc" and if this macro is defined, it is added to the set of directories where config files are searched in (by default only /etc, /etc/mysql and ~ are used).
The problem is in the function which appends directory to the set of directories (actually a list). If the new directory is already in the set, it will be added to the end all the time, while the following items are shifted 1 position to the beginning. It means that when calling
add_directory(alloc, DEFAULT_SYSCONFDIR, dirs)
(remember, DEFAULT_SYSCONFDIR is set to "/etc") while dirs contains "/etc" "/etc/mysql", it results in "/etc/mysql" "/etc".
The result is obvious – we get wrong order of configuration files. A proposed patch is attached, but it will change behaviour on systems where -DINSTALL_LAYOUT=RPM was used during compilation.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
I tried to fix it, but after some discussion we agreed that changing the order of configuration files is too dangerous — it might introduce subtle bugs after an upgrade for anyone who relies on the current behavior.
Instead, I've edited the manual to specify more clearly what files are read and from where. Besides, the manual was already saying (even before my changes) that one should use "mysqld --help --verbose" to get the exact my.cnf search path on his system.