Merge lp:~percona-toolkit-dev/percona-toolkit/fix-set-vars-bug-1182856 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4

Proposed by Daniel Nichter on 2013-06-25
Status: Merged
Merged at revision: 585
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-set-vars-bug-1182856
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.4
Diff against target: 646 lines (+96/-54)
28 files modified
bin/pt-agent (+2/-2)
bin/pt-align (+2/-2)
bin/pt-archiver (+2/-2)
bin/pt-config-diff (+2/-2)
bin/pt-deadlock-logger (+2/-2)
bin/pt-diskstats (+2/-2)
bin/pt-duplicate-key-checker (+2/-2)
bin/pt-fifo-split (+2/-2)
bin/pt-find (+2/-2)
bin/pt-fingerprint (+2/-2)
bin/pt-fk-error-logger (+2/-2)
bin/pt-heartbeat (+2/-2)
bin/pt-index-usage (+2/-2)
bin/pt-kill (+2/-2)
bin/pt-online-schema-change (+2/-2)
bin/pt-query-digest (+2/-2)
bin/pt-show-grants (+2/-2)
bin/pt-slave-delay (+2/-2)
bin/pt-slave-find (+2/-2)
bin/pt-slave-restart (+2/-2)
bin/pt-table-checksum (+2/-2)
bin/pt-table-sync (+2/-2)
bin/pt-table-usage (+2/-2)
bin/pt-upgrade (+2/-2)
bin/pt-variable-advisor (+2/-2)
bin/pt-visual-explain (+2/-2)
lib/OptionParser.pm (+2/-2)
t/lib/OptionParser.t (+42/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-set-vars-bug-1182856
Reviewer Review Type Date Requested Status
Daniel Nichter Approve on 2013-06-25
Review via email: mp+171429@code.launchpad.net
To post a comment you must log in.
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-agent'
2--- bin/pt-agent 2013-06-17 07:08:46 +0000
3+++ bin/pt-agent 2013-06-25 22:36:25 +0000
4@@ -3560,7 +3560,7 @@
5 if ( $user_vars ) {
6 foreach my $var_val ( @$user_vars ) {
7 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
8- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
9+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
10 $user_vars{$var} = {
11 val => $val,
12 default => 0,
13@@ -3574,7 +3574,7 @@
14 %default_vars = map {
15 my $var_val = $_;
16 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
17- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
18+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
19 $var => {
20 val => $val,
21 default => 1,
22
23=== modified file 'bin/pt-align'
24--- bin/pt-align 2013-06-17 07:08:46 +0000
25+++ bin/pt-align 2013-06-25 22:36:25 +0000
26@@ -1028,7 +1028,7 @@
27 if ( $user_vars ) {
28 foreach my $var_val ( @$user_vars ) {
29 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
30- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
31+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
32 $user_vars{$var} = {
33 val => $val,
34 default => 0,
35@@ -1042,7 +1042,7 @@
36 %default_vars = map {
37 my $var_val = $_;
38 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
39- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
40+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
41 $var => {
42 val => $val,
43 default => 1,
44
45=== modified file 'bin/pt-archiver'
46--- bin/pt-archiver 2013-06-17 07:08:46 +0000
47+++ bin/pt-archiver 2013-06-25 22:36:25 +0000
48@@ -1755,7 +1755,7 @@
49 if ( $user_vars ) {
50 foreach my $var_val ( @$user_vars ) {
51 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
52- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
53+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
54 $user_vars{$var} = {
55 val => $val,
56 default => 0,
57@@ -1769,7 +1769,7 @@
58 %default_vars = map {
59 my $var_val = $_;
60 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
61- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
62+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
63 $var => {
64 val => $val,
65 default => 1,
66
67=== modified file 'bin/pt-config-diff'
68--- bin/pt-config-diff 2013-06-17 07:08:46 +0000
69+++ bin/pt-config-diff 2013-06-25 22:36:25 +0000
70@@ -1755,7 +1755,7 @@
71 if ( $user_vars ) {
72 foreach my $var_val ( @$user_vars ) {
73 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
74- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
75+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
76 $user_vars{$var} = {
77 val => $val,
78 default => 0,
79@@ -1769,7 +1769,7 @@
80 %default_vars = map {
81 my $var_val = $_;
82 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
83- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
84+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
85 $var => {
86 val => $val,
87 default => 1,
88
89=== modified file 'bin/pt-deadlock-logger'
90--- bin/pt-deadlock-logger 2013-06-17 07:08:46 +0000
91+++ bin/pt-deadlock-logger 2013-06-25 22:36:25 +0000
92@@ -1105,7 +1105,7 @@
93 if ( $user_vars ) {
94 foreach my $var_val ( @$user_vars ) {
95 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
96- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
97+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
98 $user_vars{$var} = {
99 val => $val,
100 default => 0,
101@@ -1119,7 +1119,7 @@
102 %default_vars = map {
103 my $var_val = $_;
104 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
105- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
106+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
107 $var => {
108 val => $val,
109 default => 1,
110
111=== modified file 'bin/pt-diskstats'
112--- bin/pt-diskstats 2013-06-17 07:08:46 +0000
113+++ bin/pt-diskstats 2013-06-25 22:36:25 +0000
114@@ -1101,7 +1101,7 @@
115 if ( $user_vars ) {
116 foreach my $var_val ( @$user_vars ) {
117 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
118- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
119+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
120 $user_vars{$var} = {
121 val => $val,
122 default => 0,
123@@ -1115,7 +1115,7 @@
124 %default_vars = map {
125 my $var_val = $_;
126 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
127- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
128+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
129 $var => {
130 val => $val,
131 default => 1,
132
133=== modified file 'bin/pt-duplicate-key-checker'
134--- bin/pt-duplicate-key-checker 2013-06-17 07:08:46 +0000
135+++ bin/pt-duplicate-key-checker 2013-06-25 22:36:25 +0000
136@@ -2087,7 +2087,7 @@
137 if ( $user_vars ) {
138 foreach my $var_val ( @$user_vars ) {
139 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
140- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
141+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
142 $user_vars{$var} = {
143 val => $val,
144 default => 0,
145@@ -2101,7 +2101,7 @@
146 %default_vars = map {
147 my $var_val = $_;
148 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
149- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
150+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
151 $var => {
152 val => $val,
153 default => 1,
154
155=== modified file 'bin/pt-fifo-split'
156--- bin/pt-fifo-split 2013-06-17 07:08:46 +0000
157+++ bin/pt-fifo-split 2013-06-25 22:36:25 +0000
158@@ -1029,7 +1029,7 @@
159 if ( $user_vars ) {
160 foreach my $var_val ( @$user_vars ) {
161 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
162- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
163+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
164 $user_vars{$var} = {
165 val => $val,
166 default => 0,
167@@ -1043,7 +1043,7 @@
168 %default_vars = map {
169 my $var_val = $_;
170 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
171- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
172+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
173 $var => {
174 val => $val,
175 default => 1,
176
177=== modified file 'bin/pt-find'
178--- bin/pt-find 2013-06-17 07:08:46 +0000
179+++ bin/pt-find 2013-06-25 22:36:25 +0000
180@@ -1521,7 +1521,7 @@
181 if ( $user_vars ) {
182 foreach my $var_val ( @$user_vars ) {
183 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
184- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
185+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
186 $user_vars{$var} = {
187 val => $val,
188 default => 0,
189@@ -1535,7 +1535,7 @@
190 %default_vars = map {
191 my $var_val = $_;
192 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
193- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
194+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
195 $var => {
196 val => $val,
197 default => 1,
198
199=== modified file 'bin/pt-fingerprint'
200--- bin/pt-fingerprint 2013-06-17 07:08:46 +0000
201+++ bin/pt-fingerprint 2013-06-25 22:36:25 +0000
202@@ -1030,7 +1030,7 @@
203 if ( $user_vars ) {
204 foreach my $var_val ( @$user_vars ) {
205 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
206- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
207+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
208 $user_vars{$var} = {
209 val => $val,
210 default => 0,
211@@ -1044,7 +1044,7 @@
212 %default_vars = map {
213 my $var_val = $_;
214 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
215- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
216+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
217 $var => {
218 val => $val,
219 default => 1,
220
221=== modified file 'bin/pt-fk-error-logger'
222--- bin/pt-fk-error-logger 2013-06-17 07:08:46 +0000
223+++ bin/pt-fk-error-logger 2013-06-25 22:36:25 +0000
224@@ -1100,7 +1100,7 @@
225 if ( $user_vars ) {
226 foreach my $var_val ( @$user_vars ) {
227 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
228- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
229+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
230 $user_vars{$var} = {
231 val => $val,
232 default => 0,
233@@ -1114,7 +1114,7 @@
234 %default_vars = map {
235 my $var_val = $_;
236 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
237- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
238+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
239 $var => {
240 val => $val,
241 default => 1,
242
243=== modified file 'bin/pt-heartbeat'
244--- bin/pt-heartbeat 2013-06-17 07:08:46 +0000
245+++ bin/pt-heartbeat 2013-06-25 22:36:25 +0000
246@@ -1837,7 +1837,7 @@
247 if ( $user_vars ) {
248 foreach my $var_val ( @$user_vars ) {
249 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
250- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
251+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
252 $user_vars{$var} = {
253 val => $val,
254 default => 0,
255@@ -1851,7 +1851,7 @@
256 %default_vars = map {
257 my $var_val = $_;
258 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
259- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
260+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
261 $var => {
262 val => $val,
263 default => 1,
264
265=== modified file 'bin/pt-index-usage'
266--- bin/pt-index-usage 2013-06-17 07:08:46 +0000
267+++ bin/pt-index-usage 2013-06-25 22:36:25 +0000
268@@ -1682,7 +1682,7 @@
269 if ( $user_vars ) {
270 foreach my $var_val ( @$user_vars ) {
271 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
272- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
273+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
274 $user_vars{$var} = {
275 val => $val,
276 default => 0,
277@@ -1696,7 +1696,7 @@
278 %default_vars = map {
279 my $var_val = $_;
280 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
281- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
282+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
283 $var => {
284 val => $val,
285 default => 1,
286
287=== modified file 'bin/pt-kill'
288--- bin/pt-kill 2013-06-17 07:08:46 +0000
289+++ bin/pt-kill 2013-06-25 22:36:25 +0000
290@@ -1110,7 +1110,7 @@
291 if ( $user_vars ) {
292 foreach my $var_val ( @$user_vars ) {
293 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
294- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
295+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
296 $user_vars{$var} = {
297 val => $val,
298 default => 0,
299@@ -1124,7 +1124,7 @@
300 %default_vars = map {
301 my $var_val = $_;
302 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
303- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
304+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
305 $var => {
306 val => $val,
307 default => 1,
308
309=== modified file 'bin/pt-online-schema-change'
310--- bin/pt-online-schema-change 2013-06-25 19:52:03 +0000
311+++ bin/pt-online-schema-change 2013-06-25 22:36:25 +0000
312@@ -1117,7 +1117,7 @@
313 if ( $user_vars ) {
314 foreach my $var_val ( @$user_vars ) {
315 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
316- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
317+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
318 $user_vars{$var} = {
319 val => $val,
320 default => 0,
321@@ -1131,7 +1131,7 @@
322 %default_vars = map {
323 my $var_val = $_;
324 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
325- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
326+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
327 $var => {
328 val => $val,
329 default => 1,
330
331=== modified file 'bin/pt-query-digest'
332--- bin/pt-query-digest 2013-06-17 07:08:46 +0000
333+++ bin/pt-query-digest 2013-06-25 22:36:25 +0000
334@@ -2350,7 +2350,7 @@
335 if ( $user_vars ) {
336 foreach my $var_val ( @$user_vars ) {
337 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
338- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
339+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
340 $user_vars{$var} = {
341 val => $val,
342 default => 0,
343@@ -2364,7 +2364,7 @@
344 %default_vars = map {
345 my $var_val = $_;
346 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
347- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
348+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
349 $var => {
350 val => $val,
351 default => 1,
352
353=== modified file 'bin/pt-show-grants'
354--- bin/pt-show-grants 2013-06-17 07:08:46 +0000
355+++ bin/pt-show-grants 2013-06-25 22:36:25 +0000
356@@ -1030,7 +1030,7 @@
357 if ( $user_vars ) {
358 foreach my $var_val ( @$user_vars ) {
359 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
360- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
361+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
362 $user_vars{$var} = {
363 val => $val,
364 default => 0,
365@@ -1044,7 +1044,7 @@
366 %default_vars = map {
367 my $var_val = $_;
368 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
369- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
370+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
371 $var => {
372 val => $val,
373 default => 1,
374
375=== modified file 'bin/pt-slave-delay'
376--- bin/pt-slave-delay 2013-06-17 07:08:46 +0000
377+++ bin/pt-slave-delay 2013-06-25 22:36:25 +0000
378@@ -1103,7 +1103,7 @@
379 if ( $user_vars ) {
380 foreach my $var_val ( @$user_vars ) {
381 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
382- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
383+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
384 $user_vars{$var} = {
385 val => $val,
386 default => 0,
387@@ -1117,7 +1117,7 @@
388 %default_vars = map {
389 my $var_val = $_;
390 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
391- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
392+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
393 $var => {
394 val => $val,
395 default => 1,
396
397=== modified file 'bin/pt-slave-find'
398--- bin/pt-slave-find 2013-06-17 07:08:46 +0000
399+++ bin/pt-slave-find 2013-06-25 22:36:25 +0000
400@@ -1038,7 +1038,7 @@
401 if ( $user_vars ) {
402 foreach my $var_val ( @$user_vars ) {
403 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
404- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
405+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
406 $user_vars{$var} = {
407 val => $val,
408 default => 0,
409@@ -1052,7 +1052,7 @@
410 %default_vars = map {
411 my $var_val = $_;
412 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
413- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
414+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
415 $var => {
416 val => $val,
417 default => 1,
418
419=== modified file 'bin/pt-slave-restart'
420--- bin/pt-slave-restart 2013-06-17 07:08:46 +0000
421+++ bin/pt-slave-restart 2013-06-25 22:36:25 +0000
422@@ -1255,7 +1255,7 @@
423 if ( $user_vars ) {
424 foreach my $var_val ( @$user_vars ) {
425 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
426- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
427+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
428 $user_vars{$var} = {
429 val => $val,
430 default => 0,
431@@ -1269,7 +1269,7 @@
432 %default_vars = map {
433 my $var_val = $_;
434 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
435- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
436+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
437 $var => {
438 val => $val,
439 default => 1,
440
441=== modified file 'bin/pt-table-checksum'
442--- bin/pt-table-checksum 2013-06-17 07:08:46 +0000
443+++ bin/pt-table-checksum 2013-06-25 22:36:25 +0000
444@@ -2784,7 +2784,7 @@
445 if ( $user_vars ) {
446 foreach my $var_val ( @$user_vars ) {
447 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
448- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
449+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
450 $user_vars{$var} = {
451 val => $val,
452 default => 0,
453@@ -2798,7 +2798,7 @@
454 %default_vars = map {
455 my $var_val = $_;
456 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
457- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
458+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
459 $var => {
460 val => $val,
461 default => 1,
462
463=== modified file 'bin/pt-table-sync'
464--- bin/pt-table-sync 2013-06-17 07:08:46 +0000
465+++ bin/pt-table-sync 2013-06-25 22:36:25 +0000
466@@ -1118,7 +1118,7 @@
467 if ( $user_vars ) {
468 foreach my $var_val ( @$user_vars ) {
469 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
470- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
471+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
472 $user_vars{$var} = {
473 val => $val,
474 default => 0,
475@@ -1132,7 +1132,7 @@
476 %default_vars = map {
477 my $var_val = $_;
478 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
479- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
480+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
481 $var => {
482 val => $val,
483 default => 1,
484
485=== modified file 'bin/pt-table-usage'
486--- bin/pt-table-usage 2013-06-17 07:08:46 +0000
487+++ bin/pt-table-usage 2013-06-25 22:36:25 +0000
488@@ -1467,7 +1467,7 @@
489 if ( $user_vars ) {
490 foreach my $var_val ( @$user_vars ) {
491 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
492- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
493+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
494 $user_vars{$var} = {
495 val => $val,
496 default => 0,
497@@ -1481,7 +1481,7 @@
498 %default_vars = map {
499 my $var_val = $_;
500 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
501- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
502+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
503 $var => {
504 val => $val,
505 default => 1,
506
507=== modified file 'bin/pt-upgrade'
508--- bin/pt-upgrade 2013-06-17 07:08:46 +0000
509+++ bin/pt-upgrade 2013-06-25 22:36:25 +0000
510@@ -2347,7 +2347,7 @@
511 if ( $user_vars ) {
512 foreach my $var_val ( @$user_vars ) {
513 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
514- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
515+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
516 $user_vars{$var} = {
517 val => $val,
518 default => 0,
519@@ -2361,7 +2361,7 @@
520 %default_vars = map {
521 my $var_val = $_;
522 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
523- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
524+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
525 $var => {
526 val => $val,
527 default => 1,
528
529=== modified file 'bin/pt-variable-advisor'
530--- bin/pt-variable-advisor 2013-06-17 07:08:46 +0000
531+++ bin/pt-variable-advisor 2013-06-25 22:36:25 +0000
532@@ -1107,7 +1107,7 @@
533 if ( $user_vars ) {
534 foreach my $var_val ( @$user_vars ) {
535 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
536- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
537+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
538 $user_vars{$var} = {
539 val => $val,
540 default => 0,
541@@ -1121,7 +1121,7 @@
542 %default_vars = map {
543 my $var_val = $_;
544 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
545- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
546+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
547 $var => {
548 val => $val,
549 default => 1,
550
551=== modified file 'bin/pt-visual-explain'
552--- bin/pt-visual-explain 2013-06-17 07:08:46 +0000
553+++ bin/pt-visual-explain 2013-06-25 22:36:25 +0000
554@@ -1704,7 +1704,7 @@
555 if ( $user_vars ) {
556 foreach my $var_val ( @$user_vars ) {
557 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
558- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
559+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
560 $user_vars{$var} = {
561 val => $val,
562 default => 0,
563@@ -1718,7 +1718,7 @@
564 %default_vars = map {
565 my $var_val = $_;
566 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
567- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
568+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
569 $var => {
570 val => $val,
571 default => 1,
572
573=== modified file 'lib/OptionParser.pm'
574--- lib/OptionParser.pm 2013-02-28 01:47:00 +0000
575+++ lib/OptionParser.pm 2013-06-25 22:36:25 +0000
576@@ -1289,7 +1289,7 @@
577 if ( $user_vars ) {
578 foreach my $var_val ( @$user_vars ) {
579 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
580- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
581+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
582 $user_vars{$var} = {
583 val => $val,
584 default => 0,
585@@ -1303,7 +1303,7 @@
586 %default_vars = map {
587 my $var_val = $_;
588 my ($var, $val) = $var_val =~ m/([^\s=]+)=(\S+)/;
589- die "Invalid --set-vars value: $var_val\n" unless $var && $val;
590+ die "Invalid --set-vars value: $var_val\n" unless $var && defined $val;
591 $var => {
592 val => $val,
593 default => 1,
594
595=== modified file 't/lib/OptionParser.t'
596--- t/lib/OptionParser.t 2013-03-13 18:38:45 +0000
597+++ t/lib/OptionParser.t 2013-06-25 22:36:25 +0000
598@@ -2021,6 +2021,48 @@
599 "Non-zero exit status on error parsing options (bug 1039074)"
600 );
601
602+
603+# #############################################################################
604+# --set-vars/set_vars()
605+# #############################################################################
606+
607+@ARGV = qw();
608+$o = new OptionParser(file => "$trunk/bin/pt-archiver");
609+$o->get_specs();
610+$o->get_opts();
611+
612+my $vars = $o->set_vars("$trunk/bin/pt-archiver");
613+is_deeply(
614+ $vars,
615+ {
616+ wait_timeout => {
617+ default => 1,
618+ val => '10000',
619+ },
620+ },
621+ "set_vars(): 1 default from docs"
622+) or diag(Dumper($vars));
623+
624+# Bug 1182856: Zero values causes "Invalid --set-vars value: var=0"
625+@ARGV = qw(--set-vars SQL_LOG_BIN=0);
626+$o->get_opts();
627+
628+$vars = $o->set_vars("$trunk/bin/pt-archiver");
629+is_deeply(
630+ $vars,
631+ {
632+ wait_timeout => {
633+ default => 1,
634+ val => '10000',
635+ },
636+ SQL_LOG_BIN => {
637+ default => 0,
638+ val => '0',
639+ },
640+ },
641+ "set_vars(): var=0 (bug 1182856)"
642+) or diag(Dumper($vars));
643+
644 # #############################################################################
645 # Done.
646 # #############################################################################

Subscribers

People subscribed via source and target branches

to all changes: