List:Commits« Previous MessageNext Message »
From:msvensson Date:March 3 2006 1:55pm
Subject:bk commit into 5.0 tree (msvensson:1.2100)
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.2100 06/03/03 14:55:05 msvensson@neptunus.(none) +3 -0
  Windows fixes
   - Use pipes "|"
   - Improved system command, create a temporary .sh faile that is executed  with cygwins sh(bash)
     This makes the Windows version behave exactly as the Lunix version(well almost...) 
   - Give unix path to DBUG, trace files is no produced if running ./mysql-test-run.pl --debug"

  mysql-test/mysql-test-run.pl
    1.74 06/03/03 14:54:59 msvensson@neptunus.(none) +3 -0
    DBUG want's a unix format strings for where it should put the tracefile(don't ask me why but it works)
    Just chop of the first "c:" from the "c:/src/.." string and DBUG will be happy

  mysql-test/lib/mtr_misc.pl
    1.7 06/03/03 14:54:59 msvensson@neptunus.(none) +10 -1
    Return all paths to executables in windows format "c:\src\.." when run on windows.
    This makes it possible to use the pipes "|" to pipöe the output form exeample "mysqlbinlog" into "mysql"

  client/mysqltest.c
    1.220 06/03/03 14:54:59 msvensson@neptunus.(none) +35 -19
    Add new function "my_system" that run the <command> a she script using cygwin bash on windows.

# 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/mysqltest_win/my50-mysqltest_win

--- 1.6/mysql-test/lib/mtr_misc.pl	2005-11-22 22:43:42 +01:00
+++ 1.7/mysql-test/lib/mtr_misc.pl	2006-03-03 14:54:59 +01:00
@@ -96,7 +96,16 @@
   map {$_.= ".exe"} @path if $::glob_win32;
   foreach my $path ( @path )
   {
-    return $path if -x $path;
+    if ( -x $path )
+    {
+      if ( $::glob_cygwin_perl )
+      {
+        $path= `cygpath -w $path`;
+	# Chop off the \n that cygpath adds
+        $path=~ s/\n//;
+      }
+      return $path;
+    }
   }
   if ( @path == 1 )
   {

--- 1.73/mysql-test/mysql-test-run.pl	2006-03-01 13:29:27 +01:00
+++ 1.74/mysql-test/mysql-test-run.pl	2006-03-03 14:54:59 +01:00
@@ -668,6 +668,9 @@
     $opt_vardir= "$glob_mysql_test_dir/var";
   }
   $opt_vardir_trace= $opt_vardir;
+  # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
+  $opt_vardir_trace=~ s/^\w://;
+
   # We make the path absolute, as the server will do a chdir() before usage
   unless ( $opt_vardir =~ m,^/, or
            ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )

--- 1.219/client/mysqltest.c	2006-03-02 17:33:30 +01:00
+++ 1.220/client/mysqltest.c	2006-03-03 14:54:59 +01:00
@@ -1352,6 +1352,35 @@
 
 
 /*
+  Wrapper for 'system' function
+
+  NOTE
+   If mysqltest is executed from cygwin shell, the command will be
+   executed in the "windows command interpreter" cmd.exe and we prepend "sh"
+   to make it be executed by cygwins "bash". Thus commands like "rm",
+   "mkdir" as well as shellscripts can executed by "system" in Windows.
+
+*/
+
+int my_system(DYNAMIC_STRING* ds_cmd)
+{
+#ifdef __WIN__
+  /* Dump the command into a sh script file and execute with "sh" */
+  int err;
+  char tmp_sh_name[64], tmp_sh_cmd[70];
+  my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
+  my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
+  str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
+  err= system(tmp_sh_cmd);
+  my_delete(tmp_sh_name, MYF(0));
+  return err;
+#else
+  return system(ds_cmd->str);
+#endif
+}
+
+
+/*
 
   SYNOPSIS
   do_system
@@ -1363,37 +1392,24 @@
     Eval the query to expand any $variables in the command.
     Execute the command with the "system" command.
 
-  NOTE
-   If mysqltest is executed from cygwin shell, the command will be
-   executed in the "windows command interpreter" cmd.exe and we prepend "sh"
-   to make it be executed by cygwins "bash". Thus commands like "rm",
-   "mkdir" as well as shellscripts can executed by "system" in Windows.
- */
+*/
 
-int do_system(struct st_query *command)
+void do_system(struct st_query *command)
 {
   DYNAMIC_STRING ds_cmd;
+  DBUG_ENTER("do_system");
 
   if (strlen(command->first_argument) == 0)
     die("Missing arguments to system, nothing to do!");
 
   init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256);
 
-#ifdef __WIN__
-  /* Execute the command in "bash", ie. sh -c "<command>" */
-  dynstr_append(&ds_cmd, "sh -c \"");
-#endif
-
   /* Eval the system command, thus replacing all environment variables */
   do_eval(&ds_cmd, command->first_argument, TRUE);
 
-#ifdef __WIN__
-  dynstr_append(&ds_cmd, "\"");
-#endif
-
   DBUG_PRINT("info", ("running system command '%s' as '%s'",
                       command->first_argument, ds_cmd.str));
-  if (system(ds_cmd.str))
+  if (my_system(&ds_cmd))
   {
     if (command->abort_on_error)
       die("system command '%s' failed", command->first_argument);
@@ -1405,7 +1421,7 @@
   }
 
   command->last_argument= command->end;
-  return 0;
+  DBUG_VOID_RETURN;
 }
 
 
@@ -1656,7 +1672,7 @@
   char *p= query->first_argument;
   char *sleep_start, *sleep_end= query->end;
   double sleep_val;
-  char *cmd = (real_sleep ? "real_sleep" : "sleep");
+  const char *cmd = (real_sleep ? "real_sleep" : "sleep");
 
   while (my_isspace(charset_info, *p))
     p++;
Thread
bk commit into 5.0 tree (msvensson:1.2100)msvensson3 Mar