Merge lp:~linuxjedi/drizzle/drizzle-bug-628364 into lp:~drizzle-trunk/drizzle/development

Proposed by Andrew Hutchings
Status: Merged
Approved by: Lee Bieber
Approved revision: 1745
Merged at revision: 1746
Proposed branch: lp:~linuxjedi/drizzle/drizzle-bug-628364
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 192 lines (+34/-35)
4 files modified
drizzled/drizzled.cc (+21/-13)
drizzled/internal/default.cc (+1/-18)
drizzled/module/loader.cc (+11/-3)
tests/test-run.pl (+1/-1)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/drizzle-bug-628364
Reviewer Review Type Date Requested Status
Andrew Hutchings Needs Fixing
Drizzle Merge Team Pending
Review via email: mp+34356@code.launchpad.net

Description of the change

Remove variables defaults from drizzled --help. Cannot remove function completely as it is used by my_print_defaults which in-turn is used by dtr and startup scripts which we supply.

To post a comment you must log in.
Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

Branch completely breaks dtr now :/

review: Needs Fixing
Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

OK, so. Old behaviour is now in --print-defaults (which was unused and pretty much useless), dtr now uses this option.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/drizzled.cc'
2--- drizzled/drizzled.cc 2010-08-29 17:59:12 +0000
3+++ drizzled/drizzled.cc 2010-09-02 21:51:48 +0000
4@@ -198,6 +198,7 @@
5 */
6 bool opt_help= false;
7 bool opt_help_extended= false;
8+bool opt_print_defaults= false;
9
10 arg_cmp_func Arg_comparator::comparator_matrix[5][2] =
11 {{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string},
12@@ -478,7 +479,7 @@
13
14 if (exit_code)
15 errmsg_printf(ERRMSG_LVL_ERROR, _("Aborting\n"));
16- else if (opt_help || opt_help_extended)
17+ else if (opt_help || opt_help_extended || opt_print_defaults)
18 usage();
19 clean_up(!opt_help && (exit_code));
20 internal::my_end();
21@@ -874,7 +875,7 @@
22 }
23
24
25- if (opt_help || opt_help_extended)
26+ if (opt_help || opt_help_extended || opt_print_defaults)
27 unireg_abort(0);
28
29 po::parsed_options parsed= po::command_line_parser(defaults_argc,
30@@ -1023,12 +1024,14 @@
31 OPT_PLUGIN_DIR,
32 OPT_PORT_OPEN_TIMEOUT,
33 OPT_SECURE_FILE_PRIV,
34- OPT_MIN_EXAMINED_ROW_LIMIT
35+ OPT_MIN_EXAMINED_ROW_LIMIT,
36+ OPT_PRINT_DEFAULTS
37 };
38
39
40 struct option my_long_options[] =
41 {
42+
43 {"help", '?', N_("Display this help and exit."),
44 (char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
45 0, 0},
46@@ -1036,6 +1039,10 @@
47 N_("Display this help and exit after initializing plugins."),
48 (char**) &opt_help_extended, (char**) &opt_help_extended,
49 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
50+ {"print-defaults", OPT_PRINT_DEFAULTS,
51+ N_("Print the default settings and exit"),
52+ (char**) &opt_print_defaults, (char**) &opt_print_defaults, 0, GET_BOOL,
53+ NO_ARG, 0, 0, 0, 0, 0, 0},
54 {"auto-increment-increment", OPT_AUTO_INCREMENT,
55 N_("Auto-increment columns are incremented by this"),
56 (char**) &global_system_variables.auto_increment_increment,
57@@ -1382,20 +1389,21 @@
58 "This software comes with ABSOLUTELY NO WARRANTY. "
59 "This is free software,\n"
60 "and you are welcome to modify and redistribute it under the GPL "
61- "license\n\n"
62- "Starts the Drizzle database server\n"));
63+ "license\n\n"));
64
65- printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
66+ if (!opt_print_defaults)
67 {
68- internal::print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups);
69- puts("");
70+ printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
71+
72+ internal::print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups);
73+ puts("");
74+ }
75
76- /* Print out all the options including plugin supplied options */
77- my_print_help_inc_plugins(my_long_options, long_options);
78- }
79+ /* Print out all the options including plugin supplied options */
80+ my_print_help_inc_plugins(my_long_options, long_options);
81+
82 }
83
84-
85 /**
86 Initialize all Drizzle global variables to default values.
87
88@@ -1758,7 +1766,7 @@
89 internal::convert_dirname(buff,buff,NULL);
90 (void) internal::my_load_path(language,language,buff);
91
92- if (not opt_help and not opt_help_extended)
93+ if (not opt_help and not opt_help_extended and not opt_print_defaults)
94 {
95 char *tmp_string;
96 struct stat buf;
97
98=== modified file 'drizzled/internal/default.cc'
99--- drizzled/internal/default.cc 2010-04-19 19:23:14 +0000
100+++ drizzled/internal/default.cc 2010-09-02 21:51:48 +0000
101@@ -399,7 +399,6 @@
102 {
103 DYNAMIC_ARRAY args;
104 TYPELIB group;
105- bool found_print_defaults= 0;
106 uint32_t args_used= 0;
107 int error= 0;
108 memory::Root alloc(512);
109@@ -464,12 +463,6 @@
110 Check if we wan't to see the new argument list
111 This options must always be the last of the default options
112 */
113- if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
114- {
115- found_print_defaults=1;
116- --*argc; ++*argv; /* skip argument */
117- }
118-
119 if (*argc)
120 memcpy(res+1+args.elements, *argv + 1, (*argc-1)*sizeof(char*));
121 res[args.elements+ *argc]=0; /* last null */
122@@ -478,16 +471,7 @@
123 *argv= static_cast<char**>(res);
124 *(memory::Root*) ptr= alloc; /* Save alloc root for free */
125 delete_dynamic(&args);
126- if (found_print_defaults)
127- {
128- int i;
129- printf("%s would have been started with the following arguments:\n",
130- **argv);
131- for (i=1 ; i < *argc ; i++)
132- printf("%s ", (*argv)[i]);
133- puts("");
134- exit(0);
135- }
136+
137 return(error);
138
139 err:
140@@ -952,7 +936,6 @@
141 }
142 }
143 puts("\nThe following options may be given as the first argument:\n\
144- --print-defaults Print the program argument list and exit\n\
145 --no-defaults Don't read default options from any options file\n\
146 --defaults-file=# Only read default options from the given file #\n\
147 --defaults-extra-file=# Read this file after the global files are read");
148
149=== modified file 'drizzled/module/loader.cc'
150--- drizzled/module/loader.cc 2010-08-29 18:01:19 +0000
151+++ drizzled/module/loader.cc 2010-09-02 21:51:48 +0000
152@@ -79,6 +79,8 @@
153 const char *opt_plugin_load_default= PANDORA_PLUGIN_LIST;
154 const char *builtin_plugins= PANDORA_BUILTIN_LIST;
155
156+extern bool opt_print_defaults;
157+
158 /* Note that 'int version' must be the first field of every plugin
159 sub-structure (plugin->info).
160 */
161@@ -1820,9 +1822,15 @@
162 /* main_options now points to the empty option terminator */
163 all_options.push_back(*main_options);
164
165- my_print_help(&*(all_options.begin()));
166- cout << long_options << endl;
167- my_print_variables(&*(all_options.begin()));
168+ if (!opt_print_defaults)
169+ {
170+ my_print_help(&*(all_options.begin()));
171+ cout << long_options << endl;
172+ }
173+ else
174+ {
175+ my_print_variables(&*(all_options.begin()));
176+ }
177
178 mem_root.free_root(MYF(0));
179 }
180
181=== modified file 'tests/test-run.pl'
182--- tests/test-run.pl 2010-08-30 22:11:56 +0000
183+++ tests/test-run.pl 2010-09-02 21:51:48 +0000
184@@ -1177,7 +1177,7 @@
185 #
186 # --datadir must exist, mysqld will chdir into it
187 #
188- my $list= `$exe_drizzled --no-defaults --datadir=$tmpdir --skip-grant-tables --verbose --help`;
189+ my $list= `$exe_drizzled --no-defaults --datadir=$tmpdir --skip-grant-tables --print-defaults`;
190
191 foreach my $line (split('\n', $list))
192 {