[MDEV-21818] MariaDB clients do not print default plugin-dir value when run with --help option Created: 2020-02-25  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Authentication and Privilege System, Scripts & Clients
Affects Version/s: 10.4.12
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Rob Schwyzer Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: MariaDB-client, plugin-dir, plugin_dir
Environment:

CentOS Linux release 7.7.1908 (Core)



 Description   

echo -e 'OS@'$(cat /etc/redhat-release)'\nMariaDB Version@'$(mysql -V)'\nDefault plugin-dir@'$(mysql --help | grep -Pi '^plugin\-dir' | perl -pe 's/[\s]+\(/@(/g' | cut -d '@' -f 2)'\nManual plugin-dir@'$(mysql --plugin-dir=/usr/lib64/mysql/plugin/ --help | grep -Pi '^plugin\-dir' | perl -pe 's/[\s]+/@/g' | cut -d '@' -f 2) | column -s '@' -t
OS                  CentOS Linux release 7.7.1908 (Core)
MariaDB Version     mysql Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
Default plugin-dir  (No default value)
Manual plugin-dir   /usr/lib64/mysql/plugin/

As per MDEV-19807, this should be defaulting to the plugin directory installed by the RPM by default. Therefore, the behavior of plugin-dir not having an assigned value unless it is configured manually (ala via mysql --plugin-dir=) seems incorrect and may need to be addressed.

If a default value is set though, then mysql --help is outputting incorrect information as a path is set but (No default value) is being output.

The use-case I investigated this for involved installing MariaDB-client on a Linux VM without installing MariaDB-server or anything else, simulating the experience of a client connecting to a remote MariaDB server. Here is some additional context on the RPMs I had installed-

yum list installed | grep -i MariaDB
MariaDB-client.x86_64                   10.4.12-1.el7.centos       @mariadb-main
MariaDB-common.x86_64                   10.4.12-1.el7.centos       @mariadb-main
MariaDB-compat.x86_64                   10.4.12-1.el7.centos       @mariadb-main



 Comments   
Comment by Geoff Montee (Inactive) [ 2020-02-25 ]

The path to the plugin directory is determined by the MariaDB Connector/C library used by MariaDB's clients. We can see how it resolves the path here:

  /* Compile dll path */
  snprintf(dlpath, sizeof(dlpath) - 1, "%s/%s%s",
           mysql->options.extension && mysql->options.extension->plugin_dir ?
           mysql->options.extension->plugin_dir : (env_plugin_dir) ? env_plugin_dir :
           MARIADB_PLUGINDIR, name, SO_EXT);

https://github.com/mariadb-corporation/mariadb-connector-c/blob/v3.1.7/libmariadb/ma_client_plugin.c.in#L384

So it checks the following items in the following order:

  • If the --plugin-dir option is set, then it checks the path defined by that option.
  • If the --plugin-dir option isn't set, then it checks the path defined by the MARIADB_PLUGIN_DIR environment variable.
  • If the --plugin-dir option isn't set and if the MARIADB_PLUGIN_DIR environment variable isn't set, then it checks the path defined by a constant called MARIADB_PLUGINDIR.

This MARIADB_PLUGINDIR constant is defined here:

#define MARIADB_PLUGINDIR "@CMAKE_INSTALL_PREFIX@/@INSTALL_PLUGINDIR@"

https://github.com/mariadb-corporation/mariadb-connector-c/blob/v3.1.7/include/mariadb_version.h.in#L27

So maybe the clients included with the server should also print this same constant as the default value when the --help option is used.

Generated at Thu Feb 08 09:10:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.