[CONC-327] !include/!includedir not parsed in my.cnf Created: 2018-04-26  Updated: 2019-06-01  Resolved: 2018-05-02

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.4
Fix Version/s: 3.0.5

Type: Bug Priority: Critical
Reporter: Klaus Keppler Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: include, includedir, my.cnf

Issue Links:
Relates
relates to CONC-396 !includedir in my.cnf does not includ... Open
relates to CONC-402 Replace underscores with dashes in co... Closed
relates to CONC-404 Add option that corresponds to --defa... Open
relates to CONC-394 Some TLS-related options are not sett... Closed
relates to CONC-395 Dashes and underscores are not interc... Closed
relates to CONC-399 Add option that corresponds to --defa... Open
relates to CONC-415 Option prefixes not supported in my.cnf Open
relates to CONC-416 On Windows, C/C looks for first my.cn... Closed
relates to ODBC-229 Add parameters that correspond to MYS... Closed

 Description   

The current code in ma_default.c does not care for include keywords (!include, !includedir) in my.cnf.
The whole parse code looks completely different to the my.cnf parser of the MariaDB Server (mysys/my_default.c)

The API documentation of mysql_optionsv(... MYSQL_READ_DEFAULT_FILE ...) links to the my.cnf documentation, which says nothing about {{!include}}s only being parseable by the MariaDB server.

The default location of the MariaDB socket is /tmp/mysql.sock, but many distributions use different locations (eg. CentOS 7: /var/lib/mysql/mysql.sock). This differing location can be specified eg. in /etc/my.cnf.d/client.cnf:

#
# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#
 
[client]
socket=/var/lib/mysql/mysql.sock
 
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

While above configuration snippet works fine with MySQL Connector/C, the MariaDB Connector/C silently ignores the !includedir keyword. Thus, the socket= directive is not read, and the client looks for the socket at the wrong location.

A simple local workaround is to hard-code the "correct" location of the MariaDB socket into the application, or ask the user to configure it directly in /etc/my.cnf. But this is neither clean nor portable.

I don't know what's easier: importing the my.cnf config parser from MariaDB into Connector/C, or to implement the "include" functionality independently. However, it should be better to maintain if there's only one code base for parsing my.cnf files.



 Comments   
Comment by Georg Richter [ 2018-04-28 ]

Using the same code base is not an option. MariaDB Connector/C is licensed under LGPL while MariaDB Server is licensed under GPL.

Comment by Klaus Keppler [ 2018-05-02 ]

Thank you for the quick fix - that's great!

Generated at Thu Feb 08 03:04:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.