Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Won't Fix
-
5.5.32
-
None
-
None
-
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.