List:Commits« Previous MessageNext Message »
From:msvensson Date:August 27 2007 10:25am
Subject:bk commit into 5.0 tree (msvensson:1.2501) BUG#28560
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-27 10:25:34+02:00, msvensson@pilot.(none) +1 -0
  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@stripped, 2007-08-27 10:25:33+02:00, msvensson@pilot.(none) +41 -32
    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.

diff -Nrup a/client/mysql_upgrade.c b/client/mysql_upgrade.c
--- a/client/mysql_upgrade.c	2007-08-03 12:54:01 +02:00
+++ b/client/mysql_upgrade.c	2007-08-27 10:25:33 +02:00
@@ -342,12 +342,6 @@ static my_bool get_full_path_to_executab
 
 /*
   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, c
       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 last dir part */
-    dirname_part(path, path);
+  /* Chop off binary name (i.e mysql-upgrade) from path */
+  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);
-
-    /* Make sure the tool exists */
-    if (my_access(tool_path, F_OK) != 0)
-      die("Can't find '%s'", tool_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));
 
-    /*
-      Make sure it can be executed, otherwise try again
-      in higher level directory
-    */
+    /* Chop off .libs */
+    dirname_part(path, path);
   }
-  while(run_tool(tool_path,
-                 &ds_tmp, /* Get output from command, discard*/
-                 "--help",
-                 "2>&1",
-                 IF_WIN("> NUL", "> /dev/null"),
-                 NULL));
+
+
+  DBUG_PRINT("info", ("path: '%s'", 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);
+
+  /* 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);
 
Thread
bk commit into 5.0 tree (msvensson:1.2501) BUG#28560msvensson27 Aug