Bug #13774 mysqld_safe doesn't pick up MAX version based on value of --ledir argument
Submitted: 5 Oct 2005 14:11 Modified: 1 Nov 2005 20:33
Reporter: Sharif Alexandre Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Linux (Linux (RHEL 3 U1))
Assigned to: Jim Winstead CPU Architecture:Any

[5 Oct 2005 14:11] Sharif Alexandre
Description:
When passing --ledir param to mysqld_safe, the script doesn't correctly choose the MAX version of the binary by default since the logic to determine which binary to choose is placed before the script args are parsed.  

How to repeat:
Place binaries in a non-standard directory then pass --ledir to mysqld_safe pointing to that directory.

Suggested fix:
Move the portion of code that determines which binary to use _after_ the script arguments are parsed.

...

parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/tmp/mysql.sock}}

...

# Use the mysqld-max binary by default if the user doesn't specify a binary
if test -x $ledir/mysqld-max
then
  MYSQLD=mysqld-max
else
  MYSQLD=mysqld
fi
[7 Oct 2005 10:40] Valeriy Kravchuk
Thank you for a bug report. Although simple analysys of mysqld_safe script will prove your findings, one may try to perform the following:

cd mysql  # to the base directory, specified by --prefix
[openxs@Fedora 5.0]$ cp libexec/mysqld /tmp/mysqld-max
[openxs@Fedora 5.0]$ bin/mysqld_safe --ledir=/tmp &
[1] 12024
[openxs@Fedora 5.0]$ The file /tmp/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/mysqld_safe.
See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more
information

[1]+  Exit 1                  bin/mysqld_safe --ledir=/tmp
[openxs@Fedora 5.0]$ ls /tmp/
am4tez3351  mapping-openxs  mc-openxs   mysqlmanager.sock  orbit-openxs
ccA5ZzZ6.s  mapping-root    mysqld-max  mysql.sock         orbit-root
[openxs@Fedora 5.0]$ ls -l /tmp/mysql*
-rwxr-xr-x    1 openxs   openxs    4820113 Р?РєС'  7 13:31 /tmp/mysqld-max
srwxrwxrwx    1 openxs   openxs          0 Р?РєС'  7 11:49 /tmp/mysqlmanager.sock
srwxrwxrwx    1 openxs   openxs          0 Р?РєС'  7 11:49 /tmp/mysql.sock

So, there is (fictious, but it does not matter!) mysqld-max file in the --ledir specified, and it is not picked by default.
[13 Oct 2005 21:11] 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/internals/31072
[31 Oct 2005 19:14] 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/internals/31698
[1 Nov 2005 20:16] Jim Winstead
Fixed in 4.1.16 and 5.0.16.
[1 Nov 2005 20:33] Paul DuBois
Noted in 4.1.16, 5.0.16 changelogs.