Commit bd55d4f1 authored by unknown's avatar unknown

Bug#28560 mysql_upgrade test links /usr/local/mysql/lib libraries

 - Chop off .libs/ part of path if running in non installed builddir
   using libtool


client/mysql_upgrade.c:
  Chop off .libs part of path to avoid executing "non relinked" binaries
  that would use the system installed dynamic libraries instead of the
  newly built ones.
parent b1844711
...@@ -342,12 +342,6 @@ static my_bool get_full_path_to_executable(char* path) ...@@ -342,12 +342,6 @@ static my_bool get_full_path_to_executable(char* path)
/* /*
Look for the tool in the same directory as mysql_upgrade. Look for the tool in the same directory as mysql_upgrade.
When running in a not yet installed build the the program
will exist but it need to be invoked via it's libtool wrapper.
Check if the found tool can executed and if not look in the
directory one step higher up where the libtool wrapper normally
is found
*/ */
static void find_tool(char *tool_path, const char *tool_name) static void find_tool(char *tool_path, const char *tool_name)
...@@ -385,16 +379,32 @@ static void find_tool(char *tool_path, const char *tool_name) ...@@ -385,16 +379,32 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0; path[0]= 0;
} }
} }
do
{
DBUG_PRINT("enter", ("path: %s", path));
/* Chop off last char(since it might be a /) */ DBUG_PRINT("info", ("path: '%s'", path));
path[max((strlen(path)-1), 0)]= 0;
/* Chop off last dir part */ /* Chop off binary name (i.e mysql-upgrade) from path */
dirname_part(path, path); dirname_part(path, path);
/*
When running in a not yet installed build and using libtool,
the program(mysql_upgrade) will be in .libs/ and executed
through a libtool wrapper in order to use the dynamic libraries
from this build. The same must be done for the tools(mysql and
mysqlcheck). Thus if path ends in .libs/, step up one directory
and execute the tools from there
*/
path[max((strlen(path)-1), 0)]= 0; /* Chop off last / */
if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
{
DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
/* Chop off .libs */
dirname_part(path, path);
}
DBUG_PRINT("info", ("path: '%s'", path));
/* Format name of the tool to search for */ /* Format name of the tool to search for */
fn_format(tool_path, tool_name, fn_format(tool_path, tool_name,
path, "", MYF(MY_REPLACE_DIR)); path, "", MYF(MY_REPLACE_DIR));
...@@ -406,16 +416,15 @@ static void find_tool(char *tool_path, const char *tool_name) ...@@ -406,16 +416,15 @@ static void find_tool(char *tool_path, const char *tool_name)
die("Can't find '%s'", tool_path); die("Can't find '%s'", tool_path);
/* /*
Make sure it can be executed, otherwise try again Make sure it can be executed
in higher level directory
*/ */
} if (run_tool(tool_path,
while(run_tool(tool_path,
&ds_tmp, /* Get output from command, discard*/ &ds_tmp, /* Get output from command, discard*/
"--help", "--help",
"2>&1", "2>&1",
IF_WIN("> NUL", "> /dev/null"), IF_WIN("> NUL", "> /dev/null"),
NULL)); NULL))
die("Can't execute '%s'", tool_path);
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment