SOURCES: mysql-bug-18156.patch (NEW), mysql-bug-22807.patch (NEW) ...

arekm arekm at pld-linux.org
Sat Dec 16 22:35:43 CET 2006


Author: arekm                        Date: Sat Dec 16 21:35:43 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   mysql-bug-18156.patch (NONE -> 1.1)  (NEW), mysql-bug-22807.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mysql-bug-18156.patch
diff -u /dev/null SOURCES/mysql-bug-18156.patch:1.1
--- /dev/null	Sat Dec 16 22:35:43 2006
+++ SOURCES/mysql-bug-18156.patch	Sat Dec 16 22:35:38 2006
@@ -0,0 +1,50 @@
+From: Ignacio GalarzaDate: December 14 2006 10:41pm
+Subject: bk commit into 5.0 tree (iggy:1.2355) BUG#18156
+
+Below is the list of changes that have just been committed into a local
+5.0 repository of iggy. When iggy 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 at stripped, 2006-12-14 16:41:24-05:00, iggy at alf. +1 -0
+  Bug#18156 mysql_upgrade does not pass basedir or password arg to mysql and mysqlcheck
+  - mysql_upgrade improperly reads the password and protocol options from command line.
+
+  client/mysql_upgrade.c at stripped, 2006-12-14 16:40:41-05:00, iggy at alf. +5 -3
+    Bug#18156 mysql_upgrade does not pass basedir or password arg to mysql and mysqlcheck
+    - The password and protocol options were not being associate with their variables
+    properly.
+
+# 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:	iggy
+# Host:	alf.
+# Root:	D:/src/mysql-5.0-maint_18156
+
+--- 1.14/client/mysql_upgrade.c	2006-12-14 16:41:35 -05:00
++++ 1.15/client/mysql_upgrade.c	2006-12-14 16:41:35 -05:00
+@@ -90,7 +90,8 @@
+    (gptr*) &current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   {"password", 'p',
+    "Password to use when connecting to server. If password is not given"
+-   " it's solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
++   " it's solicited on the tty.", (gptr*) &opt_password, (gptr*) &opt_password,
++   0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ #ifdef __WIN__
+   {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, 
+    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+@@ -98,8 +99,9 @@
+   {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
+    (gptr*) &opt_mysql_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   {"protocol", OPT_MYSQL_PROTOCOL,
+-   "The protocol of connection (tcp,socket,pipe,memory).",
+-   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
++   "The protocol of connection (tcp,socket,pipe,memory).", 
++   (gptr*) &opt_protocol, (gptr*) &opt_protocol, 0, GET_STR, REQUIRED_ARG, 0,
++   0, 0, 0, 0, 0},
+ #ifdef HAVE_SMEM
+   {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
+    "Base name of shared memory.", (gptr*) &shared_memory_base_name, 

================================================================
Index: SOURCES/mysql-bug-22807.patch
diff -u /dev/null SOURCES/mysql-bug-22807.patch:1.1
--- /dev/null	Sat Dec 16 22:35:43 2006
+++ SOURCES/mysql-bug-22807.patch	Sat Dec 16 22:35:38 2006
@@ -0,0 +1,230 @@
+From: Ignacio GalarzaDate: December 14 2006 5:34pm
+Subject: bk commit into 5.0 tree (iggy:1.2355) BUG#22807
+
+Below is the list of changes that have just been committed into a local
+5.0 repository of iggy. When iggy 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 at stripped, 2006-12-14 11:33:46-05:00, iggy at alf. +3 -0
+  Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces
+  - Create space safe strings for system() calls in mysql_upgrade.exe
+
+  client/mysql_upgrade.c at stripped, 2006-12-14 11:32:53-05:00, iggy at alf. +61 -23
+    Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces
+    - Make use of new dynstr_append_os_quoted function to produce a string safe for
+    passing to the system() function.
+    - Refactor possible source of assertion.
+
+  include/my_sys.h at stripped, 2006-12-14 11:32:53-05:00, iggy at alf. +2 -0
+    Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces
+    - Declare dynstr_append_os_quoted function.
+
+  mysys/string.c at stripped, 2006-12-14 11:32:54-05:00, iggy at alf. +39 -0
+    Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces
+    - Define dynstr_append_os_quoted function.  This function will concatenate any
+    number of strings, escapes any OS quote in the result then surround the whole
+    affair in another set of quotes which is finally appended to specified
+    DYNAMIC_STRING.
+
+# 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:	iggy
+# Host:	alf.
+# Root:	D:/src/mysql-5.0-maint_22807
+
+--- 1.190/include/my_sys.h	2006-12-14 11:33:58 -05:00
++++ 1.191/include/my_sys.h	2006-12-14 11:33:58 -05:00
+@@ -781,6 +781,8 @@
+ extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
+ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
+ 			  uint length);
++extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
++                                       ...);
+ extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
+ extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
+ extern void dynstr_free(DYNAMIC_STRING *str);
+
+--- 1.8/mysys/string.c	2006-12-14 11:33:58 -05:00
++++ 1.9/mysys/string.c	2006-12-14 11:33:58 -05:00
+@@ -116,6 +116,45 @@
+ }
+ 
+ 
++my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
++{
++#ifdef __WIN__
++  char quote_str[]= "\"";
++#else
++  char quote_str[]= "\'";
++#endif /* __WIN__ */
++  my_bool ret= TRUE;
++  va_list dirty_text;
++
++  ret&= dynstr_append(str, quote_str);          /* Leading quote */
++  va_start(dirty_text,append);
++  while (append != NullS)
++  {
++    char *cur_pos= append;
++    char *next_pos= cur_pos;
++
++    /* Search for quote in each string and replace with escaped quote */
++    while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0')
++    {
++      char *tmp_buff= my_malloc((next_pos - cur_pos) + 1, MYF(MY_ZEROFILL));
++      strnmov(tmp_buff, cur_pos, (next_pos - cur_pos));
++      ret&= dynstr_append(str, tmp_buff);
++      my_free((gptr)tmp_buff, MYF(0));
++
++      ret&= dynstr_append(str ,"\\");
++      ret&= dynstr_append(str, quote_str);
++      cur_pos= next_pos + 1;
++    }
++    ret&= dynstr_append(str, cur_pos);
++    append= va_arg(dirty_text, char *);
++  }
++  va_end(dirty_text);
++  ret&= dynstr_append(str, quote_str);          /* Trailing quote */
++
++  return ret;
++}
++
++
+ void dynstr_free(DYNAMIC_STRING *str)
+ {
+   if (str->str)
+
+--- 1.14/client/mysql_upgrade.c	2006-12-14 11:33:58 -05:00
++++ 1.15/client/mysql_upgrade.c	2006-12-14 11:33:58 -05:00
+@@ -461,19 +461,20 @@
+   
+   load_defaults("my", load_default_groups, &argc, &argv);
+ 
+-  if (handle_options(&argc, &argv, my_long_options, get_one_option)) 
++  /* 
++     Must init_dynamic_string before handle_options because string is freed
++     at error label.
++  */
++  if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN) ||
++      handle_options(&argc, &argv, my_long_options, get_one_option))
+   {
+     ret= 1;
+     goto error;
+   }
++
+   if (tty_password)
+     opt_password= get_tty_password(NullS);
+ 
+-  if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN))
+-  {
+-    ret= 1;
+-    goto error;
+-  }
+   if (!basedir)
+   {
+     my_getwd(path, sizeof(path), MYF(0));
+@@ -510,7 +511,7 @@
+   /* 
+      Create the modified defaults file to be used by mysqlcheck 
+      and mysql tools                                            
+-   */
++  */
+   fn_format(path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
+   upgrade_defaults_path= my_strdup(path, MYF(0));
+   
+@@ -556,17 +557,34 @@
+      goto error;
+   }
+   else
+-    dynstr_set(&cmdline, path);
++  {
++#ifdef __WIN__
++    /* Windows requires an extra pair of quotes around the entire string. */
++    dynstr_set(&cmdline, "\""); 
++#else
++    dynstr_set(&cmdline, "");
++#endif /* __WIN__ */
++    dynstr_append_os_quoted(&cmdline, path, NullS);
++  }
+ 
+   if (defaults_to_use)
+   {
+-    dynstr_append(&cmdline, " --defaults-extra-file=");
+-    dynstr_append(&cmdline, defaults_to_use);
+-  }
+-  
+-  dynstr_append(&cmdline, " --check-upgrade --all-databases"
+-                 " --auto-repair --user=");
+-  dynstr_append(&cmdline, user);
++    dynstr_append(&cmdline, " ");
++    dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", 
++                            defaults_to_use, NullS);
++  }
++
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--all-databases", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--auto-repair", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
++#ifdef __WIN__
++  dynstr_append(&cmdline, "\"");
++#endif /* __WIN__ */
+ 
+   if (opt_verbose)
+     printf("Running %s\n", cmdline.str);
+@@ -595,7 +613,15 @@
+     goto error;
+   }
+   else
+-    dynstr_set(&cmdline, path);
++  {
++#ifdef __WIN__
++    /* Windows requires an extra pair of quotes around the entire string. */
++    dynstr_set(&cmdline, "\"");
++#else
++    dynstr_set(&cmdline, "");
++#endif /* __WIN__ */
++    dynstr_append_os_quoted(&cmdline, path, NullS);
++  }
+ 
+   if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0), 
+                           path, sizeof(path), 
+@@ -617,13 +643,25 @@
+ 
+   if (defaults_to_use)
+   {
+-    dynstr_append(&cmdline, " --defaults-extra-file=");
+-    dynstr_append(&cmdline, defaults_to_use);
+-  }
+-  dynstr_append(&cmdline, " --force --no-auto-rehash --batch --user=");
+-  dynstr_append(&cmdline, user);
+-  dynstr_append(&cmdline, " mysql < ");
+-  dynstr_append(&cmdline, script_line);
++    dynstr_append(&cmdline, " ");
++    dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", 
++                            defaults_to_use, NullS);
++  }
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--force", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--no-auto-rehash", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--batch", NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--user=", user, NullS);
++  dynstr_append(&cmdline, " ");
++  dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS);
++  dynstr_append(&cmdline, " < ");
++  dynstr_append_os_quoted(&cmdline, script_line, NullS);
++#ifdef __WIN__
++  dynstr_append(&cmdline, "\"");
++#endif /* __WIN__ */
+ 
+   if (opt_verbose)
+     printf("Running %s\n", cmdline.str);
================================================================


More information about the pld-cvs-commit mailing list