7a5573f
mysql_plugin.test fails when run in mysql-test RPM, though the build-time
7a5573f
regression test is OK.  This patch is from the pre-existing upstream bug
7a5573f
report, except we also fix the part that tries to scribble on the
7a5573f
read-only-to-us plugin directory.
7a5573f
7a5573f
rhbz #789530, upstream at http://bugs.mysql.com/bug.php?id=62907
7a5573f
7a5573f
6fadff0
diff -up mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt.p17 mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt
6fadff0
--- mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt.p17	2013-03-25 14:14:58.000000000 +0100
6fadff0
+++ mysql-5.5.31/mysql-test/t/mysql_plugin-master.opt	2013-04-19 13:38:23.761741532 +0200
7a5573f
@@ -1 +1 @@
7a5573f
---plugin-dir=$DAEMONEXAMPLE_DIR
7a5573f
+--plugin-dir=$MYSQLTEST_VARDIR/plugin
6fadff0
diff -up mysql-5.5.31/mysql-test/t/mysql_plugin.test.p17 mysql-5.5.31/mysql-test/t/mysql_plugin.test
6fadff0
--- mysql-5.5.31/mysql-test/t/mysql_plugin.test.p17	2013-03-25 14:14:58.000000000 +0100
6fadff0
+++ mysql-5.5.31/mysql-test/t/mysql_plugin.test	2013-04-19 13:38:25.606742145 +0200
7a5573f
@@ -25,8 +25,10 @@
7a5573f
 # Add the datadir, basedir, plugin_dir to the bootstrap command
7a5573f
 let $MYSQLD_DATADIR= `select @@datadir`;
7a5573f
 let $MYSQL_BASEDIR= `select @@basedir`;
7a5573f
+let $MYSQLD_TMP_BASEDIR= $MYSQLTEST_VARDIR/tmp;
7a5573f
 let $MYSQL_ERRMSG_BASEDIR=`select @@lc_messages_dir`;
7a5573f
 let $PLUGIN_DIR=`select @@plugin_dir`;
7a5573f
+let $PLUGIN_BASEDIR=$DAEMONEXAMPLE_DIR;
7a5573f
 
7a5573f
 --disable_abort_on_error
7a5573f
 
7a5573f
@@ -51,10 +53,11 @@ use File::Basename;
7a5573f
   {
7a5573f
     print FILE "let \$DAEMONEXAMPLE_DIR= $not_found;\n";
7a5573f
   }
7a5573f
-  if ((!-e $plugindir_ini) || (!-r $plugindir_ini))
7a5573f
-  {
7a5573f
-    print FILE "let \$PLUGIN_DIR= $not_found;\n";
7a5573f
-  }
7a5573f
+# This test doesn't work because $ENV{PLUGIN_DIR} is empty
7a5573f
+#  if ((!-e $plugindir_ini) || (!-r $plugindir_ini))
7a5573f
+#  {
7a5573f
+#    print FILE "let \$PLUGIN_DIR= $not_found;\n";
7a5573f
+#  }
7a5573f
   close FILE;
7a5573f
 EOF
7a5573f
 
7a5573f
@@ -66,10 +69,14 @@ remove_file $MYSQL_TMP_DIR/mysqld.inc;
7a5573f
 # mysql version, so errmsg.sys will be copied to "basedir/share", we create
7a5573f
 # and remove this structure. 
7a5573f
 
7a5573f
---mkdir $MYSQLD_BASEDIR/share
7a5573f
---mkdir $MYSQLD_BASEDIR/share/mysql
7a5573f
---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys
7a5573f
---copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/mysql/errmsg.sys
7a5573f
+--mkdir $MYSQLD_TMP_BASEDIR/share
e80059e
+--mkdir $MYSQLD_TMP_BASEDIR/share/community-mysql
7a5573f
+--mkdir $PLUGIN_DIR
7a5573f
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_TMP_BASEDIR/share/errmsg.sys
e80059e
+--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_TMP_BASEDIR/share/community-mysql/errmsg.sys
7a5573f
+--copy_file $PLUGIN_BASEDIR/libdaemon_example.so $PLUGIN_DIR/libdaemon_example.so
7a5573f
+--copy_file $PLUGIN_BASEDIR/daemon_example.ini $PLUGIN_DIR/daemon_example.ini
7a5573f
+
7a5573f
 
7a5573f
 # The mysql_plugin tool now accepts --my-print-defaults which points to the
7a5573f
 # executable my_print_defaults.exe we can get this path from the variable
7a5573f
@@ -100,7 +107,7 @@ if ($PLUGIN_DIR == '')
7a5573f
 
7a5573f
 # Build client command for reuse.
7a5573f
 
7a5573f
-let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
7a5573f
+let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD_TMP_BASEDIR --plugin-dir=$PLUGIN_DIR --mysqld=$MYSQLD_BASEDIR --my-print-defaults=$MYSQL_MY_PRINT_DEFAULTS_BASEDIR;
7a5573f
 
7a5573f
 --echo #
7a5573f
 --echo # Ensure the plugin isn't loaded.
6fadff0
@@ -184,7 +191,7 @@ SELECT * FROM mysql.plugin WHERE dl like
7a5573f
 # we must copy the example daemon to a new location renaming it.
7a5573f
 
7a5573f
 let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
7a5573f
---copy_file $PLUGIN_DIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
7a5573f
+--copy_file $PLUGIN_BASEDIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
7a5573f
 --copy_file include/libdaemon_example.ini $PLUGIN_DIR/libdaemon_example.ini
7a5573f
 
7a5573f
 # Now reload it and see that it is a different name.
6fadff0
@@ -361,8 +368,11 @@ replace_result $MYSQL_PLUGIN mysql_plugi
6fadff0
 --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
7a5573f
 
7a5573f
 # Cleanup the share folder in the binary path.
7a5573f
---remove_file $MYSQLD_BASEDIR/share/errmsg.sys
7a5573f
---rmdir $MYSQLD_BASEDIR/share/mysql
7a5573f
---rmdir $MYSQLD_BASEDIR/share
7a5573f
+--remove_file $PLUGIN_DIR/daemon_example.ini
7a5573f
+--remove_file $PLUGIN_DIR/libdaemon_example.so
7a5573f
+--rmdir $PLUGIN_DIR
e80059e
+--remove_file $MYSQLD_TMP_BASEDIR/community-share/errmsg.sys
e80059e
+--rmdir $MYSQLD_TMP_BASEDIR/community-share/mysql
e80059e
+--rmdir $MYSQLD_TMP_BASEDIR/community-share
7a5573f
 
7a5573f
 --enable_abort_on_error