Tools exit 0 on error parsing options, should exit non-zero
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Low
|
Daniel Nichter |
Bug Description
According to the documentation of pt-table-checksum "the tool’s exit status is nonzero if any differences are found, or if any warnings or errors occur". However, if a bad command-line argument is passed the exit status is zero. This make it difficult to check for errors when executing via another script.
Example:
./pt-table-checksum --foobar
Output:
Unknown option: foobar
Usage: pt-table-checksum [OPTION...] [DSN]
Errors in command-line arguments:
* Error parsing options
pt-table-checksum performs an online replication consistency check by executing
checksum queries on the master, which produces different results on replicas
that are inconsistent with the master. The optional DSN specifies the master
host. The tool's exit status is nonzero if any differences are found, or if any
warnings or errors occur. For more details, please use the --help option, or
try 'perldoc ./pt-table-
for complete documentation.
Exit status will be 0.
Version: pt-table-checksum 2.1.3
Related branches
- Daniel Nichter: Approve
-
Diff: 815 lines (+124/-70)31 files modifiedbin/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)
tags: | added: pt-table-checksum |
tags: | added: wrong-behavior |
Changed in percona-toolkit: | |
status: | New → Triaged |
tags: |
added: exit-status removed: wrong-behavior |
Changed in percona-toolkit: | |
milestone: | none → 2.1.6 |
importance: | Undecided → Low |
Changed in percona-toolkit: | |
assignee: | nobody → Daniel Nichter (daniel-nichter) |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
tags: |
added: all-tools removed: pt-table-checksum |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Yeah, this should have been exit 1 all along. The PT tools try to mimic the MySQL bins and they exit non-zero if there's a bad option.