Bug #63862 mysqld_safe improvements for 5.5 allways sets plugin_dir to default ignoring
Submitted: 28 Dec 2011 9:42 Modified: 27 Sep 2012 17:16
Reporter: Erkan Yanar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S2 (Serious)
Version:5.5.18, 5.5.20 OS:Any
Assigned to: CPU Architecture:Any

[28 Dec 2011 9:42] Erkan Yanar
Description:
In mysqld_safe you got code to set PLUGIN_DIR:

421 if [ -n "${PLUGIN_DIR}" ]; then
422   plugin_dir="${PLUGIN_DIR}"
423 else
424   # Try to find plugin dir relative to basedir
425   for dir in lib/mysql/plugin lib/plugin
426   do
427     if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
428       plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
429       break
430     fi
431   done
432   # Give up and use compiled-in default
433   if [ -z "${plugin_dir}" ]; then
434     plugin_dir='/usr/local/mysql/lib/plugin'
435   fi
436 fi
437 plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"

In fact parse_arguments() is the function to set PLUGIN_DIR.
But parse_arguments is called after setting plugin_dir:
#v+
488 parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
494 parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
495 parse_arguments PICK-ARGS-FROM-ARGV "$@"
#v-

So as the first code uses a variable (PLUGIN_DIR) going to be defined later. This leads to  plugin_dir='/usr/local/mysql/lib/plugin' 
So every setting of plugin_dir is going to be ignored anyway.

I don"t see any reason to parse for plugin_dir anyway.

How to repeat:

Set plugin_dir in my.cnf and have a look at the processlist afterwards or just read the code :)

Suggested fix:
Don't let mysqld_safe handle --plugin-dir or move the Code after parse_argumens() has called.
[28 Dec 2011 13:16] Valeriy Kravchuk
Thank you for the bug report.
[27 Sep 2012 17:16] Jon Stephens
Fixed in 5.5.29, 5.6.8, and trunk (currently 5.7.0).

Closed.