List:Commits« Previous MessageNext Message »
From:Patrick Crews Date:December 17 2008 9:32pm
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-diff_patch/ based on revid:timothy.smith@stripped

 2746 Patrick Crews	2008-12-17
      Bug#38833: mysql-test-run needs diff.
      
      Added code to detect if diff isn't available on Windows.
      diff returns 1 on that OS whether it is successful, fails, or is not present.
      
      Have to detect error pattern in diff output to properly inform user they need the utility.
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-17 21:32:11 +0000
@@ -1252,12 +1252,25 @@ 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 first_line = 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 (first_line && strstr(buf,diff_cmd))
+      {
+        diff_flag=1;
+      }
+    first_line += 1;
     DBUG_PRINT("info", ("buf: %s", buf));
     if(ds_res)
     {
@@ -1272,6 +1285,12 @@ static int run_command(char* cmd,
   }
 
   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