Bug #103397 More meaninful message for missing include directory
Submitted: 21 Apr 2021 10:07 Modified: 14 Jun 2021 17:28
Reporter: Georgi Sotirov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:8.0.24 OS:Linux
Assigned to: CPU Architecture:x86

[21 Apr 2021 10:07] Georgi Sotirov
Description:
In case a defaults file reefers to a directory to include additional option files from mysql client (and server) abort with and error. For example:

$ cat /etc/my.cnf | grep include
# include all files from the config directory
!includedir /etc/my.cnf.d
$ stat /etc/my.cnf.d
stat: cannot statx '/etc/my.cnf.d': No such file or directory
$ mysql --version
mysql: Can't read dir of '/etc/my.cnf.d' (OS errno 2 - No such file or directory)
mysql: [ERROR] Fatal error in defaults handling. Program aborted!

Considering that several configuration files are processed in a specific order (see [1]) it would be useful to have the path to the problematic options file in the error message, so one could easily and quickly understand the reason for the error.

[1] https://dev.mysql.com/doc/refman/8.0/en/option-files.html#option-file-order

How to repeat:
Create an option file (e.g. /etc/my.cnf) that includes a directory that does not exist.

Suggested fix:
The error message could be:

Can't read dir of '/etc/my.cnf.d' included from '/etc/my.cnf' (OS errno 2 - No such file or directory)

or

Fatal error in handling '/etc/my.cnf' defaults. Program aborted!

to point exactly to the problematic options file.
[21 Apr 2021 10:25] MySQL Verification Team
Hello Georgi Sotirov,

Thank you for the reasonable feature request!

Thanks,
Umesh
[14 Jun 2021 17:28] Paul DuBois
Posted by developer:
 
Fixed in 8.0.27.

Programs that encounter issues while processing include or includedir
directives in option files now produce error messages that are more
informative about the cause of the errors.