Bug #51938 plugin_dir gets bad default value
Submitted: 11 Mar 2010 1:12 Modified: 11 Aug 2010 12:34
Reporter: Paul Dubois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.5.3+ OS:Any
Assigned to: Mats Kindahl CPU Architecture:Any

[11 Mar 2010 1:12] Paul Dubois
Description:
This is a new problem in the last day or two, I think.

The default value of plugin_dir is not being initialized properly; some variable substitution fails, apparently. Note the value of @PLUGINDIR@ below:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.3-m3-debug-log 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'plug%';
+---------------+------------------------------+
| Variable_name | Value                        |
+---------------+------------------------------+
| plugin_dir    | /opt/mysql/50503/@PLUGINDIR@ |
+---------------+------------------------------+
1 row in set (0.00 sec)

This results in a failure to be able to load plugins. Example:

mysql> install plugin null_audit soname 'adt_null.so';
ERROR 1126 (HY000): Can't open shared library '/opt/mysql/50503/@PLUGINDIR@/adt_null.so' (errno: 2 cannot open shared object file: No such file or directory)

Probable workaround: Set plugin_dir explicitly at server startup.

This affects the current mysql-trunk, mysql-next-mr, and mysql-6.0-codebase.

How to repeat:
See above.
[11 Mar 2010 6:24] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with mysql-next-mr:

$../client/mysql -uroot -S /tmp/mysql_ssmirnova.sock 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.99-m4-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'plug%';
+---------------+---------------------------------------------------------------+
| Variable_name | Value                                                         |
+---------------+---------------------------------------------------------------+
| plugin_dir    | /users/ssmirnova/blade12/build/mysql-next-mr/lib/mysql/plugin |
+---------------+---------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> \q
Bye

Please indicate how you build and start server.
[11 Mar 2010 20:34] Paul Dubois
I misdiagnosed the nature of the problem. It is not a problem with mysqld, it is a problem with mysqld_safe (which I use to start mysqld).  There is a reference to PLUGINDIR in mysqld_safe.sh:

plugin_dir="${PLUGIN_DIR:-@PLUGINDIR@}${PLUGIN_VARIANT}"

The build process fails to substitute @PLUGINDIR@ with a pathname, so mysqld_safe passes a literal @PLUGINDIR@ to mysqld.

This patch fixes the problem, although perhaps there is a more "correct" patch:

=== modified file 'scripts/Makefile.am'
--- scripts/Makefile.am 2010-03-01 09:39:44 +0000
+++ scripts/Makefile.am 2010-03-11 20:27:17 +0000
@@ -145,6 +145,7 @@ SUFFIXES = .sh
          -e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
          -e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
          -e 's!@''pkgplugindir''@!$(pkgplugindir)!g' \
+         -e 's!@''PLUGINDIR''@!$(pkgplugindir)!g' \
          -e 's!@''pkgsuppdir''@!$(pkgsuppdir)!g' \
          -e 's!@''sysconfdir''@!$(sysconfdir)!g' \
          -e 's!@''mandir''@!$(mandir)!g' \
[14 Mar 2010 20:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103166

3007 Mats Kindahl	2010-03-14
      Bug #51938  	plugin_dir gets bad default value
      
      When building the script directory using a CMake-based build, both the
      variables in config.h.cmake (including PLUGINDIR) and the variables in
      CMakeList.txt (which includes pkgplugindir).
      
      However, for autotools-based builds, only pkgplugindir is substituted,
      which means that the plugin-path is not substituted.
      
      This patch solves the problem by using pkgplugindir, which works on both
      CMake-based and autotools-based builds, instead of PLUGINDIR.
[15 Mar 2010 18:11] Joerg Bruehe
Approved,
and cherry-picked into the 5.5.3-m3 release build.

However, please push it into the trees, I will just use a "backport" comment.
[15 Mar 2010 18:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/103295

3123 Joerg Bruehe	2010-03-15
      Fix for bug#51938,
      extracted from a work-in-progress development branch
      just for the build of 5.5.3-m3.
[24 Mar 2010 8:15] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100324081249-yfwol7qtcek6dh7w) (version source revid:alik@sun.com-20100324081113-kc7x1iytnplww91u) (merge vers: 6.0.14-alpha) (pib:16)
[24 Mar 2010 8:16] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100324081056-6bndv6f0nrvbblhp) (version source revid:alik@sun.com-20100324081056-6bndv6f0nrvbblhp) (merge vers: 5.5.4-m3) (pib:16)
[24 Mar 2010 8:17] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100324081159-5b8juv8ldiqwce8v) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (pib:16)
[27 Apr 2010 9:46] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100427094135-5s49ecp3ckson6e2) (version source revid:alik@sun.com-20100427093843-uekr85qkd7orx12t) (merge vers: 6.0.14-alpha) (pib:16)
[27 Apr 2010 9:48] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100427093804-a2k3rrjpwu5jegu8) (version source revid:alik@sun.com-20100427093804-a2k3rrjpwu5jegu8) (merge vers: 5.5.5-m3) (pib:16)
[27 Apr 2010 9:51] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100427094036-38frbg3famdlvjup) (version source revid:alik@sun.com-20100427093825-92wc8b22d4yg34ju) (pib:16)
[11 Aug 2010 12:34] Paul Dubois
Noted in 5.5.3, 6.0.14 changelogs.

mysqld_safe did not pass the correct default value of plugin_dir to
mysqld.