Tools exit 0 on error parsing options, should exit non-zero

Bug #1039074 reported by Joe
6
This bug affects 1 person
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-checksum'
for complete documentation.

Exit status will be 0.

Version: pt-table-checksum 2.1.3

Related branches

Joe (joegrasse)
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
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

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.

summary: - pt-table-checksum returns incorrect exit status on error parsing options
+ Tools exit 0 on error parsing options, should exit non-zero
Changed in percona-toolkit:
status: In Progress → Fix Committed
Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-782

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers