List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:February 10 2009 3:43pm
Subject:bzr commit into mysql-5.1-bugteam branch (chad:2725) Bug#30261
View as plain text  
#At file:///home/cmiller/work/mysqlbzr/mysql-5.1-bugteam--bug30261/ based on revid:kgeorge@stripped

 2725 Chad MILLER	2009-02-10
      Bug#30261: "mysqld --help" no longer possible for root
      
      The check for root-ness would signal an error.  Errors would make the
      server exit before usage (help) information was printed.
      
      Now, test for whether we want help regardless of whether we're going
      to exit with an error.  If plugins are not initialized by the time we 
      print usage information, inform the user that some parameters are 
      missing.
modified:
  sql/mysqld.cc

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-11-28 15:27:12 +0000
+++ b/sql/mysqld.cc	2009-02-10 14:41:55 +0000
@@ -682,6 +682,8 @@ bool mysqld_embedded=0;
 bool mysqld_embedded=1;
 #endif
 
+static my_bool plugins_are_initialized= FALSE;
+
 #ifndef DBUG_OFF
 static const char* default_dbug_option;
 #endif
@@ -1176,10 +1178,10 @@ extern "C" void unireg_abort(int exit_co
 {
   DBUG_ENTER("unireg_abort");
 
+  if (opt_help)
+    usage();
   if (exit_code)
     sql_print_error("Aborting\n");
-  else if (opt_help)
-    usage();
   clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
   DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
   wait_for_signal_thread_to_end();
@@ -3841,12 +3843,15 @@ server.");
   if (ha_init_errors())
     DBUG_RETURN(1);
 
-  if (plugin_init(&defaults_argc, defaults_argv,
-                  (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
-                  (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
-  {
-    sql_print_error("Failed to initialize plugins.");
-    unireg_abort(1);
+  { 
+    if (plugin_init(&defaults_argc, defaults_argv,
+		    (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
+		    (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
+    {
+      sql_print_error("Failed to initialize plugins.");
+      unireg_abort(1);
+    }
+    plugins_are_initialized= TRUE;  /* Don't separate from init function */
   }
 
   if (opt_help)
@@ -7378,7 +7383,8 @@ static void usage(void)
     default_collation_name= (char*) default_charset_info->name;
   print_version();
   puts("\
-Copyright (C) 2000 MySQL AB, by Monty and others\n\
+Copyright (C) 2000-2008 MySQL AB, by Monty and others\n\
+Copyright (C) 2008 Sun Microsystems, Inc.\n\
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
 and you are welcome to modify and redistribute it under the GPL license\n\n\
 Starts the MySQL database server\n");
@@ -7408,6 +7414,13 @@ Starts the MySQL database server\n");
   /* Print out all the options including plugin supplied options */
   my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
 
+  if (! plugins_are_initialized)
+  {
+    puts("\n\
+Plugins have parameters that are not reflected in this list\n\
+because execution stopped before plugins were initialized.");
+  }
+
   puts("\n\
 To see what values a running MySQL server is using, type\n\
 'mysqladmin variables' instead of 'mysqld --verbose --help'.");


Attachment: [text/bzr-bundle] bzr/chad@mysql.com-20090210144155-7lq7k1jsmwsmoq3s.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (chad:2725) Bug#30261Chad MILLER10 Feb