MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:April 26 2006 10:45am
Subject:bk commit into 5.0 tree (msvensson:1.2190) BUG#19362
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
  1.2190 06/04/26 12:45:22 msvensson@neptunus.(none) +2 -0
  Bug#19362 im_daemon_lifecycle fails when built from source distribution
  - Add function "mysqld_real_path" which is needed if the mysqld_path is a symlink or a script(like libtool) that executes the real mysqld.
  - Add new variable mysqld_real_path
  - Use mysqld_real_path from fill_instance_version

  server-tools/instance-manager/instance_options.h
    1.19 06/04/26 12:45:18 msvensson@neptunus.(none) +4 -1
    Add new variable "mysqld_real_path"

  server-tools/instance-manager/instance_options.cc
    1.30 06/04/26 12:45:18 msvensson@neptunus.(none) +57 -2
    Add function "mysqld_real_path" which is needed if the mysqld_path is a symlink or a script(like libtool) that executes the real mysqld.
    Add new variable mysqld_real_path
    Use mysqld_real_path from fill_instance_version

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-5.0-maint

--- 1.29/server-tools/instance-manager/instance_options.cc	2005-11-02 16:28:47 +01:00
+++ 1.30/server-tools/instance-manager/instance_options.cc	2006-04-26 12:45:18 +02:00
@@ -22,6 +22,7 @@
 
 #include "parse_output.h"
 #include "buffer.h"
+#include "log.h"
 
 #include <my_sys.h>
 #include <signal.h>
@@ -132,7 +133,7 @@
 
   bzero(result, MAX_VERSION_STRING_LENGTH);
 
-  rc= parse_output_and_get_value(cmd.buffer, mysqld_path,
+  rc= parse_output_and_get_value(cmd.buffer, mysqld_real_path,
                                  result, MAX_VERSION_STRING_LENGTH,
                                  GET_LINE);
 
@@ -143,6 +144,60 @@
     mysqld_version= strdup_root(&alloc, result);
   }
 err:
+  if (rc)
+    log_error("fill_instance_version: Failed to get version of '%s'",
+              mysqld_path);
+  return rc;
+}
+
+
+/*
+  Fill mysqld_real_path
+
+  SYNOPSYS
+    fill_mysqld_real_path()
+
+  DESCRIPTION
+
+  Get the real path to mysqld from "mysqld --help" output.
+  Will print the realpath of mysqld between "Usage: " and "[OPTIONS]"
+
+  This is needed if the mysqld_path variable is pointing at a
+  script(for example libtool) or a symlink.
+
+  RETURN
+    0 - ok
+    1 - error occured
+*/
+
+int Instance_options::fill_mysqld_real_path()
+{
+  char result[FN_REFLEN];
+  char help_option[]= " --no-defaults --help";
+  int rc= 1;
+  Buffer cmd(mysqld_path_len + sizeof(help_option));
+
+  if (create_mysqld_command(&cmd, mysqld_path, mysqld_path_len,
+                            help_option, sizeof(help_option)))
+    goto err;
+
+  bzero(result, FN_REFLEN);
+
+  rc= parse_output_and_get_value(cmd.buffer, "Usage: ",
+                                 result, FN_REFLEN,
+                                 GET_LINE);
+
+  if (*result != '\0')
+  {
+    char* options_str;
+    /* chop the path of at [OPTIONS] */
+    if ((options_str= strstr(result, "[OPTIONS]")))
+      *options_str= '\0';
+    mysqld_real_path= strdup_root(&alloc, result);
+  }
+err:
+  if (rc)
+    log_error("fill_mysqld_real_path: Failed to get real path of mysqld");
   return rc;
 }
 
@@ -405,7 +460,7 @@
          options_array.elements*sizeof(char*));
   argv[filled_default_options + options_array.elements]= 0;
 
-  if (fill_log_options() || fill_instance_version())
+  if (fill_log_options() || fill_mysqld_real_path() || fill_instance_version())
     goto err;
 
   return 0;

--- 1.18/server-tools/instance-manager/instance_options.h	2005-09-23 20:28:47 +02:00
+++ 1.19/server-tools/instance-manager/instance_options.h	2006-04-26 12:45:18 +02:00
@@ -44,7 +44,8 @@
   Instance_options() :
     mysqld_version(0), mysqld_socket(0), mysqld_datadir(0),
     mysqld_bind_address(0), mysqld_pid_file(0), mysqld_port(0),
-    mysqld_port_val(0), mysqld_path(0), nonguarded(0), shutdown_delay(0),
+    mysqld_port_val(0), mysqld_path(0), mysqld_real_path(0),
+    nonguarded(0), shutdown_delay(0),
     shutdown_delay_val(0), filled_default_options(0)
   {}
   ~Instance_options();
@@ -84,6 +85,7 @@
   uint instance_name_len;
   const char *mysqld_path;
   uint mysqld_path_len;
+  const char *mysqld_real_path;
   const char *nonguarded;
   const char *shutdown_delay;
   uint shutdown_delay_val;
@@ -95,6 +97,7 @@
 private:
   int fill_log_options();
   int fill_instance_version();
+  int fill_mysqld_real_path();
   int add_to_argv(const char *option);
   int get_default_option(char *result, size_t result_len,
                          const char *option_name);
Thread
bk commit into 5.0 tree (msvensson:1.2190) BUG#19362msvensson26 Apr