Bug #39326 mysqld_safe doesn't use --basedir value in search of my_print_defaults
Submitted: 8 Sep 2008 18:53 Modified: 4 Sep 2009 1:21
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:all OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: basedir, my_print_defaults, mysqld_safe

[8 Sep 2008 18:53] Matthew Lord
Description:
mysqld_safe does not look for my_print_defaults in the directory specified on
the command line with --basedir:

# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
# and then merge with the command line arguments
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_print_defaults"
elif test -x /usr/local/mysql/bin/my_print_defaults
then
print_defaults="/usr/local/mysql/bin/my_print_defaults"
elif test -x /usr/local/mysql/bin/mysql_print_defaults
then
print_defaults="/usr/local/mysql/bin/mysql_print_defaults"
else
print_defaults="my_print_defaults"
fi

Now this doesn't affect most people as they happen to have it in
the default location or it's in their PATH.  We should, however,
look for it in baedir/bin if --basedir was specified.

How to repeat:
N/A

Suggested fix:
diff -u bin/mysqld_safe.orig bin/mysqld_safe
--- bin/mysqld_safe.orig	2008-09-08 14:43:58.000000000 -0400
+++ bin/mysqld_safe	2008-09-08 14:52:37.000000000 -0400
@@ -113,7 +113,10 @@
 
 MY_PWD=`pwd`
 # Check for the directories we would expect from a binary release install
-if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
+if test -d $MY_BASEDIR_VERSION/bin && "$MY_BASEDIR_VERSION" != ""
+then
+  ledir=$MY_BASEDIR_VERSION/bin		# Where mysqld is
+elif test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld
 then
   MY_BASEDIR_VERSION=$MY_PWD		# Where bin, share and data are
   ledir=$MY_BASEDIR_VERSION/bin		# Where mysqld is
@@ -181,7 +184,10 @@
 
 # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
 # and then merge with the command line arguments
-if test -x ./bin/my_print_defaults
+if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
+then
+  print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
+elif test -x ./bin/my_print_defaults
 then
   print_defaults="./bin/my_print_defaults"
 elif test -x /usr/local/mysql/bin/my_print_defaults
[8 Sep 2008 19:12] Jim Winstead
mysqld_safe is part of the server, not a command-line tool.
[16 Mar 2009 18:57] 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/69342

2839 Chad MILLER	2009-03-16
      Bug#39326: mysqld_safe doesn't use --basedir value in search of \
      	my_print_defaults
      
      Now use basedir to set an unset ledir and to find the location of
      my_print_defaults .
[18 Mar 2009 22:36] Chad MILLER
Queued to 6.0- and 5.1-bugteam trees.
[27 Mar 2009 14:56] Bugs System
Pushed into 5.1.34 (revid:joro@sun.com-20090327143448-wuuuycetc562ty6o) (version source revid:leonard@mysql.com-20090316090622-sr8lylqvsl1jrcnv) (merge vers: 5.1.34) (pib:6)
[27 Mar 2009 23:20] Paul DuBois
Noted in 5.1.34 changelog.

If --basedir was specified, mysqld_safe did not use it when
attempting to locate my_print_defaults. 

Setting report to NDI pending push into 6.0.x (and possibly 5.0.x?).
[13 Apr 2009 9:20] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090413084402-snnrocwzktcl88ny) (version source revid:chad@mysql.com-20090318215944-c523ue4h6jl8r670) (merge vers: 6.0.11-alpha) (pib:6)
[13 Apr 2009 19:20] Paul DuBois
Noted in 6.0.11 changelog.
[13 Apr 2009 20:25] 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/71960

2724 Chad MILLER	2009-04-13
      Backport of fix for Bug#39326 to 5.0, at MLord's behest.
[9 May 2009 16:46] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (merge vers: 5.1.34-ndb-6.2.18) (pib:6)
[9 May 2009 17:42] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (merge vers: 5.1.34-ndb-6.3.25) (pib:6)
[9 May 2009 18:40] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (merge vers: 5.1.34-ndb-7.0.6) (pib:6)
[19 Aug 2009 8:00] 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/81040

2790 Georgi Kodinov	2009-08-19
      backport of Chad's fix for bug #39326 to 5.0-bugteam
[19 Aug 2009 15:18] 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/81088

3072 Georgi Kodinov	2009-08-19 [merge]
      null merge of the backport of Chad's fix for bug #39326 to 5.1-bugteam
[2 Sep 2009 10:25] Bugs System
Pushed into 5.0.86 (revid:joro@sun.com-20090902102337-n5rw8227wwp5cpx8) (version source revid:joro@sun.com-20090819075917-gvqxeorbjj29kxm1) (merge vers: 5.0.86) (pib:11)
[2 Sep 2009 16:41] Bugs System
Pushed into 5.1.39 (revid:joro@sun.com-20090902154533-8actmfcsjfqovgsb) (version source revid:joro@sun.com-20090819151630-m98gps8vj33rmnjs) (merge vers: 5.1.39) (pib:11)
[4 Sep 2009 1:21] Paul DuBois
Noted in 5.0.86 changelog.
[14 Sep 2009 16:05] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)