summaryrefslogtreecommitdiff
path: root/client/mysql_upgrade.c
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.(none)>2007-08-27 10:50:44 +0200
committerunknown <msvensson@pilot.(none)>2007-08-27 10:50:44 +0200
commit5dc89e0f200e152616b670ab7399e8085b02c259 (patch)
treee6773c6c56f45e306f485a779eb510810ab7096f /client/mysql_upgrade.c
parentf367d97cfcf105b849e5b561e1e0b2938f75be0f (diff)
parentbd55d4f17411212307be35fa51fcc551d261381c (diff)
downloadmariadb-git-5dc89e0f200e152616b670ab7399e8085b02c259.tar.gz
Merge pilot.(none):/data/msvensson/mysql/mysql-5.0-maint
into pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint mysql-test/lib/mtr_misc.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged client/mysql_upgrade.c: Manual merge 5.0->5.1
Diffstat (limited to 'client/mysql_upgrade.c')
-rw-r--r--client/mysql_upgrade.c71
1 files changed, 40 insertions, 31 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 7a36a382c97..4b7a7ad2530 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -352,16 +352,11 @@ 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)
{
+ size_t path_len;
char path[FN_REFLEN];
DYNAMIC_STRING ds_tmp;
DBUG_ENTER("find_tool");
@@ -395,38 +390,52 @@ static void find_tool(char *tool_path, const char *tool_name)
path[0]= 0;
}
}
- do
- {
- size_t path_len;
- 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, &path_len);
+
+ /*
+ 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(path_len-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, &path_len);
+ }
- /* 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);