summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.(none)>2007-08-27 10:25:34 +0200
committerunknown <msvensson@pilot.(none)>2007-08-27 10:25:34 +0200
commitbd55d4f17411212307be35fa51fcc551d261381c (patch)
treee30827df6a7fb444cd0c866a1031d3ac1de19386
parentb18447112c2bdc81e581ff51087c78b5e345bb4d (diff)
downloadmariadb-git-bd55d4f17411212307be35fa51fcc551d261381c.tar.gz
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.
-rw-r--r--client/mysql_upgrade.c69
1 files changed, 39 insertions, 30 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 13f5d2606a9..630267f1a5e 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -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.
-
- 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)
@@ -385,37 +379,52 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0;
}
}
- do
- {
- DBUG_PRINT("enter", ("path: %s", path));
- /* Chop off last char(since it might be a /) */
- path[max((strlen(path)-1), 0)]= 0;
+ DBUG_PRINT("info", ("path: '%s'", path));
+
+ /* Chop off binary name (i.e mysql-upgrade) from 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 last dir part */
+ /* Chop off .libs */
dirname_part(path, path);
+ }
- /* Format name of the tool to search for */
- fn_format(tool_path, tool_name,
- path, "", MYF(MY_REPLACE_DIR));
- verbose("Looking for '%s' in: %s", tool_name, tool_path);
+ DBUG_PRINT("info", ("path: '%s'", path));
- /* Make sure the tool exists */
- if (my_access(tool_path, F_OK) != 0)
- die("Can't find '%s'", tool_path);
+ /* Format name of the tool to search for */
+ fn_format(tool_path, tool_name,
+ path, "", MYF(MY_REPLACE_DIR));
- /*
- Make sure it can be executed, otherwise try again
- in higher level directory
- */
- }
- while(run_tool(tool_path,
- &ds_tmp, /* Get output from command, discard*/
- "--help",
- "2>&1",
- IF_WIN("> NUL", "> /dev/null"),
- NULL));
+ verbose("Looking for '%s' in: %s", tool_name, tool_path);
+
+ /* Make sure the tool exists */
+ if (my_access(tool_path, F_OK) != 0)
+ die("Can't find '%s'", tool_path);
+
+ /*
+ Make sure it can be executed
+ */
+ if (run_tool(tool_path,
+ &ds_tmp, /* Get output from command, discard*/
+ "--help",
+ "2>&1",
+ IF_WIN("> NUL", "> /dev/null"),
+ NULL))
+ die("Can't execute '%s'", tool_path);
dynstr_free(&ds_tmp);