← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2739: When using --help --verbose give error and abort if there are any unknown options

 

------------------------------------------------------------
revno: 2739
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: mysql-maria
timestamp: Fri 2009-10-02 14:09:01 +0300
message:
  When using --help --verbose give error and abort if there are any unknown options
modified:
  mysql-test/r/mysqld_option_err.result
  mysql-test/t/mysqld_option_err.test
  sql/mysqld.cc


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'mysql-test/r/mysqld_option_err.result'
--- mysql-test/r/mysqld_option_err.result	2009-09-03 13:05:02 +0000
+++ mysql-test/r/mysqld_option_err.result	2009-10-02 11:09:01 +0000
@@ -3,4 +3,6 @@
 Test bad default storage engine.
 Test non-numeric value passed to number option.
 Test that bad value for plugin enum option is rejected correctly.
+Test that --help --verbose works
+Test that --not-known-option --help --verbose gives error
 Done.

=== modified file 'mysql-test/t/mysqld_option_err.test'
--- mysql-test/t/mysqld_option_err.test	2009-09-25 14:38:02 +0000
+++ mysql-test/t/mysqld_option_err.test	2009-10-02 11:09:01 +0000
@@ -46,5 +46,14 @@
 --error 7
 --exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables $EXAMPLE_PLUGIN_OPT --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
 
+#
+# Test that an wrong option with --help --verbose gives an error
+#
+
+--echo Test that --help --verbose works
+--exec $MYSQLD --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+--echo Test that --not-known-option --help --verbose gives error
+--error 2
+--exec $MYSQLD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
 
 --echo Done.

=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc	2009-09-17 22:46:10 +0000
+++ sql/mysqld.cc	2009-10-02 11:09:01 +0000
@@ -4020,9 +4020,6 @@
     plugins_are_initialized= TRUE;  /* Don't separate from init function */
   }
 
-  if (opt_help)
-    unireg_abort(0);
-
   /* we do want to exit if there are any other unknown options */
   if (defaults_argc > 1)
   {
@@ -4047,13 +4044,15 @@
 
     if (defaults_argc)
     {
-      fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n"
-              "Use --verbose --help to get a list of available options\n",
+      fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n",
               my_progname, *tmp_argv);
       unireg_abort(1);
     }
   }
 
+  if (opt_help)
+    unireg_abort(0);
+
   /* if the errmsg.sys is not loaded, terminate to maintain behaviour */
   if (!errmesg[0][0])
     unireg_abort(1);