List:Commits« Previous MessageNext Message »
From:Patrick Crews Date:December 16 2008 11:51pm
Subject:bzr commit into mysql-5.0-bugteam branch (patrick.crews:2746) Bug#38833
View as plain text  
#At file:///Users/pcrews/usr/local/bin/data1/work/mtr_win/mysql-5.0-mtr_diff/ based on revid:timothy.smith@stripped

 2746 Patrick Crews	2008-12-16
      Bug#38833:  mysql-test-run needs diff.  Problem w/error handling in calling diff on Windows
      
      Altered mysqltest.c's run_command function to catch a lack of diff on Windows
      so that a user receives a proper error message.
modified:
  client/mysqltest.c

=== modified file 'client/mysqltest.c'
--- a/client/mysqltest.c	2008-05-02 17:01:32 +0000
+++ b/client/mysqltest.c	2008-12-16 23:51:08 +0000
@@ -1252,12 +1252,24 @@ static int run_command(char* cmd,
   char buf[512]= {0};
   FILE *res_file;
   int error;
+  /* vars added to detect a lack of 'diff' on Windows */
+  int diff_flag= 0;
+  int cmd_index= 0;
+  char *diff_cmd= "\"diff\"";
 
   if (!(res_file= popen(cmd, "r")))
     die("popen(\"%s\", \"r\") failed", cmd);
 
   while (fgets(buf, sizeof(buf), res_file))
   {
+    /*  Windows returns '"<command>"' is not recognized...
+    if it doesn't have a command (no decent differences in return values)
+    So, we have to look for this pattern "diff" in the first line of
+    text returned from the command */
+    if (cmd_index ==0 && strstr(buf,diff_cmd))
+      {
+        diff_flag=1;
+      }
     DBUG_PRINT("info", ("buf: %s", buf));
     if(ds_res)
     {
@@ -1269,9 +1281,16 @@ static int run_command(char* cmd,
       /* Print it directly on screen */
       fprintf(stdout, "%s", buf);
     }
+    cmd_index += 1;
   }
 
   error= pclose(res_file);
+  /* Ensure show_diff returns proper error message if we don't have diff
+     on Windows */
+  if (diff_flag)
+  { 
+     error += 1;
+  }
   return WEXITSTATUS(error);
 }
 

Thread
bzr commit into mysql-5.0-bugteam branch (patrick.crews:2746) Bug#38833Patrick Crews17 Dec