List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:September 3 2005 1:13am
Subject:bk commit into 4.1 tree (jimw:1.2404) BUG#12925
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw 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.2404 05/09/02 16:13:07 jimw@stripped +3 -0
  Fix incorrect cast in my_getopt code that capped the maximum of longlong
  options to the wrong value. (Bug #12925)

  tests/mysql_client_test.c
    1.158 05/09/02 16:13:03 jimw@stripped +19 -0
    Add test for my_getopt bug.

  mysys/my_getopt.c
    1.51 05/09/02 16:13:03 jimw@stripped +1 -1
    Remove incorrect cast

  mysql-test/t/mysql_client_test.test
    1.14 05/09/02 16:13:03 jimw@stripped +2 -2
    Add --getopt-ll-test flag

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-4.1-12925

--- 1.50/mysys/my_getopt.c	2004-08-31 18:12:06 -07:00
+++ 1.51/mysys/my_getopt.c	2005-09-02 16:13:03 -07:00
@@ -691,7 +691,7 @@
   num= eval_num_suffix(arg, err, (char*) optp->name);
   if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value
&&
       optp->max_value) /* if max value is not set -> no upper limit */
-    num= (longlong) (ulong) optp->max_value;
+    num= (longlong) optp->max_value;
   num= ((num - (longlong) optp->sub_size) / block_size);
   num= (longlong) (num * block_size);
   return max(num, optp->min_value);

--- 1.13/mysql-test/t/mysql_client_test.test	2005-07-27 17:21:44 -07:00
+++ 1.14/mysql-test/t/mysql_client_test.test	2005-09-02 16:13:03 -07:00
@@ -6,7 +6,7 @@
 # var/log/mysql_client_test.trace
 
 --disable_result_log
---exec echo $MYSQL_CLIENT_TEST
---exec $MYSQL_CLIENT_TEST
+--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=5294967296
+--exec $MYSQL_CLIENT_TEST --getopt-ll-test=5294967296
 
 # End of 4.1 tests

--- 1.157/tests/mysql_client_test.c	2005-08-30 12:24:34 -07:00
+++ 1.158/tests/mysql_client_test.c	2005-09-02 16:13:03 -07:00
@@ -51,6 +51,8 @@
 
 static const char *opt_basedir= "./";
 
+static longlong opt_getopt_ll_test= 0;
+
 static int embedded_server_arg_count= 0;
 static char *embedded_server_args[MAX_SERVER_ARGS];
 
@@ -11830,6 +11832,19 @@
   rc= mysql_query(mysql, "drop table t1, t2");
   myquery(rc);
 }
+
+
+/*
+  Bug #12925: Bad handling of maximum values in getopt
+*/
+static void test_bug12925()
+{
+  myheader("test_bug12925");
+  if (opt_getopt_ll_test)
+    DIE_UNLESS(opt_getopt_ll_test > LL(4*1024*1024*1024));
+}
+
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -11872,6 +11887,9 @@
   {"user", 'u', "User for login if not current user", (char **) &opt_user,
    (char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
+   (char **) &opt_getopt_ll_test, (char **) &opt_getopt_ll_test, 0,
+   GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -12048,6 +12066,7 @@
   { "test_bug11183", test_bug11183 },
   { "test_bug12001", test_bug12001 },
   { "test_bug11718", test_bug11718 },
+  { "test_bug12925", test_bug12925 },
   { 0, 0 }
 };
 
Thread
bk commit into 4.1 tree (jimw:1.2404) BUG#12925Jim Winstead3 Sep