]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-upgrade.patch
- hardcode tool paths, we have them in various dirs
[packages/mysql.git] / mysql-upgrade.patch
1 --- mysql-5.1.22-rc/client/mysql_upgrade.c      2007-09-24 13:30:24.000000000 +0300
2 +++ mysql-5.1.22-rc-upgrade/client/mysql_upgrade.c      2008-01-12 17:28:56.945615880 +0200
3 @@ -31,12 +31,12 @@
4  # endif
5  #endif
6  
7 -static char mysql_path[FN_REFLEN];
8 -static char mysqlcheck_path[FN_REFLEN];
9 +static char *mysql_path = "/usr/bin/mysql";
10 +static char *mysqlcheck_path = "/usr/sbin/mysqlcheck";
11  
12  static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag;
13  static uint my_end_arg= 0;
14 -static char *opt_user= (char*)"root";
15 +static char *opt_user= (char*)"mysql";
16  
17  static DYNAMIC_STRING ds_args;
18  
19 @@ -349,91 +349,6 @@
20    DBUG_RETURN(ret);
21  }
22  
23 -
24 -/*
25 -  Look for the tool in the same directory as mysql_upgrade.
26 -
27 -  When running in a not yet installed build the the program
28 -  will exist but it need to be invoked via it's libtool wrapper.
29 -  Check if the found tool can executed and if not look in the
30 -  directory one step higher up where the libtool wrapper normally
31 -  is found
32 -*/
33 -
34 -static void find_tool(char *tool_path, const char *tool_name)
35 -{
36 -  char path[FN_REFLEN];
37 -  DYNAMIC_STRING ds_tmp;
38 -  DBUG_ENTER("find_tool");
39 -  DBUG_PRINT("enter", ("progname: %s", my_progname));
40 -
41 -  if (init_dynamic_string(&ds_tmp, "", 32, 32))
42 -    die("Out of memory");
43 -
44 -  /* Initialize path with the full path to this program */
45 -  if (get_full_path_to_executable(path))
46 -  {
47 -    /*
48 -      Easy way to get full executable path failed, try
49 -      other methods
50 -    */
51 -    if (my_progname[0] == FN_LIBCHAR)
52 -    {
53 -      /* 1. my_progname contains full path */
54 -      strmake(path, my_progname, FN_REFLEN);
55 -    }
56 -    else if (my_progname[0] == '.')
57 -    {
58 -      /* 2. my_progname contains relative path, prepend wd */
59 -      char buf[FN_REFLEN];
60 -      my_getwd(buf, FN_REFLEN, MYF(0));
61 -      my_snprintf(path, FN_REFLEN, "%s%s", buf, my_progname);
62 -    }
63 -    else
64 -    {
65 -      /* 3. Just go for it and hope tool is in path */
66 -      path[0]= 0;
67 -    }
68 -  }
69 -  do
70 -  {
71 -    size_t path_len;
72 -    DBUG_PRINT("enter", ("path: %s", path));
73 -
74 -    /* Chop off last char(since it might be a /) */
75 -    path[max((strlen(path)-1), 0)]= 0;
76 -
77 -    /* Chop off last dir part */
78 -    dirname_part(path, path, &path_len);
79 -
80 -    /* Format name of the tool to search for */
81 -    fn_format(tool_path, tool_name,
82 -              path, "", MYF(MY_REPLACE_DIR));
83 -
84 -    verbose("Looking for '%s' in: %s", tool_name, tool_path);
85 -
86 -    /* Make sure the tool exists */
87 -    if (my_access(tool_path, F_OK) != 0)
88 -      die("Can't find '%s'", tool_path);
89 -
90 -    /*
91 -      Make sure it can be executed, otherwise try again
92 -      in higher level directory
93 -    */
94 -  }
95 -  while(run_tool(tool_path,
96 -                 &ds_tmp, /* Get output from command, discard*/
97 -                 "--help",
98 -                 "2>&1",
99 -                 IF_WIN("> NUL", "> /dev/null"),
100 -                 NULL));
101 -
102 -  dynstr_free(&ds_tmp);
103 -
104 -  DBUG_VOID_RETURN;
105 -}
106 -
107 -
108  /*
109    Run query using "mysql"
110  */
111 @@ -758,12 +673,6 @@
112    dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS);
113    dynstr_append(&ds_args, " ");
114  
115 -  /* Find mysql */
116 -  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"));
117 -
118 -  /* Find mysqlcheck */
119 -  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"));
120 -
121    /*
122      Read the mysql_upgrade_info file to check if mysql_upgrade
123      already has been run for this installation of MySQL
This page took 0.039456 seconds and 4 git commands to generate.