Merge lp:~percona-toolkit-dev/percona-toolkit/opt-parsing-exit-status-bug-1039074 into lp:percona-toolkit/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
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+130872@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-archiver'
--- bin/pt-archiver 2012-10-20 23:59:28 +0000
+++ bin/pt-archiver 2012-10-22 18:26:45 +0000
@@ -524,7 +524,7 @@
524 else {524 else {
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";
526 }526 }
527 exit 0;527 exit 1;
528 }528 }
529529
530 if ( @ARGV && $self->{strict} ) {530 if ( @ARGV && $self->{strict} ) {
@@ -779,7 +779,7 @@
779 }779 }
780 elsif ( scalar @{$self->{errors}} ) {780 elsif ( scalar @{$self->{errors}} ) {
781 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";781 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
782 exit 0 unless $return;782 exit 1 unless $return;
783 }783 }
784784
785 return;785 return;
786786
=== modified file 'bin/pt-config-diff'
--- bin/pt-config-diff 2012-10-20 23:59:28 +0000
+++ bin/pt-config-diff 2012-10-22 18:26:45 +0000
@@ -523,7 +523,7 @@
523 else {523 else {
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";
525 }525 }
526 exit 0;526 exit 1;
527 }527 }
528528
529 if ( @ARGV && $self->{strict} ) {529 if ( @ARGV && $self->{strict} ) {
@@ -778,7 +778,7 @@
778 }778 }
779 elsif ( scalar @{$self->{errors}} ) {779 elsif ( scalar @{$self->{errors}} ) {
780 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";780 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
781 exit 0 unless $return;781 exit 1 unless $return;
782 }782 }
783783
784 return;784 return;
785785
=== modified file 'bin/pt-deadlock-logger'
--- bin/pt-deadlock-logger 2012-10-20 23:59:28 +0000
+++ bin/pt-deadlock-logger 2012-10-22 18:26:45 +0000
@@ -521,7 +521,7 @@
521 else {521 else {
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";
523 }523 }
524 exit 0;524 exit 1;
525 }525 }
526526
527 if ( @ARGV && $self->{strict} ) {527 if ( @ARGV && $self->{strict} ) {
@@ -776,7 +776,7 @@
776 }776 }
777 elsif ( scalar @{$self->{errors}} ) {777 elsif ( scalar @{$self->{errors}} ) {
778 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";778 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
779 exit 0 unless $return;779 exit 1 unless $return;
780 }780 }
781781
782 return;782 return;
783783
=== modified file 'bin/pt-diskstats'
--- bin/pt-diskstats 2012-10-20 23:59:28 +0000
+++ bin/pt-diskstats 2012-10-22 18:26:45 +0000
@@ -523,7 +523,7 @@
523 else {523 else {
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";
525 }525 }
526 exit 0;526 exit 1;
527 }527 }
528528
529 if ( @ARGV && $self->{strict} ) {529 if ( @ARGV && $self->{strict} ) {
@@ -778,7 +778,7 @@
778 }778 }
779 elsif ( scalar @{$self->{errors}} ) {779 elsif ( scalar @{$self->{errors}} ) {
780 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";780 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
781 exit 0 unless $return;781 exit 1 unless $return;
782 }782 }
783783
784 return;784 return;
785785
=== modified file 'bin/pt-duplicate-key-checker'
--- bin/pt-duplicate-key-checker 2012-10-20 23:59:28 +0000
+++ bin/pt-duplicate-key-checker 2012-10-22 18:26:45 +0000
@@ -1425,7 +1425,7 @@
1425 else {1425 else {
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";
1427 }1427 }
1428 exit 0;1428 exit 1;
1429 }1429 }
14301430
1431 if ( @ARGV && $self->{strict} ) {1431 if ( @ARGV && $self->{strict} ) {
@@ -1680,7 +1680,7 @@
1680 }1680 }
1681 elsif ( scalar @{$self->{errors}} ) {1681 elsif ( scalar @{$self->{errors}} ) {
1682 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1682 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1683 exit 0 unless $return;1683 exit 1 unless $return;
1684 }1684 }
16851685
1686 return;1686 return;
16871687
=== modified file 'bin/pt-fifo-split'
--- bin/pt-fifo-split 2012-10-08 21:02:17 +0000
+++ bin/pt-fifo-split 2012-10-22 18:26:45 +0000
@@ -495,7 +495,7 @@
495 else {495 else {
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";
497 }497 }
498 exit 0;498 exit 1;
499 }499 }
500500
501 if ( @ARGV && $self->{strict} ) {501 if ( @ARGV && $self->{strict} ) {
@@ -750,7 +750,7 @@
750 }750 }
751 elsif ( scalar @{$self->{errors}} ) {751 elsif ( scalar @{$self->{errors}} ) {
752 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";752 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
753 exit 0 unless $return;753 exit 1 unless $return;
754 }754 }
755755
756 return;756 return;
757757
=== modified file 'bin/pt-find'
--- bin/pt-find 2012-10-20 23:59:28 +0000
+++ bin/pt-find 2012-10-22 18:26:45 +0000
@@ -893,7 +893,7 @@
893 else {893 else {
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";
895 }895 }
896 exit 0;896 exit 1;
897 }897 }
898898
899 if ( @ARGV && $self->{strict} ) {899 if ( @ARGV && $self->{strict} ) {
@@ -1148,7 +1148,7 @@
1148 }1148 }
1149 elsif ( scalar @{$self->{errors}} ) {1149 elsif ( scalar @{$self->{errors}} ) {
1150 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1150 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1151 exit 0 unless $return;1151 exit 1 unless $return;
1152 }1152 }
11531153
1154 return;1154 return;
11551155
=== modified file 'bin/pt-fingerprint'
--- bin/pt-fingerprint 2012-10-08 21:02:17 +0000
+++ bin/pt-fingerprint 2012-10-22 18:26:45 +0000
@@ -496,7 +496,7 @@
496 else {496 else {
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";
498 }498 }
499 exit 0;499 exit 1;
500 }500 }
501501
502 if ( @ARGV && $self->{strict} ) {502 if ( @ARGV && $self->{strict} ) {
@@ -751,7 +751,7 @@
751 }751 }
752 elsif ( scalar @{$self->{errors}} ) {752 elsif ( scalar @{$self->{errors}} ) {
753 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";753 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
754 exit 0 unless $return;754 exit 1 unless $return;
755 }755 }
756756
757 return;757 return;
758758
=== modified file 'bin/pt-fk-error-logger'
--- bin/pt-fk-error-logger 2012-10-20 23:59:28 +0000
+++ bin/pt-fk-error-logger 2012-10-22 18:26:45 +0000
@@ -520,7 +520,7 @@
520 else {520 else {
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";
522 }522 }
523 exit 0;523 exit 1;
524 }524 }
525525
526 if ( @ARGV && $self->{strict} ) {526 if ( @ARGV && $self->{strict} ) {
@@ -775,7 +775,7 @@
775 }775 }
776 elsif ( scalar @{$self->{errors}} ) {776 elsif ( scalar @{$self->{errors}} ) {
777 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";777 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
778 exit 0 unless $return;778 exit 1 unless $return;
779 }779 }
780780
781 return;781 return;
782782
=== modified file 'bin/pt-heartbeat'
--- bin/pt-heartbeat 2012-10-20 23:59:28 +0000
+++ bin/pt-heartbeat 2012-10-22 18:26:45 +0000
@@ -1256,7 +1256,7 @@
1256 else {1256 else {
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";
1258 }1258 }
1259 exit 0;1259 exit 1;
1260 }1260 }
12611261
1262 if ( @ARGV && $self->{strict} ) {1262 if ( @ARGV && $self->{strict} ) {
@@ -1511,7 +1511,7 @@
1511 }1511 }
1512 elsif ( scalar @{$self->{errors}} ) {1512 elsif ( scalar @{$self->{errors}} ) {
1513 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1513 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1514 exit 0 unless $return;1514 exit 1 unless $return;
1515 }1515 }
15161516
1517 return;1517 return;
15181518
=== modified file 'bin/pt-index-usage'
--- bin/pt-index-usage 2012-10-20 23:59:28 +0000
+++ bin/pt-index-usage 2012-10-22 18:26:45 +0000
@@ -1023,7 +1023,7 @@
1023 else {1023 else {
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";
1025 }1025 }
1026 exit 0;1026 exit 1;
1027 }1027 }
10281028
1029 if ( @ARGV && $self->{strict} ) {1029 if ( @ARGV && $self->{strict} ) {
@@ -1278,7 +1278,7 @@
1278 }1278 }
1279 elsif ( scalar @{$self->{errors}} ) {1279 elsif ( scalar @{$self->{errors}} ) {
1280 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1280 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1281 exit 0 unless $return;1281 exit 1 unless $return;
1282 }1282 }
12831283
1284 return;1284 return;
12851285
=== modified file 'bin/pt-kill'
--- bin/pt-kill 2012-10-20 23:59:28 +0000
+++ bin/pt-kill 2012-10-22 18:26:45 +0000
@@ -528,7 +528,7 @@
528 else {528 else {
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";
530 }530 }
531 exit 0;531 exit 1;
532 }532 }
533533
534 if ( @ARGV && $self->{strict} ) {534 if ( @ARGV && $self->{strict} ) {
@@ -783,7 +783,7 @@
783 }783 }
784 elsif ( scalar @{$self->{errors}} ) {784 elsif ( scalar @{$self->{errors}} ) {
785 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";785 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
786 exit 0 unless $return;786 exit 1 unless $return;
787 }787 }
788788
789 return;789 return;
790790
=== modified file 'bin/pt-log-player'
--- bin/pt-log-player 2012-10-08 21:02:17 +0000
+++ bin/pt-log-player 2012-10-22 18:26:45 +0000
@@ -500,7 +500,7 @@
500 else {500 else {
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";
502 }502 }
503 exit 0;503 exit 1;
504 }504 }
505505
506 if ( @ARGV && $self->{strict} ) {506 if ( @ARGV && $self->{strict} ) {
@@ -755,7 +755,7 @@
755 }755 }
756 elsif ( scalar @{$self->{errors}} ) {756 elsif ( scalar @{$self->{errors}} ) {
757 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";757 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
758 exit 0 unless $return;758 exit 1 unless $return;
759 }759 }
760760
761 return;761 return;
762762
=== modified file 'bin/pt-online-schema-change'
--- bin/pt-online-schema-change 2012-10-22 17:34:52 +0000
+++ bin/pt-online-schema-change 2012-10-22 18:26:45 +0000
@@ -534,7 +534,7 @@
534 else {534 else {
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";
536 }536 }
537 exit 0;537 exit 1;
538 }538 }
539539
540 if ( @ARGV && $self->{strict} ) {540 if ( @ARGV && $self->{strict} ) {
@@ -789,7 +789,7 @@
789 }789 }
790 elsif ( scalar @{$self->{errors}} ) {790 elsif ( scalar @{$self->{errors}} ) {
791 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";791 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
792 exit 0 unless $return;792 exit 1 unless $return;
793 }793 }
794794
795 return;795 return;
796796
=== modified file 'bin/pt-query-advisor'
--- bin/pt-query-advisor 2012-10-20 23:59:28 +0000
+++ bin/pt-query-advisor 2012-10-22 18:26:45 +0000
@@ -904,7 +904,7 @@
904 else {904 else {
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";
906 }906 }
907 exit 0;907 exit 1;
908 }908 }
909909
910 if ( @ARGV && $self->{strict} ) {910 if ( @ARGV && $self->{strict} ) {
@@ -1159,7 +1159,7 @@
1159 }1159 }
1160 elsif ( scalar @{$self->{errors}} ) {1160 elsif ( scalar @{$self->{errors}} ) {
1161 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1161 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1162 exit 0 unless $return;1162 exit 1 unless $return;
1163 }1163 }
11641164
1165 return;1165 return;
11661166
=== modified file 'bin/pt-query-digest'
--- bin/pt-query-digest 2012-10-20 23:59:28 +0000
+++ bin/pt-query-digest 2012-10-22 18:26:45 +0000
@@ -1042,7 +1042,7 @@
1042 else {1042 else {
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";
1044 }1044 }
1045 exit 0;1045 exit 1;
1046 }1046 }
10471047
1048 if ( @ARGV && $self->{strict} ) {1048 if ( @ARGV && $self->{strict} ) {
@@ -1297,7 +1297,7 @@
1297 }1297 }
1298 elsif ( scalar @{$self->{errors}} ) {1298 elsif ( scalar @{$self->{errors}} ) {
1299 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1299 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1300 exit 0 unless $return;1300 exit 1 unless $return;
1301 }1301 }
13021302
1303 return;1303 return;
13041304
=== modified file 'bin/pt-show-grants'
--- bin/pt-show-grants 2012-10-08 21:02:17 +0000
+++ bin/pt-show-grants 2012-10-22 18:26:45 +0000
@@ -496,7 +496,7 @@
496 else {496 else {
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";
498 }498 }
499 exit 0;499 exit 1;
500 }500 }
501501
502 if ( @ARGV && $self->{strict} ) {502 if ( @ARGV && $self->{strict} ) {
@@ -751,7 +751,7 @@
751 }751 }
752 elsif ( scalar @{$self->{errors}} ) {752 elsif ( scalar @{$self->{errors}} ) {
753 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";753 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
754 exit 0 unless $return;754 exit 1 unless $return;
755 }755 }
756756
757 return;757 return;
758758
=== modified file 'bin/pt-slave-delay'
--- bin/pt-slave-delay 2012-10-20 23:59:28 +0000
+++ bin/pt-slave-delay 2012-10-22 18:26:45 +0000
@@ -521,7 +521,7 @@
521 else {521 else {
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";
523 }523 }
524 exit 0;524 exit 1;
525 }525 }
526526
527 if ( @ARGV && $self->{strict} ) {527 if ( @ARGV && $self->{strict} ) {
@@ -776,7 +776,7 @@
776 }776 }
777 elsif ( scalar @{$self->{errors}} ) {777 elsif ( scalar @{$self->{errors}} ) {
778 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";778 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
779 exit 0 unless $return;779 exit 1 unless $return;
780 }780 }
781781
782 return;782 return;
783783
=== modified file 'bin/pt-slave-find'
--- bin/pt-slave-find 2012-10-08 21:02:17 +0000
+++ bin/pt-slave-find 2012-10-22 18:26:45 +0000
@@ -500,7 +500,7 @@
500 else {500 else {
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";
502 }502 }
503 exit 0;503 exit 1;
504 }504 }
505505
506 if ( @ARGV && $self->{strict} ) {506 if ( @ARGV && $self->{strict} ) {
@@ -755,7 +755,7 @@
755 }755 }
756 elsif ( scalar @{$self->{errors}} ) {756 elsif ( scalar @{$self->{errors}} ) {
757 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";757 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
758 exit 0 unless $return;758 exit 1 unless $return;
759 }759 }
760760
761 return;761 return;
762762
=== modified file 'bin/pt-slave-restart'
--- bin/pt-slave-restart 2012-10-20 23:59:28 +0000
+++ bin/pt-slave-restart 2012-10-22 18:26:45 +0000
@@ -642,7 +642,7 @@
642 else {642 else {
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";
644 }644 }
645 exit 0;645 exit 1;
646 }646 }
647647
648 if ( @ARGV && $self->{strict} ) {648 if ( @ARGV && $self->{strict} ) {
@@ -897,7 +897,7 @@
897 }897 }
898 elsif ( scalar @{$self->{errors}} ) {898 elsif ( scalar @{$self->{errors}} ) {
899 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";899 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
900 exit 0 unless $return;900 exit 1 unless $return;
901 }901 }
902902
903 return;903 return;
904904
=== modified file 'bin/pt-table-checksum'
--- bin/pt-table-checksum 2012-10-20 23:59:28 +0000
+++ bin/pt-table-checksum 2012-10-22 18:26:45 +0000
@@ -2190,7 +2190,7 @@
2190 else {2190 else {
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";
2192 }2192 }
2193 exit 0;2193 exit 1;
2194 }2194 }
21952195
2196 if ( @ARGV && $self->{strict} ) {2196 if ( @ARGV && $self->{strict} ) {
@@ -2445,7 +2445,7 @@
2445 }2445 }
2446 elsif ( scalar @{$self->{errors}} ) {2446 elsif ( scalar @{$self->{errors}} ) {
2447 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";2447 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
2448 exit 0 unless $return;2448 exit 1 unless $return;
2449 }2449 }
24502450
2451 return;2451 return;
24522452
=== modified file 'bin/pt-table-sync'
--- bin/pt-table-sync 2012-10-20 23:59:28 +0000
+++ bin/pt-table-sync 2012-10-22 18:26:45 +0000
@@ -537,7 +537,7 @@
537 else {537 else {
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";
539 }539 }
540 exit 0;540 exit 1;
541 }541 }
542542
543 if ( @ARGV && $self->{strict} ) {543 if ( @ARGV && $self->{strict} ) {
@@ -792,7 +792,7 @@
792 }792 }
793 elsif ( scalar @{$self->{errors}} ) {793 elsif ( scalar @{$self->{errors}} ) {
794 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";794 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
795 exit 0 unless $return;795 exit 1 unless $return;
796 }796 }
797797
798 return;798 return;
799799
=== modified file 'bin/pt-table-usage'
--- bin/pt-table-usage 2012-10-19 23:14:07 +0000
+++ bin/pt-table-usage 2012-10-22 18:26:45 +0000
@@ -445,6 +445,7 @@
445 'default' => 1,445 'default' => 1,
446 'cumulative' => 1,446 'cumulative' => 1,
447 'negatable' => 1,447 'negatable' => 1,
448 'value_is_optional' => 1,
448 );449 );
449450
450 my $self = {451 my $self = {
@@ -686,9 +687,10 @@
686 $opt->{short} = undef;687 $opt->{short} = undef;
687 }688 }
688689
689 $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;690 $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
690 $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;691 $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
691 $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;692 $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
693 $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
692694
693 $opt->{group} ||= 'default';695 $opt->{group} ||= 'default';
694 $self->{groups}->{ $opt->{group} }->{$long} = 1;696 $self->{groups}->{ $opt->{group} }->{$long} = 1;
@@ -824,7 +826,7 @@
824 if ( $opt->{is_cumulative} ) {826 if ( $opt->{is_cumulative} ) {
825 $opt->{value}++;827 $opt->{value}++;
826 }828 }
827 else {829 elsif ( !($opt->{optional_value} && !$val) ) {
828 $opt->{value} = $val;830 $opt->{value} = $val;
829 }831 }
830 $opt->{got} = 1;832 $opt->{got} = 1;
@@ -881,7 +883,7 @@
881 else {883 else {
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";
883 }885 }
884 exit 0;886 exit 1;
885 }887 }
886888
887 if ( @ARGV && $self->{strict} ) {889 if ( @ARGV && $self->{strict} ) {
@@ -1136,7 +1138,7 @@
1136 }1138 }
1137 elsif ( scalar @{$self->{errors}} ) {1139 elsif ( scalar @{$self->{errors}} ) {
1138 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1140 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1139 exit 0 unless $return;1141 exit 1 unless $return;
1140 }1142 }
11411143
1142 return;1144 return;
@@ -1365,11 +1367,12 @@
1365sub _parse_attribs {1367sub _parse_attribs {
1366 my ( $self, $option, $attribs ) = @_;1368 my ( $self, $option, $attribs ) = @_;
1367 my $types = $self->{types};1369 my $types = $self->{types};
1370 my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
1368 return $option1371 return $option
1369 . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )1372 . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
1370 . ($attribs->{'negatable'} ? '!' : '' )1373 . ($attribs->{'negatable'} ? '!' : '' )
1371 . ($attribs->{'cumulative'} ? '+' : '' )1374 . ($attribs->{'cumulative'} ? '+' : '' )
1372 . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );1375 . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
1373}1376}
13741377
1375sub _parse_synopsis {1378sub _parse_synopsis {
13761379
=== modified file 'bin/pt-tcp-model'
--- bin/pt-tcp-model 2012-10-08 21:02:17 +0000
+++ bin/pt-tcp-model 2012-10-22 18:26:45 +0000
@@ -499,7 +499,7 @@
499 else {499 else {
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";
501 }501 }
502 exit 0;502 exit 1;
503 }503 }
504504
505 if ( @ARGV && $self->{strict} ) {505 if ( @ARGV && $self->{strict} ) {
@@ -754,7 +754,7 @@
754 }754 }
755 elsif ( scalar @{$self->{errors}} ) {755 elsif ( scalar @{$self->{errors}} ) {
756 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";756 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
757 exit 0 unless $return;757 exit 1 unless $return;
758 }758 }
759759
760 return;760 return;
761761
=== modified file 'bin/pt-trend'
--- bin/pt-trend 2012-10-12 17:09:46 +0000
+++ bin/pt-trend 2012-10-22 18:26:45 +0000
@@ -499,7 +499,7 @@
499 else {499 else {
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";
501 }501 }
502 exit 0;502 exit 1;
503 }503 }
504504
505 if ( @ARGV && $self->{strict} ) {505 if ( @ARGV && $self->{strict} ) {
@@ -754,7 +754,7 @@
754 }754 }
755 elsif ( scalar @{$self->{errors}} ) {755 elsif ( scalar @{$self->{errors}} ) {
756 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";756 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
757 exit 0 unless $return;757 exit 1 unless $return;
758 }758 }
759759
760 return;760 return;
761761
=== modified file 'bin/pt-upgrade'
--- bin/pt-upgrade 2012-10-20 23:59:28 +0000
+++ bin/pt-upgrade 2012-10-22 18:26:45 +0000
@@ -1444,7 +1444,7 @@
1444 else {1444 else {
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";
1446 }1446 }
1447 exit 0;1447 exit 1;
1448 }1448 }
14491449
1450 if ( @ARGV && $self->{strict} ) {1450 if ( @ARGV && $self->{strict} ) {
@@ -1699,7 +1699,7 @@
1699 }1699 }
1700 elsif ( scalar @{$self->{errors}} ) {1700 elsif ( scalar @{$self->{errors}} ) {
1701 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1701 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1702 exit 0 unless $return;1702 exit 1 unless $return;
1703 }1703 }
17041704
1705 return;1705 return;
17061706
=== modified file 'bin/pt-variable-advisor'
--- bin/pt-variable-advisor 2012-10-20 23:59:28 +0000
+++ bin/pt-variable-advisor 2012-10-22 18:26:45 +0000
@@ -525,7 +525,7 @@
525 else {525 else {
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";
527 }527 }
528 exit 0;528 exit 1;
529 }529 }
530530
531 if ( @ARGV && $self->{strict} ) {531 if ( @ARGV && $self->{strict} ) {
@@ -780,7 +780,7 @@
780 }780 }
781 elsif ( scalar @{$self->{errors}} ) {781 elsif ( scalar @{$self->{errors}} ) {
782 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";782 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
783 exit 0 unless $return;783 exit 1 unless $return;
784 }784 }
785785
786 return;786 return;
787787
=== modified file 'bin/pt-visual-explain'
--- bin/pt-visual-explain 2012-10-12 17:09:46 +0000
+++ bin/pt-visual-explain 2012-10-22 18:26:45 +0000
@@ -6,7 +6,20 @@
66
7use strict;7use strict;
8use warnings FATAL => 'all';8use warnings FATAL => 'all';
9use constant PTDEBUG => $ENV{PTDEBUG} || 0;9
10# This tool is "fat-packed": most of its dependent modules are embedded
11# in this file. Setting %INC to this file for each module makes Perl aware
12# of this so it will not try to load the module from @INC. See the tool's
13# documentation for a full list of dependencies.
14BEGIN {
15 $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
16 ExplainParser
17 ExplainTree
18 OptionParser
19 DSNParser
20 Daemon
21 ));
22}
1023
11# ###########################################################################24# ###########################################################################
12# Converts text (e.g. saved output) to a "recordset" -- an array of hashrefs25# Converts text (e.g. saved output) to a "recordset" -- an array of hashrefs
@@ -719,6 +732,7 @@
719 'default' => 1,732 'default' => 1,
720 'cumulative' => 1,733 'cumulative' => 1,
721 'negatable' => 1,734 'negatable' => 1,
735 'value_is_optional' => 1,
722 );736 );
723737
724 my $self = {738 my $self = {
@@ -960,9 +974,10 @@
960 $opt->{short} = undef;974 $opt->{short} = undef;
961 }975 }
962976
963 $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;977 $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
964 $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;978 $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
965 $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;979 $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
980 $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
966981
967 $opt->{group} ||= 'default';982 $opt->{group} ||= 'default';
968 $self->{groups}->{ $opt->{group} }->{$long} = 1;983 $self->{groups}->{ $opt->{group} }->{$long} = 1;
@@ -1098,7 +1113,7 @@
1098 if ( $opt->{is_cumulative} ) {1113 if ( $opt->{is_cumulative} ) {
1099 $opt->{value}++;1114 $opt->{value}++;
1100 }1115 }
1101 else {1116 elsif ( !($opt->{optional_value} && !$val) ) {
1102 $opt->{value} = $val;1117 $opt->{value} = $val;
1103 }1118 }
1104 $opt->{got} = 1;1119 $opt->{got} = 1;
@@ -1155,7 +1170,7 @@
1155 else {1170 else {
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";
1157 }1172 }
1158 exit 0;1173 exit 1;
1159 }1174 }
11601175
1161 if ( @ARGV && $self->{strict} ) {1176 if ( @ARGV && $self->{strict} ) {
@@ -1410,7 +1425,7 @@
1410 }1425 }
1411 elsif ( scalar @{$self->{errors}} ) {1426 elsif ( scalar @{$self->{errors}} ) {
1412 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";1427 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
1413 exit 0 unless $return;1428 exit 1 unless $return;
1414 }1429 }
14151430
1416 return;1431 return;
@@ -1639,11 +1654,12 @@
1639sub _parse_attribs {1654sub _parse_attribs {
1640 my ( $self, $option, $attribs ) = @_;1655 my ( $self, $option, $attribs ) = @_;
1641 my $types = $self->{types};1656 my $types = $self->{types};
1657 my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
1642 return $option1658 return $option
1643 . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )1659 . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
1644 . ($attribs->{'negatable'} ? '!' : '' )1660 . ($attribs->{'negatable'} ? '!' : '' )
1645 . ($attribs->{'cumulative'} ? '+' : '' )1661 . ($attribs->{'cumulative'} ? '+' : '' )
1646 . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );1662 . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
1647}1663}
16481664
1649sub _parse_synopsis {1665sub _parse_synopsis {
16501666
=== modified file 'lib/OptionParser.pm'
--- lib/OptionParser.pm 2012-09-13 13:39:04 +0000
+++ lib/OptionParser.pm 2012-10-22 18:26:45 +0000
@@ -669,7 +669,7 @@
669 else {669 else {
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";
671 }671 }
672 exit 0;672 exit 1;
673 }673 }
674674
675 if ( @ARGV && $self->{strict} ) {675 if ( @ARGV && $self->{strict} ) {
@@ -988,7 +988,7 @@
988 }988 }
989 elsif ( scalar @{$self->{errors}} ) {989 elsif ( scalar @{$self->{errors}} ) {
990 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";990 print $self->print_errors() or die "Cannot print errors: $OS_ERROR";
991 exit 0 unless $return;991 exit 1 unless $return;
992 }992 }
993993
994 return;994 return;
995995
=== modified file 't/lib/OptionParser.t'
--- t/lib/OptionParser.t 2012-09-13 13:39:04 +0000
+++ t/lib/OptionParser.t 2012-10-22 18:26:45 +0000
@@ -2058,6 +2058,28 @@
2058);2058);
20592059
2060# #############################################################################2060# #############################################################################
2061# Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero
2062# #############################################################################
2063
2064# pt-archiver requires at least one of --dest, --file or --purge, as well as
2065# --where and --source. So specifying no options should cause errors.
2066@ARGV = qw();
2067$o = new OptionParser(file => "$trunk/bin/pt-archiver");
2068$o->get_specs();
2069$o->get_opts();
2070
2071my $exit_status = 0;
2072($output, $exit_status) = full_output(
2073 sub { $o->usage_or_errors("$trunk/bin/pt-archiver"); },
2074);
2075
2076is(
2077 $exit_status,
2078 1,
2079 "Non-zero exit status on error parsing options (bug 1039074)"
2080);
2081
2082# #############################################################################
2061# Done.2083# Done.
2062# #############################################################################2084# #############################################################################
2063{2085{
20642086
=== modified file 't/pt-deadlock-logger/option_sanity.t'
--- t/pt-deadlock-logger/option_sanity.t 2011-07-12 22:56:55 +0000
+++ t/pt-deadlock-logger/option_sanity.t 2012-10-22 18:26:45 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 3;12use Test::More tests => 4;
1313
14use PerconaTest;14use PerconaTest;
1515
@@ -40,6 +40,19 @@
40);40);
4141
42# #############################################################################42# #############################################################################
43# Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero
44# #############################################################################
45
46system("$trunk/bin/pt-deadlock-logger --i-am-the-error >/dev/null 2>&1");
47my $exit_status = $CHILD_ERROR >> 8;
48
49is(
50 $exit_status,
51 1,
52 "Non-zero exit on option error (bug 1039074)"
53);
54
55# #############################################################################
43# Done.56# Done.
44# #############################################################################57# #############################################################################
45exit;58exit;

Subscribers

People subscribed via source and target branches