Bug #32679 mysqld_safe looks for errmsg.sys in wrong path
Submitted: 23 Nov 2007 19:53 Modified: 25 Feb 2008 19:35
Reporter: Matthew Montgomery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:6.0.3 OS:Linux
Assigned to: Timothy Smith CPU Architecture:Any
Triage: D2 (Serious)

[23 Nov 2007 19:53] Matthew Montgomery
Description:
Line 207 of mysqld_safe reads:

if test -f ./share/mysql/english/errmsg.sys -a -x ./bin/mysqld

Should look for errmsg.sys in ./share/english/errmsg.sys for 6.0.3.

matt@host:/data/sandbox/mysql/6.0.3alpha$ ls ./share/mysql/*
ls: ./share/mysql/*: No such file or directory

How to repeat:
.

Suggested fix:
.
[29 Nov 2007 12:07] Daniel Fischer
Bug#32163 has been marked as a duplicate of this bug.
[1 Dec 2007 0:24] Timothy Smith
I'm pretty sure that something like this diff will work (untested):

===== scripts/make_binary_distribution.sh 1.162 vs edited =====
--- 1.162/scripts/make_binary_distribution.sh   2007-10-01 10:40:40 -06:00
+++ edited/scripts/make_binary_distribution.sh  2007-11-30 17:14:23 -07:00
@@ -23,7 +23,8 @@
 #  Note that the structure created by this script is slightly different from
 #  what a normal "make install" would produce. No extra "mysql" sub directory
 #  will be created, i.e. no "$prefix/include/mysql", "$prefix/lib/mysql" or
-#  "$prefix/share/mysql".
+#  "$prefix/share/mysql".  This is because the build system explicitly calls
+#  make with pkgdatadir=<datadir>, etc.
 #
 #  In GNU make/automake terms
 #
===== scripts/mysqld_safe.sh 1.95 vs edited =====
--- 1.95/scripts/mysqld_safe.sh 2007-10-10 14:15:05 -06:00
+++ edited/scripts/mysqld_safe.sh       2007-11-30 17:21:10 -07:00
@@ -202,14 +202,16 @@ parse_arguments() {
 # First, try to find BASEDIR and ledir (where mysqld is)
 # 
 
+relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
+
 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 -f "$relpkgdata"/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
 # Check for the directories we would expect from a source install
-elif test -f ./share/mysql/english/errmsg.sys -a -x ./libexec/mysqld
+elif test -f "$replpkgdata"/english/errmsg.sys -a -x ./libexec/mysqld
 then
   MY_BASEDIR_VERSION=$MY_PWD           # Where libexec, share and var are
   ledir=$MY_BASEDIR_VERSION/libexec    # Where mysqld is
[3 Dec 2007 22:48] 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/39155

ChangeSet@1.2624, 2007-12-03 15:48:27-07:00, tsmith@ramayana.hindu.god +2 -0
  Bug #32679: mysqld_safe looks for errmsg.sys in wrong path
  
  The fix for bug 28544 moved our package data from ./share/mysql
  to ./share.  mysqld_safe had the old directory hard-coded.  The
  fix is to use the @pkgdatadir@ and @prefix@ values, to adapt to
  different ways of building the package.
[5 Dec 2007 2:07] Timothy Smith
Queued to 5.1- and 6.0-build team trees.

Also pushed directly into 6.0.4-alpha release tree.

This was not fixed in 5.0 or earlier, because the build system does not adjust pkgdatadir in those versions, so the hard-coded value (./share/mysql/...) in mysqld_safe matches the build, and people won't see a problem.  It is only for versions >= 5.1 that the build system explicitly sets pkgdatadir and friends.
[24 Jan 2008 0:22] Timothy Smith
Gah.  Somehow this was *not* queued to 5.1+.

Now it is in 5.1- and 6.0-build.  It will be in 5.1.23 and 6.0.4.

Sorry for any confusion.
[4 Feb 2008 20:06] Sveta Smirnova
Bug #34288 was marked as duplicate of this one.
[25 Feb 2008 15:59] Bugs System
Pushed into 5.1.24-rc
[25 Feb 2008 16:05] Bugs System
Pushed into 6.0.5-alpha
[25 Feb 2008 19:35] Paul Dubois
Noted in 5.1.23, 6.0.4 changelogs.

mysqld_safe looked for error messages in the wrong location.