Tools should not recognize option prefixes

Bug #933522 reported by Baron Schwartz
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to

Bug Description

I just noticed this:

pt-table-checksum --lock --help
Value "--help" invalid for option lock-wait-timeout (number expected)

It's recognizing --lock, which doesn't exist anymore, as the unambiguous prefix of --lock-wait-timeout. This is like the most evil thing ever about commandline option parsing. I hate this "feature" because it can be very dangerous. I thought I had chosen to disable this years back when I started writing the original tools.

We need to disable this in the next release and include a warning. Otherwise we basically never can safely remove options and we'll have to be paranoid about introducing new options that create ambiguity about prefixes, e.g. right now, this will work:

pt-table-checksum --loc 1

it'll recognize that as --lock-wait-timeout. But in the future, suppose we introduce --lock-foo, then it'll break, with a message like this:

pt-table-checksum --recur 1
Option recur is ambiguous (recurse, recursion-method)
Usage: pt-table-checksum [OPTION...] [DSN]

Curse you, commandline option "smartness" :-(

Tags: all-tools
tags: added: all-tools
Changed in percona-toolkit:
status: New → Confirmed
Changed in percona-toolkit:
milestone: 2.0.4 → none
Revision history for this message
Brian Fraser (fraserbn) wrote :

Hm.. I'm partially against this, since at least two people on #percona found it useful for the new pt-diskstats.
Seeing how it's not documented anywhere, we can reserve the right to yank it out at any time, but until it becomes an actual maintenance hurdle, I don't see why it should go away.

Brian Fraser (fraserbn)
Changed in percona-toolkit:
assignee: nobody → Brian Fraser (fraserbn)
assignee: Brian Fraser (fraserbn) → Daniel Nichter (daniel-nichter)
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

I like prefixes, but I think the logical argument is against them because they can introduce ambiguities and weird breaks.

Changed in percona-toolkit:
milestone: none → 3.0.1
assignee: Daniel Nichter (daniel-nichter) → nobody
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :
Changed in percona-toolkit:
milestone: 3.0.1 → none
status: Confirmed → Invalid
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to:

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

Other bug subscribers