Merge lp:~percona-toolkit-dev/percona-toolkit/opt-parsing-exit-status-bug-1039074 into lp:percona-toolkit/2.1
- opt-parsing-exit-status-bug-1039074
- Merge into 2.1
Proposed by
Daniel Nichter
Status: | Merged |
---|---|
Merged at revision: | 425 |
Proposed branch: | lp:~percona-toolkit-dev/percona-toolkit/opt-parsing-exit-status-bug-1039074 |
Merge into: | lp:percona-toolkit/2.1 |
Diff against target: |
815 lines (+124/-70) 31 files modified
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-log-player (+2/-2) bin/pt-online-schema-change (+2/-2) bin/pt-query-advisor (+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 (+10/-7) bin/pt-tcp-model (+2/-2) bin/pt-trend (+2/-2) bin/pt-upgrade (+2/-2) bin/pt-variable-advisor (+2/-2) bin/pt-visual-explain (+24/-8) lib/OptionParser.pm (+2/-2) t/lib/OptionParser.t (+22/-0) t/pt-deadlock-logger/option_sanity.t (+14/-1) |
To merge this branch: | bzr merge lp:~percona-toolkit-dev/percona-toolkit/opt-parsing-exit-status-bug-1039074 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Nichter | Approve | ||
Review via email: mp+130872@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/pt-archiver' | |||
2 | --- bin/pt-archiver 2012-10-20 23:59:28 +0000 | |||
3 | +++ bin/pt-archiver 2012-10-22 18:26:45 +0000 | |||
4 | @@ -524,7 +524,7 @@ | |||
5 | 524 | else { | 524 | else { |
6 | 525 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 525 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
7 | 526 | } | 526 | } |
9 | 527 | exit 0; | 527 | exit 1; |
10 | 528 | } | 528 | } |
11 | 529 | 529 | ||
12 | 530 | if ( @ARGV && $self->{strict} ) { | 530 | if ( @ARGV && $self->{strict} ) { |
13 | @@ -779,7 +779,7 @@ | |||
14 | 779 | } | 779 | } |
15 | 780 | elsif ( scalar @{$self->{errors}} ) { | 780 | elsif ( scalar @{$self->{errors}} ) { |
16 | 781 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 781 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
18 | 782 | exit 0 unless $return; | 782 | exit 1 unless $return; |
19 | 783 | } | 783 | } |
20 | 784 | 784 | ||
21 | 785 | return; | 785 | return; |
22 | 786 | 786 | ||
23 | === modified file 'bin/pt-config-diff' | |||
24 | --- bin/pt-config-diff 2012-10-20 23:59:28 +0000 | |||
25 | +++ bin/pt-config-diff 2012-10-22 18:26:45 +0000 | |||
26 | @@ -523,7 +523,7 @@ | |||
27 | 523 | else { | 523 | else { |
28 | 524 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 524 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
29 | 525 | } | 525 | } |
31 | 526 | exit 0; | 526 | exit 1; |
32 | 527 | } | 527 | } |
33 | 528 | 528 | ||
34 | 529 | if ( @ARGV && $self->{strict} ) { | 529 | if ( @ARGV && $self->{strict} ) { |
35 | @@ -778,7 +778,7 @@ | |||
36 | 778 | } | 778 | } |
37 | 779 | elsif ( scalar @{$self->{errors}} ) { | 779 | elsif ( scalar @{$self->{errors}} ) { |
38 | 780 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 780 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
40 | 781 | exit 0 unless $return; | 781 | exit 1 unless $return; |
41 | 782 | } | 782 | } |
42 | 783 | 783 | ||
43 | 784 | return; | 784 | return; |
44 | 785 | 785 | ||
45 | === modified file 'bin/pt-deadlock-logger' | |||
46 | --- bin/pt-deadlock-logger 2012-10-20 23:59:28 +0000 | |||
47 | +++ bin/pt-deadlock-logger 2012-10-22 18:26:45 +0000 | |||
48 | @@ -521,7 +521,7 @@ | |||
49 | 521 | else { | 521 | else { |
50 | 522 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 522 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
51 | 523 | } | 523 | } |
53 | 524 | exit 0; | 524 | exit 1; |
54 | 525 | } | 525 | } |
55 | 526 | 526 | ||
56 | 527 | if ( @ARGV && $self->{strict} ) { | 527 | if ( @ARGV && $self->{strict} ) { |
57 | @@ -776,7 +776,7 @@ | |||
58 | 776 | } | 776 | } |
59 | 777 | elsif ( scalar @{$self->{errors}} ) { | 777 | elsif ( scalar @{$self->{errors}} ) { |
60 | 778 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 778 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
62 | 779 | exit 0 unless $return; | 779 | exit 1 unless $return; |
63 | 780 | } | 780 | } |
64 | 781 | 781 | ||
65 | 782 | return; | 782 | return; |
66 | 783 | 783 | ||
67 | === modified file 'bin/pt-diskstats' | |||
68 | --- bin/pt-diskstats 2012-10-20 23:59:28 +0000 | |||
69 | +++ bin/pt-diskstats 2012-10-22 18:26:45 +0000 | |||
70 | @@ -523,7 +523,7 @@ | |||
71 | 523 | else { | 523 | else { |
72 | 524 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 524 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
73 | 525 | } | 525 | } |
75 | 526 | exit 0; | 526 | exit 1; |
76 | 527 | } | 527 | } |
77 | 528 | 528 | ||
78 | 529 | if ( @ARGV && $self->{strict} ) { | 529 | if ( @ARGV && $self->{strict} ) { |
79 | @@ -778,7 +778,7 @@ | |||
80 | 778 | } | 778 | } |
81 | 779 | elsif ( scalar @{$self->{errors}} ) { | 779 | elsif ( scalar @{$self->{errors}} ) { |
82 | 780 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 780 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
84 | 781 | exit 0 unless $return; | 781 | exit 1 unless $return; |
85 | 782 | } | 782 | } |
86 | 783 | 783 | ||
87 | 784 | return; | 784 | return; |
88 | 785 | 785 | ||
89 | === modified file 'bin/pt-duplicate-key-checker' | |||
90 | --- bin/pt-duplicate-key-checker 2012-10-20 23:59:28 +0000 | |||
91 | +++ bin/pt-duplicate-key-checker 2012-10-22 18:26:45 +0000 | |||
92 | @@ -1425,7 +1425,7 @@ | |||
93 | 1425 | else { | 1425 | else { |
94 | 1426 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1426 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
95 | 1427 | } | 1427 | } |
97 | 1428 | exit 0; | 1428 | exit 1; |
98 | 1429 | } | 1429 | } |
99 | 1430 | 1430 | ||
100 | 1431 | if ( @ARGV && $self->{strict} ) { | 1431 | if ( @ARGV && $self->{strict} ) { |
101 | @@ -1680,7 +1680,7 @@ | |||
102 | 1680 | } | 1680 | } |
103 | 1681 | elsif ( scalar @{$self->{errors}} ) { | 1681 | elsif ( scalar @{$self->{errors}} ) { |
104 | 1682 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1682 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
106 | 1683 | exit 0 unless $return; | 1683 | exit 1 unless $return; |
107 | 1684 | } | 1684 | } |
108 | 1685 | 1685 | ||
109 | 1686 | return; | 1686 | return; |
110 | 1687 | 1687 | ||
111 | === modified file 'bin/pt-fifo-split' | |||
112 | --- bin/pt-fifo-split 2012-10-08 21:02:17 +0000 | |||
113 | +++ bin/pt-fifo-split 2012-10-22 18:26:45 +0000 | |||
114 | @@ -495,7 +495,7 @@ | |||
115 | 495 | else { | 495 | else { |
116 | 496 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 496 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
117 | 497 | } | 497 | } |
119 | 498 | exit 0; | 498 | exit 1; |
120 | 499 | } | 499 | } |
121 | 500 | 500 | ||
122 | 501 | if ( @ARGV && $self->{strict} ) { | 501 | if ( @ARGV && $self->{strict} ) { |
123 | @@ -750,7 +750,7 @@ | |||
124 | 750 | } | 750 | } |
125 | 751 | elsif ( scalar @{$self->{errors}} ) { | 751 | elsif ( scalar @{$self->{errors}} ) { |
126 | 752 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 752 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
128 | 753 | exit 0 unless $return; | 753 | exit 1 unless $return; |
129 | 754 | } | 754 | } |
130 | 755 | 755 | ||
131 | 756 | return; | 756 | return; |
132 | 757 | 757 | ||
133 | === modified file 'bin/pt-find' | |||
134 | --- bin/pt-find 2012-10-20 23:59:28 +0000 | |||
135 | +++ bin/pt-find 2012-10-22 18:26:45 +0000 | |||
136 | @@ -893,7 +893,7 @@ | |||
137 | 893 | else { | 893 | else { |
138 | 894 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 894 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
139 | 895 | } | 895 | } |
141 | 896 | exit 0; | 896 | exit 1; |
142 | 897 | } | 897 | } |
143 | 898 | 898 | ||
144 | 899 | if ( @ARGV && $self->{strict} ) { | 899 | if ( @ARGV && $self->{strict} ) { |
145 | @@ -1148,7 +1148,7 @@ | |||
146 | 1148 | } | 1148 | } |
147 | 1149 | elsif ( scalar @{$self->{errors}} ) { | 1149 | elsif ( scalar @{$self->{errors}} ) { |
148 | 1150 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1150 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
150 | 1151 | exit 0 unless $return; | 1151 | exit 1 unless $return; |
151 | 1152 | } | 1152 | } |
152 | 1153 | 1153 | ||
153 | 1154 | return; | 1154 | return; |
154 | 1155 | 1155 | ||
155 | === modified file 'bin/pt-fingerprint' | |||
156 | --- bin/pt-fingerprint 2012-10-08 21:02:17 +0000 | |||
157 | +++ bin/pt-fingerprint 2012-10-22 18:26:45 +0000 | |||
158 | @@ -496,7 +496,7 @@ | |||
159 | 496 | else { | 496 | else { |
160 | 497 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 497 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
161 | 498 | } | 498 | } |
163 | 499 | exit 0; | 499 | exit 1; |
164 | 500 | } | 500 | } |
165 | 501 | 501 | ||
166 | 502 | if ( @ARGV && $self->{strict} ) { | 502 | if ( @ARGV && $self->{strict} ) { |
167 | @@ -751,7 +751,7 @@ | |||
168 | 751 | } | 751 | } |
169 | 752 | elsif ( scalar @{$self->{errors}} ) { | 752 | elsif ( scalar @{$self->{errors}} ) { |
170 | 753 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 753 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
172 | 754 | exit 0 unless $return; | 754 | exit 1 unless $return; |
173 | 755 | } | 755 | } |
174 | 756 | 756 | ||
175 | 757 | return; | 757 | return; |
176 | 758 | 758 | ||
177 | === modified file 'bin/pt-fk-error-logger' | |||
178 | --- bin/pt-fk-error-logger 2012-10-20 23:59:28 +0000 | |||
179 | +++ bin/pt-fk-error-logger 2012-10-22 18:26:45 +0000 | |||
180 | @@ -520,7 +520,7 @@ | |||
181 | 520 | else { | 520 | else { |
182 | 521 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 521 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
183 | 522 | } | 522 | } |
185 | 523 | exit 0; | 523 | exit 1; |
186 | 524 | } | 524 | } |
187 | 525 | 525 | ||
188 | 526 | if ( @ARGV && $self->{strict} ) { | 526 | if ( @ARGV && $self->{strict} ) { |
189 | @@ -775,7 +775,7 @@ | |||
190 | 775 | } | 775 | } |
191 | 776 | elsif ( scalar @{$self->{errors}} ) { | 776 | elsif ( scalar @{$self->{errors}} ) { |
192 | 777 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 777 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
194 | 778 | exit 0 unless $return; | 778 | exit 1 unless $return; |
195 | 779 | } | 779 | } |
196 | 780 | 780 | ||
197 | 781 | return; | 781 | return; |
198 | 782 | 782 | ||
199 | === modified file 'bin/pt-heartbeat' | |||
200 | --- bin/pt-heartbeat 2012-10-20 23:59:28 +0000 | |||
201 | +++ bin/pt-heartbeat 2012-10-22 18:26:45 +0000 | |||
202 | @@ -1256,7 +1256,7 @@ | |||
203 | 1256 | else { | 1256 | else { |
204 | 1257 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1257 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
205 | 1258 | } | 1258 | } |
207 | 1259 | exit 0; | 1259 | exit 1; |
208 | 1260 | } | 1260 | } |
209 | 1261 | 1261 | ||
210 | 1262 | if ( @ARGV && $self->{strict} ) { | 1262 | if ( @ARGV && $self->{strict} ) { |
211 | @@ -1511,7 +1511,7 @@ | |||
212 | 1511 | } | 1511 | } |
213 | 1512 | elsif ( scalar @{$self->{errors}} ) { | 1512 | elsif ( scalar @{$self->{errors}} ) { |
214 | 1513 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1513 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
216 | 1514 | exit 0 unless $return; | 1514 | exit 1 unless $return; |
217 | 1515 | } | 1515 | } |
218 | 1516 | 1516 | ||
219 | 1517 | return; | 1517 | return; |
220 | 1518 | 1518 | ||
221 | === modified file 'bin/pt-index-usage' | |||
222 | --- bin/pt-index-usage 2012-10-20 23:59:28 +0000 | |||
223 | +++ bin/pt-index-usage 2012-10-22 18:26:45 +0000 | |||
224 | @@ -1023,7 +1023,7 @@ | |||
225 | 1023 | else { | 1023 | else { |
226 | 1024 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1024 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
227 | 1025 | } | 1025 | } |
229 | 1026 | exit 0; | 1026 | exit 1; |
230 | 1027 | } | 1027 | } |
231 | 1028 | 1028 | ||
232 | 1029 | if ( @ARGV && $self->{strict} ) { | 1029 | if ( @ARGV && $self->{strict} ) { |
233 | @@ -1278,7 +1278,7 @@ | |||
234 | 1278 | } | 1278 | } |
235 | 1279 | elsif ( scalar @{$self->{errors}} ) { | 1279 | elsif ( scalar @{$self->{errors}} ) { |
236 | 1280 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1280 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
238 | 1281 | exit 0 unless $return; | 1281 | exit 1 unless $return; |
239 | 1282 | } | 1282 | } |
240 | 1283 | 1283 | ||
241 | 1284 | return; | 1284 | return; |
242 | 1285 | 1285 | ||
243 | === modified file 'bin/pt-kill' | |||
244 | --- bin/pt-kill 2012-10-20 23:59:28 +0000 | |||
245 | +++ bin/pt-kill 2012-10-22 18:26:45 +0000 | |||
246 | @@ -528,7 +528,7 @@ | |||
247 | 528 | else { | 528 | else { |
248 | 529 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 529 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
249 | 530 | } | 530 | } |
251 | 531 | exit 0; | 531 | exit 1; |
252 | 532 | } | 532 | } |
253 | 533 | 533 | ||
254 | 534 | if ( @ARGV && $self->{strict} ) { | 534 | if ( @ARGV && $self->{strict} ) { |
255 | @@ -783,7 +783,7 @@ | |||
256 | 783 | } | 783 | } |
257 | 784 | elsif ( scalar @{$self->{errors}} ) { | 784 | elsif ( scalar @{$self->{errors}} ) { |
258 | 785 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 785 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
260 | 786 | exit 0 unless $return; | 786 | exit 1 unless $return; |
261 | 787 | } | 787 | } |
262 | 788 | 788 | ||
263 | 789 | return; | 789 | return; |
264 | 790 | 790 | ||
265 | === modified file 'bin/pt-log-player' | |||
266 | --- bin/pt-log-player 2012-10-08 21:02:17 +0000 | |||
267 | +++ bin/pt-log-player 2012-10-22 18:26:45 +0000 | |||
268 | @@ -500,7 +500,7 @@ | |||
269 | 500 | else { | 500 | else { |
270 | 501 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 501 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
271 | 502 | } | 502 | } |
273 | 503 | exit 0; | 503 | exit 1; |
274 | 504 | } | 504 | } |
275 | 505 | 505 | ||
276 | 506 | if ( @ARGV && $self->{strict} ) { | 506 | if ( @ARGV && $self->{strict} ) { |
277 | @@ -755,7 +755,7 @@ | |||
278 | 755 | } | 755 | } |
279 | 756 | elsif ( scalar @{$self->{errors}} ) { | 756 | elsif ( scalar @{$self->{errors}} ) { |
280 | 757 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 757 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
282 | 758 | exit 0 unless $return; | 758 | exit 1 unless $return; |
283 | 759 | } | 759 | } |
284 | 760 | 760 | ||
285 | 761 | return; | 761 | return; |
286 | 762 | 762 | ||
287 | === modified file 'bin/pt-online-schema-change' | |||
288 | --- bin/pt-online-schema-change 2012-10-22 17:34:52 +0000 | |||
289 | +++ bin/pt-online-schema-change 2012-10-22 18:26:45 +0000 | |||
290 | @@ -534,7 +534,7 @@ | |||
291 | 534 | else { | 534 | else { |
292 | 535 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 535 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
293 | 536 | } | 536 | } |
295 | 537 | exit 0; | 537 | exit 1; |
296 | 538 | } | 538 | } |
297 | 539 | 539 | ||
298 | 540 | if ( @ARGV && $self->{strict} ) { | 540 | if ( @ARGV && $self->{strict} ) { |
299 | @@ -789,7 +789,7 @@ | |||
300 | 789 | } | 789 | } |
301 | 790 | elsif ( scalar @{$self->{errors}} ) { | 790 | elsif ( scalar @{$self->{errors}} ) { |
302 | 791 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 791 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
304 | 792 | exit 0 unless $return; | 792 | exit 1 unless $return; |
305 | 793 | } | 793 | } |
306 | 794 | 794 | ||
307 | 795 | return; | 795 | return; |
308 | 796 | 796 | ||
309 | === modified file 'bin/pt-query-advisor' | |||
310 | --- bin/pt-query-advisor 2012-10-20 23:59:28 +0000 | |||
311 | +++ bin/pt-query-advisor 2012-10-22 18:26:45 +0000 | |||
312 | @@ -904,7 +904,7 @@ | |||
313 | 904 | else { | 904 | else { |
314 | 905 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 905 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
315 | 906 | } | 906 | } |
317 | 907 | exit 0; | 907 | exit 1; |
318 | 908 | } | 908 | } |
319 | 909 | 909 | ||
320 | 910 | if ( @ARGV && $self->{strict} ) { | 910 | if ( @ARGV && $self->{strict} ) { |
321 | @@ -1159,7 +1159,7 @@ | |||
322 | 1159 | } | 1159 | } |
323 | 1160 | elsif ( scalar @{$self->{errors}} ) { | 1160 | elsif ( scalar @{$self->{errors}} ) { |
324 | 1161 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1161 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
326 | 1162 | exit 0 unless $return; | 1162 | exit 1 unless $return; |
327 | 1163 | } | 1163 | } |
328 | 1164 | 1164 | ||
329 | 1165 | return; | 1165 | return; |
330 | 1166 | 1166 | ||
331 | === modified file 'bin/pt-query-digest' | |||
332 | --- bin/pt-query-digest 2012-10-20 23:59:28 +0000 | |||
333 | +++ bin/pt-query-digest 2012-10-22 18:26:45 +0000 | |||
334 | @@ -1042,7 +1042,7 @@ | |||
335 | 1042 | else { | 1042 | else { |
336 | 1043 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1043 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
337 | 1044 | } | 1044 | } |
339 | 1045 | exit 0; | 1045 | exit 1; |
340 | 1046 | } | 1046 | } |
341 | 1047 | 1047 | ||
342 | 1048 | if ( @ARGV && $self->{strict} ) { | 1048 | if ( @ARGV && $self->{strict} ) { |
343 | @@ -1297,7 +1297,7 @@ | |||
344 | 1297 | } | 1297 | } |
345 | 1298 | elsif ( scalar @{$self->{errors}} ) { | 1298 | elsif ( scalar @{$self->{errors}} ) { |
346 | 1299 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1299 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
348 | 1300 | exit 0 unless $return; | 1300 | exit 1 unless $return; |
349 | 1301 | } | 1301 | } |
350 | 1302 | 1302 | ||
351 | 1303 | return; | 1303 | return; |
352 | 1304 | 1304 | ||
353 | === modified file 'bin/pt-show-grants' | |||
354 | --- bin/pt-show-grants 2012-10-08 21:02:17 +0000 | |||
355 | +++ bin/pt-show-grants 2012-10-22 18:26:45 +0000 | |||
356 | @@ -496,7 +496,7 @@ | |||
357 | 496 | else { | 496 | else { |
358 | 497 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 497 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
359 | 498 | } | 498 | } |
361 | 499 | exit 0; | 499 | exit 1; |
362 | 500 | } | 500 | } |
363 | 501 | 501 | ||
364 | 502 | if ( @ARGV && $self->{strict} ) { | 502 | if ( @ARGV && $self->{strict} ) { |
365 | @@ -751,7 +751,7 @@ | |||
366 | 751 | } | 751 | } |
367 | 752 | elsif ( scalar @{$self->{errors}} ) { | 752 | elsif ( scalar @{$self->{errors}} ) { |
368 | 753 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 753 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
370 | 754 | exit 0 unless $return; | 754 | exit 1 unless $return; |
371 | 755 | } | 755 | } |
372 | 756 | 756 | ||
373 | 757 | return; | 757 | return; |
374 | 758 | 758 | ||
375 | === modified file 'bin/pt-slave-delay' | |||
376 | --- bin/pt-slave-delay 2012-10-20 23:59:28 +0000 | |||
377 | +++ bin/pt-slave-delay 2012-10-22 18:26:45 +0000 | |||
378 | @@ -521,7 +521,7 @@ | |||
379 | 521 | else { | 521 | else { |
380 | 522 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 522 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
381 | 523 | } | 523 | } |
383 | 524 | exit 0; | 524 | exit 1; |
384 | 525 | } | 525 | } |
385 | 526 | 526 | ||
386 | 527 | if ( @ARGV && $self->{strict} ) { | 527 | if ( @ARGV && $self->{strict} ) { |
387 | @@ -776,7 +776,7 @@ | |||
388 | 776 | } | 776 | } |
389 | 777 | elsif ( scalar @{$self->{errors}} ) { | 777 | elsif ( scalar @{$self->{errors}} ) { |
390 | 778 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 778 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
392 | 779 | exit 0 unless $return; | 779 | exit 1 unless $return; |
393 | 780 | } | 780 | } |
394 | 781 | 781 | ||
395 | 782 | return; | 782 | return; |
396 | 783 | 783 | ||
397 | === modified file 'bin/pt-slave-find' | |||
398 | --- bin/pt-slave-find 2012-10-08 21:02:17 +0000 | |||
399 | +++ bin/pt-slave-find 2012-10-22 18:26:45 +0000 | |||
400 | @@ -500,7 +500,7 @@ | |||
401 | 500 | else { | 500 | else { |
402 | 501 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 501 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
403 | 502 | } | 502 | } |
405 | 503 | exit 0; | 503 | exit 1; |
406 | 504 | } | 504 | } |
407 | 505 | 505 | ||
408 | 506 | if ( @ARGV && $self->{strict} ) { | 506 | if ( @ARGV && $self->{strict} ) { |
409 | @@ -755,7 +755,7 @@ | |||
410 | 755 | } | 755 | } |
411 | 756 | elsif ( scalar @{$self->{errors}} ) { | 756 | elsif ( scalar @{$self->{errors}} ) { |
412 | 757 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 757 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
414 | 758 | exit 0 unless $return; | 758 | exit 1 unless $return; |
415 | 759 | } | 759 | } |
416 | 760 | 760 | ||
417 | 761 | return; | 761 | return; |
418 | 762 | 762 | ||
419 | === modified file 'bin/pt-slave-restart' | |||
420 | --- bin/pt-slave-restart 2012-10-20 23:59:28 +0000 | |||
421 | +++ bin/pt-slave-restart 2012-10-22 18:26:45 +0000 | |||
422 | @@ -642,7 +642,7 @@ | |||
423 | 642 | else { | 642 | else { |
424 | 643 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 643 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
425 | 644 | } | 644 | } |
427 | 645 | exit 0; | 645 | exit 1; |
428 | 646 | } | 646 | } |
429 | 647 | 647 | ||
430 | 648 | if ( @ARGV && $self->{strict} ) { | 648 | if ( @ARGV && $self->{strict} ) { |
431 | @@ -897,7 +897,7 @@ | |||
432 | 897 | } | 897 | } |
433 | 898 | elsif ( scalar @{$self->{errors}} ) { | 898 | elsif ( scalar @{$self->{errors}} ) { |
434 | 899 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 899 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
436 | 900 | exit 0 unless $return; | 900 | exit 1 unless $return; |
437 | 901 | } | 901 | } |
438 | 902 | 902 | ||
439 | 903 | return; | 903 | return; |
440 | 904 | 904 | ||
441 | === modified file 'bin/pt-table-checksum' | |||
442 | --- bin/pt-table-checksum 2012-10-20 23:59:28 +0000 | |||
443 | +++ bin/pt-table-checksum 2012-10-22 18:26:45 +0000 | |||
444 | @@ -2190,7 +2190,7 @@ | |||
445 | 2190 | else { | 2190 | else { |
446 | 2191 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 2191 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
447 | 2192 | } | 2192 | } |
449 | 2193 | exit 0; | 2193 | exit 1; |
450 | 2194 | } | 2194 | } |
451 | 2195 | 2195 | ||
452 | 2196 | if ( @ARGV && $self->{strict} ) { | 2196 | if ( @ARGV && $self->{strict} ) { |
453 | @@ -2445,7 +2445,7 @@ | |||
454 | 2445 | } | 2445 | } |
455 | 2446 | elsif ( scalar @{$self->{errors}} ) { | 2446 | elsif ( scalar @{$self->{errors}} ) { |
456 | 2447 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 2447 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
458 | 2448 | exit 0 unless $return; | 2448 | exit 1 unless $return; |
459 | 2449 | } | 2449 | } |
460 | 2450 | 2450 | ||
461 | 2451 | return; | 2451 | return; |
462 | 2452 | 2452 | ||
463 | === modified file 'bin/pt-table-sync' | |||
464 | --- bin/pt-table-sync 2012-10-20 23:59:28 +0000 | |||
465 | +++ bin/pt-table-sync 2012-10-22 18:26:45 +0000 | |||
466 | @@ -537,7 +537,7 @@ | |||
467 | 537 | else { | 537 | else { |
468 | 538 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 538 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
469 | 539 | } | 539 | } |
471 | 540 | exit 0; | 540 | exit 1; |
472 | 541 | } | 541 | } |
473 | 542 | 542 | ||
474 | 543 | if ( @ARGV && $self->{strict} ) { | 543 | if ( @ARGV && $self->{strict} ) { |
475 | @@ -792,7 +792,7 @@ | |||
476 | 792 | } | 792 | } |
477 | 793 | elsif ( scalar @{$self->{errors}} ) { | 793 | elsif ( scalar @{$self->{errors}} ) { |
478 | 794 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 794 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
480 | 795 | exit 0 unless $return; | 795 | exit 1 unless $return; |
481 | 796 | } | 796 | } |
482 | 797 | 797 | ||
483 | 798 | return; | 798 | return; |
484 | 799 | 799 | ||
485 | === modified file 'bin/pt-table-usage' | |||
486 | --- bin/pt-table-usage 2012-10-19 23:14:07 +0000 | |||
487 | +++ bin/pt-table-usage 2012-10-22 18:26:45 +0000 | |||
488 | @@ -445,6 +445,7 @@ | |||
489 | 445 | 'default' => 1, | 445 | 'default' => 1, |
490 | 446 | 'cumulative' => 1, | 446 | 'cumulative' => 1, |
491 | 447 | 'negatable' => 1, | 447 | 'negatable' => 1, |
492 | 448 | 'value_is_optional' => 1, | ||
493 | 448 | ); | 449 | ); |
494 | 449 | 450 | ||
495 | 450 | my $self = { | 451 | my $self = { |
496 | @@ -686,9 +687,10 @@ | |||
497 | 686 | $opt->{short} = undef; | 687 | $opt->{short} = undef; |
498 | 687 | } | 688 | } |
499 | 688 | 689 | ||
503 | 689 | $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; | 690 | $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; |
504 | 690 | $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; | 691 | $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; |
505 | 691 | $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; | 692 | $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0; |
506 | 693 | $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; | ||
507 | 692 | 694 | ||
508 | 693 | $opt->{group} ||= 'default'; | 695 | $opt->{group} ||= 'default'; |
509 | 694 | $self->{groups}->{ $opt->{group} }->{$long} = 1; | 696 | $self->{groups}->{ $opt->{group} }->{$long} = 1; |
510 | @@ -824,7 +826,7 @@ | |||
511 | 824 | if ( $opt->{is_cumulative} ) { | 826 | if ( $opt->{is_cumulative} ) { |
512 | 825 | $opt->{value}++; | 827 | $opt->{value}++; |
513 | 826 | } | 828 | } |
515 | 827 | else { | 829 | elsif ( !($opt->{optional_value} && !$val) ) { |
516 | 828 | $opt->{value} = $val; | 830 | $opt->{value} = $val; |
517 | 829 | } | 831 | } |
518 | 830 | $opt->{got} = 1; | 832 | $opt->{got} = 1; |
519 | @@ -881,7 +883,7 @@ | |||
520 | 881 | else { | 883 | else { |
521 | 882 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 884 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
522 | 883 | } | 885 | } |
524 | 884 | exit 0; | 886 | exit 1; |
525 | 885 | } | 887 | } |
526 | 886 | 888 | ||
527 | 887 | if ( @ARGV && $self->{strict} ) { | 889 | if ( @ARGV && $self->{strict} ) { |
528 | @@ -1136,7 +1138,7 @@ | |||
529 | 1136 | } | 1138 | } |
530 | 1137 | elsif ( scalar @{$self->{errors}} ) { | 1139 | elsif ( scalar @{$self->{errors}} ) { |
531 | 1138 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1140 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
533 | 1139 | exit 0 unless $return; | 1141 | exit 1 unless $return; |
534 | 1140 | } | 1142 | } |
535 | 1141 | 1143 | ||
536 | 1142 | return; | 1144 | return; |
537 | @@ -1365,11 +1367,12 @@ | |||
538 | 1365 | sub _parse_attribs { | 1367 | sub _parse_attribs { |
539 | 1366 | my ( $self, $option, $attribs ) = @_; | 1368 | my ( $self, $option, $attribs ) = @_; |
540 | 1367 | my $types = $self->{types}; | 1369 | my $types = $self->{types}; |
541 | 1370 | my $eq = $attribs->{'value_is_optional'} ? ':' : '='; | ||
542 | 1368 | return $option | 1371 | return $option |
543 | 1369 | . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) | 1372 | . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) |
544 | 1370 | . ($attribs->{'negatable'} ? '!' : '' ) | 1373 | . ($attribs->{'negatable'} ? '!' : '' ) |
545 | 1371 | . ($attribs->{'cumulative'} ? '+' : '' ) | 1374 | . ($attribs->{'cumulative'} ? '+' : '' ) |
547 | 1372 | . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' ); | 1375 | . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' ); |
548 | 1373 | } | 1376 | } |
549 | 1374 | 1377 | ||
550 | 1375 | sub _parse_synopsis { | 1378 | sub _parse_synopsis { |
551 | 1376 | 1379 | ||
552 | === modified file 'bin/pt-tcp-model' | |||
553 | --- bin/pt-tcp-model 2012-10-08 21:02:17 +0000 | |||
554 | +++ bin/pt-tcp-model 2012-10-22 18:26:45 +0000 | |||
555 | @@ -499,7 +499,7 @@ | |||
556 | 499 | else { | 499 | else { |
557 | 500 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 500 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
558 | 501 | } | 501 | } |
560 | 502 | exit 0; | 502 | exit 1; |
561 | 503 | } | 503 | } |
562 | 504 | 504 | ||
563 | 505 | if ( @ARGV && $self->{strict} ) { | 505 | if ( @ARGV && $self->{strict} ) { |
564 | @@ -754,7 +754,7 @@ | |||
565 | 754 | } | 754 | } |
566 | 755 | elsif ( scalar @{$self->{errors}} ) { | 755 | elsif ( scalar @{$self->{errors}} ) { |
567 | 756 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 756 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
569 | 757 | exit 0 unless $return; | 757 | exit 1 unless $return; |
570 | 758 | } | 758 | } |
571 | 759 | 759 | ||
572 | 760 | return; | 760 | return; |
573 | 761 | 761 | ||
574 | === modified file 'bin/pt-trend' | |||
575 | --- bin/pt-trend 2012-10-12 17:09:46 +0000 | |||
576 | +++ bin/pt-trend 2012-10-22 18:26:45 +0000 | |||
577 | @@ -499,7 +499,7 @@ | |||
578 | 499 | else { | 499 | else { |
579 | 500 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 500 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
580 | 501 | } | 501 | } |
582 | 502 | exit 0; | 502 | exit 1; |
583 | 503 | } | 503 | } |
584 | 504 | 504 | ||
585 | 505 | if ( @ARGV && $self->{strict} ) { | 505 | if ( @ARGV && $self->{strict} ) { |
586 | @@ -754,7 +754,7 @@ | |||
587 | 754 | } | 754 | } |
588 | 755 | elsif ( scalar @{$self->{errors}} ) { | 755 | elsif ( scalar @{$self->{errors}} ) { |
589 | 756 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 756 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
591 | 757 | exit 0 unless $return; | 757 | exit 1 unless $return; |
592 | 758 | } | 758 | } |
593 | 759 | 759 | ||
594 | 760 | return; | 760 | return; |
595 | 761 | 761 | ||
596 | === modified file 'bin/pt-upgrade' | |||
597 | --- bin/pt-upgrade 2012-10-20 23:59:28 +0000 | |||
598 | +++ bin/pt-upgrade 2012-10-22 18:26:45 +0000 | |||
599 | @@ -1444,7 +1444,7 @@ | |||
600 | 1444 | else { | 1444 | else { |
601 | 1445 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1445 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
602 | 1446 | } | 1446 | } |
604 | 1447 | exit 0; | 1447 | exit 1; |
605 | 1448 | } | 1448 | } |
606 | 1449 | 1449 | ||
607 | 1450 | if ( @ARGV && $self->{strict} ) { | 1450 | if ( @ARGV && $self->{strict} ) { |
608 | @@ -1699,7 +1699,7 @@ | |||
609 | 1699 | } | 1699 | } |
610 | 1700 | elsif ( scalar @{$self->{errors}} ) { | 1700 | elsif ( scalar @{$self->{errors}} ) { |
611 | 1701 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1701 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
613 | 1702 | exit 0 unless $return; | 1702 | exit 1 unless $return; |
614 | 1703 | } | 1703 | } |
615 | 1704 | 1704 | ||
616 | 1705 | return; | 1705 | return; |
617 | 1706 | 1706 | ||
618 | === modified file 'bin/pt-variable-advisor' | |||
619 | --- bin/pt-variable-advisor 2012-10-20 23:59:28 +0000 | |||
620 | +++ bin/pt-variable-advisor 2012-10-22 18:26:45 +0000 | |||
621 | @@ -525,7 +525,7 @@ | |||
622 | 525 | else { | 525 | else { |
623 | 526 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 526 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
624 | 527 | } | 527 | } |
626 | 528 | exit 0; | 528 | exit 1; |
627 | 529 | } | 529 | } |
628 | 530 | 530 | ||
629 | 531 | if ( @ARGV && $self->{strict} ) { | 531 | if ( @ARGV && $self->{strict} ) { |
630 | @@ -780,7 +780,7 @@ | |||
631 | 780 | } | 780 | } |
632 | 781 | elsif ( scalar @{$self->{errors}} ) { | 781 | elsif ( scalar @{$self->{errors}} ) { |
633 | 782 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 782 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
635 | 783 | exit 0 unless $return; | 783 | exit 1 unless $return; |
636 | 784 | } | 784 | } |
637 | 785 | 785 | ||
638 | 786 | return; | 786 | return; |
639 | 787 | 787 | ||
640 | === modified file 'bin/pt-visual-explain' | |||
641 | --- bin/pt-visual-explain 2012-10-12 17:09:46 +0000 | |||
642 | +++ bin/pt-visual-explain 2012-10-22 18:26:45 +0000 | |||
643 | @@ -6,7 +6,20 @@ | |||
644 | 6 | 6 | ||
645 | 7 | use strict; | 7 | use strict; |
646 | 8 | use warnings FATAL => 'all'; | 8 | use warnings FATAL => 'all'; |
648 | 9 | use constant PTDEBUG => $ENV{PTDEBUG} || 0; | 9 | |
649 | 10 | # This tool is "fat-packed": most of its dependent modules are embedded | ||
650 | 11 | # in this file. Setting %INC to this file for each module makes Perl aware | ||
651 | 12 | # of this so it will not try to load the module from @INC. See the tool's | ||
652 | 13 | # documentation for a full list of dependencies. | ||
653 | 14 | BEGIN { | ||
654 | 15 | $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( | ||
655 | 16 | ExplainParser | ||
656 | 17 | ExplainTree | ||
657 | 18 | OptionParser | ||
658 | 19 | DSNParser | ||
659 | 20 | Daemon | ||
660 | 21 | )); | ||
661 | 22 | } | ||
662 | 10 | 23 | ||
663 | 11 | # ########################################################################### | 24 | # ########################################################################### |
664 | 12 | # Converts text (e.g. saved output) to a "recordset" -- an array of hashrefs | 25 | # Converts text (e.g. saved output) to a "recordset" -- an array of hashrefs |
665 | @@ -719,6 +732,7 @@ | |||
666 | 719 | 'default' => 1, | 732 | 'default' => 1, |
667 | 720 | 'cumulative' => 1, | 733 | 'cumulative' => 1, |
668 | 721 | 'negatable' => 1, | 734 | 'negatable' => 1, |
669 | 735 | 'value_is_optional' => 1, | ||
670 | 722 | ); | 736 | ); |
671 | 723 | 737 | ||
672 | 724 | my $self = { | 738 | my $self = { |
673 | @@ -960,9 +974,10 @@ | |||
674 | 960 | $opt->{short} = undef; | 974 | $opt->{short} = undef; |
675 | 961 | } | 975 | } |
676 | 962 | 976 | ||
680 | 963 | $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; | 977 | $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; |
681 | 964 | $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; | 978 | $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; |
682 | 965 | $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; | 979 | $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0; |
683 | 980 | $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; | ||
684 | 966 | 981 | ||
685 | 967 | $opt->{group} ||= 'default'; | 982 | $opt->{group} ||= 'default'; |
686 | 968 | $self->{groups}->{ $opt->{group} }->{$long} = 1; | 983 | $self->{groups}->{ $opt->{group} }->{$long} = 1; |
687 | @@ -1098,7 +1113,7 @@ | |||
688 | 1098 | if ( $opt->{is_cumulative} ) { | 1113 | if ( $opt->{is_cumulative} ) { |
689 | 1099 | $opt->{value}++; | 1114 | $opt->{value}++; |
690 | 1100 | } | 1115 | } |
692 | 1101 | else { | 1116 | elsif ( !($opt->{optional_value} && !$val) ) { |
693 | 1102 | $opt->{value} = $val; | 1117 | $opt->{value} = $val; |
694 | 1103 | } | 1118 | } |
695 | 1104 | $opt->{got} = 1; | 1119 | $opt->{got} = 1; |
696 | @@ -1155,7 +1170,7 @@ | |||
697 | 1155 | else { | 1170 | else { |
698 | 1156 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 1171 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
699 | 1157 | } | 1172 | } |
701 | 1158 | exit 0; | 1173 | exit 1; |
702 | 1159 | } | 1174 | } |
703 | 1160 | 1175 | ||
704 | 1161 | if ( @ARGV && $self->{strict} ) { | 1176 | if ( @ARGV && $self->{strict} ) { |
705 | @@ -1410,7 +1425,7 @@ | |||
706 | 1410 | } | 1425 | } |
707 | 1411 | elsif ( scalar @{$self->{errors}} ) { | 1426 | elsif ( scalar @{$self->{errors}} ) { |
708 | 1412 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 1427 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
710 | 1413 | exit 0 unless $return; | 1428 | exit 1 unless $return; |
711 | 1414 | } | 1429 | } |
712 | 1415 | 1430 | ||
713 | 1416 | return; | 1431 | return; |
714 | @@ -1639,11 +1654,12 @@ | |||
715 | 1639 | sub _parse_attribs { | 1654 | sub _parse_attribs { |
716 | 1640 | my ( $self, $option, $attribs ) = @_; | 1655 | my ( $self, $option, $attribs ) = @_; |
717 | 1641 | my $types = $self->{types}; | 1656 | my $types = $self->{types}; |
718 | 1657 | my $eq = $attribs->{'value_is_optional'} ? ':' : '='; | ||
719 | 1642 | return $option | 1658 | return $option |
720 | 1643 | . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) | 1659 | . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) |
721 | 1644 | . ($attribs->{'negatable'} ? '!' : '' ) | 1660 | . ($attribs->{'negatable'} ? '!' : '' ) |
722 | 1645 | . ($attribs->{'cumulative'} ? '+' : '' ) | 1661 | . ($attribs->{'cumulative'} ? '+' : '' ) |
724 | 1646 | . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' ); | 1662 | . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' ); |
725 | 1647 | } | 1663 | } |
726 | 1648 | 1664 | ||
727 | 1649 | sub _parse_synopsis { | 1665 | sub _parse_synopsis { |
728 | 1650 | 1666 | ||
729 | === modified file 'lib/OptionParser.pm' | |||
730 | --- lib/OptionParser.pm 2012-09-13 13:39:04 +0000 | |||
731 | +++ lib/OptionParser.pm 2012-10-22 18:26:45 +0000 | |||
732 | @@ -669,7 +669,7 @@ | |||
733 | 669 | else { | 669 | else { |
734 | 670 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; | 670 | print "Error parsing version. See the VERSION section of the tool's documentation.\n"; |
735 | 671 | } | 671 | } |
737 | 672 | exit 0; | 672 | exit 1; |
738 | 673 | } | 673 | } |
739 | 674 | 674 | ||
740 | 675 | if ( @ARGV && $self->{strict} ) { | 675 | if ( @ARGV && $self->{strict} ) { |
741 | @@ -988,7 +988,7 @@ | |||
742 | 988 | } | 988 | } |
743 | 989 | elsif ( scalar @{$self->{errors}} ) { | 989 | elsif ( scalar @{$self->{errors}} ) { |
744 | 990 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; | 990 | print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; |
746 | 991 | exit 0 unless $return; | 991 | exit 1 unless $return; |
747 | 992 | } | 992 | } |
748 | 993 | 993 | ||
749 | 994 | return; | 994 | return; |
750 | 995 | 995 | ||
751 | === modified file 't/lib/OptionParser.t' | |||
752 | --- t/lib/OptionParser.t 2012-09-13 13:39:04 +0000 | |||
753 | +++ t/lib/OptionParser.t 2012-10-22 18:26:45 +0000 | |||
754 | @@ -2058,6 +2058,28 @@ | |||
755 | 2058 | ); | 2058 | ); |
756 | 2059 | 2059 | ||
757 | 2060 | # ############################################################################# | 2060 | # ############################################################################# |
758 | 2061 | # Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero | ||
759 | 2062 | # ############################################################################# | ||
760 | 2063 | |||
761 | 2064 | # pt-archiver requires at least one of --dest, --file or --purge, as well as | ||
762 | 2065 | # --where and --source. So specifying no options should cause errors. | ||
763 | 2066 | @ARGV = qw(); | ||
764 | 2067 | $o = new OptionParser(file => "$trunk/bin/pt-archiver"); | ||
765 | 2068 | $o->get_specs(); | ||
766 | 2069 | $o->get_opts(); | ||
767 | 2070 | |||
768 | 2071 | my $exit_status = 0; | ||
769 | 2072 | ($output, $exit_status) = full_output( | ||
770 | 2073 | sub { $o->usage_or_errors("$trunk/bin/pt-archiver"); }, | ||
771 | 2074 | ); | ||
772 | 2075 | |||
773 | 2076 | is( | ||
774 | 2077 | $exit_status, | ||
775 | 2078 | 1, | ||
776 | 2079 | "Non-zero exit status on error parsing options (bug 1039074)" | ||
777 | 2080 | ); | ||
778 | 2081 | |||
779 | 2082 | # ############################################################################# | ||
780 | 2061 | # Done. | 2083 | # Done. |
781 | 2062 | # ############################################################################# | 2084 | # ############################################################################# |
782 | 2063 | { | 2085 | { |
783 | 2064 | 2086 | ||
784 | === modified file 't/pt-deadlock-logger/option_sanity.t' | |||
785 | --- t/pt-deadlock-logger/option_sanity.t 2011-07-12 22:56:55 +0000 | |||
786 | +++ t/pt-deadlock-logger/option_sanity.t 2012-10-22 18:26:45 +0000 | |||
787 | @@ -9,7 +9,7 @@ | |||
788 | 9 | use strict; | 9 | use strict; |
789 | 10 | use warnings FATAL => 'all'; | 10 | use warnings FATAL => 'all'; |
790 | 11 | use English qw(-no_match_vars); | 11 | use English qw(-no_match_vars); |
792 | 12 | use Test::More tests => 3; | 12 | use Test::More tests => 4; |
793 | 13 | 13 | ||
794 | 14 | use PerconaTest; | 14 | use PerconaTest; |
795 | 15 | 15 | ||
796 | @@ -40,6 +40,19 @@ | |||
797 | 40 | ); | 40 | ); |
798 | 41 | 41 | ||
799 | 42 | # ############################################################################# | 42 | # ############################################################################# |
800 | 43 | # Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero | ||
801 | 44 | # ############################################################################# | ||
802 | 45 | |||
803 | 46 | system("$trunk/bin/pt-deadlock-logger --i-am-the-error >/dev/null 2>&1"); | ||
804 | 47 | my $exit_status = $CHILD_ERROR >> 8; | ||
805 | 48 | |||
806 | 49 | is( | ||
807 | 50 | $exit_status, | ||
808 | 51 | 1, | ||
809 | 52 | "Non-zero exit on option error (bug 1039074)" | ||
810 | 53 | ); | ||
811 | 54 | |||
812 | 55 | # ############################################################################# | ||
813 | 43 | # Done. | 56 | # Done. |
814 | 44 | # ############################################################################# | 57 | # ############################################################################# |
815 | 45 | exit; | 58 | exit; |
But see also https:/ /bugs.launchpad .net/percona- toolkit/ +bug/1069951