Bug #91512 "include" directive in Option Files does't work as document
Submitted: 2 Jul 2018 4:13 Modified: 2 Jul 2018 10:52
Reporter: Hongchao Jia Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.6 OS:CentOS (7.4)
Assigned to: CPU Architecture:Any

[2 Jul 2018 4:13] Hongchao Jia
Description:
According to https://dev.mysql.com/doc/refman/5.6/en/option-files.html,
"If an option file contains !include or !includedir directives, files named by those directives are processed whenever the option file is processed, no matter where they appear in the file."
However I found it matters that where they appear.

How to repeat:
1 a.cnf 
[bar]
name=a
!include /root/mysql/b.cnf

2 b.cnf 
[bar]
name=b

3 my_print_defaults --defaults-file=a.cnf bar
got
--name=a
--name=b

4 change a.cnf file
[bar]
!include /root/mysql/b.cnf
name=a

5 my_print_defaults --defaults-file=a.cnf bar
got
--name=b
--name=a

Suggested fix:
fix document about "no matter where they appear in the file" part
[2 Jul 2018 9:46] MySQL Verification Team
Hello Hongchao,

Thank you for the report.
I'm sorry but could you please explain/elaborate a bit on why do you think that this is a bug? Moreover, your pointed statement from manual don't claim anything about ordering. Also, lines from the !include are appearing where you exactly used. Thank you!

Regards,
Umesh
[2 Jul 2018 10:31] Hongchao Jia
Document says that "(!include directives)......no matter where they appear in the file", so I think

name=a
!include /root/mysql/b.cnf

and

!include /root/mysql/b.cnf
name=a

should produce the same result.
[2 Jul 2018 10:52] Hongchao Jia
The document may be a little confusing to me.

"If an option file contains !include or !includedir directives, files named by those directives are processed whenever the option file is processed, no matter where they appear in the file."

I thought it as "since a.cnf include b.cnf, b.cnf is processed (immediately) when a.cnf is open(instead of reaching that line), the position of include directive does not matter"