pingcap / pingcap/tiup

single-dash options are not handled correctly

Open
#1,373 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/tiup type/bug
Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

TiUP fails to pass multi-character ("long") options with a single-dash prefix to subcomponents.

  1. What did you expect to see?

  2. What did you see instead?

It seems that somehow whatever tiup is doing to proxy the options to the subcommand results in them being mishandled?

It seems that when the option has a single-dash prefix and contains an "h", it's interpreted as "-h" (help/usage output) when sent through tiup but not when the tool is invoked directly!

ubuntu@ip-10-0-1-86:~$ tiup --help tidb-lightning -backend tidb -tidb-host 127.0.0.1
use `tiup install --help` to install component `--help` first: component not installed
ubuntu@ip-10-0-1-86:~$ ~/.tiup/components/tidb-lightning/v5.0.1/tidb-lightning -tidb-host 127.0.0.1
Verbose debug logs will be written to /tmp/lightning.log.2021-05-19T22.47.34Z

tidb lightning encountered error:  cannot fetch settings from TiDB, please manually fill in `tidb.port` and `tidb.pd-addr`: Get http://127.0.0.1:10080/settings: dial tcp 127.0.0.1:10080: connect: connection refused
ubuntu@ip-10-0-1-86:~$ tiup tidb-lightning -tidb-host 127.0.0.1
Usage:
  -L value
        log level: info, debug, warn, error, fatal (default info)
  -V    print version of lightning
  -analyze value
        analyze table after importing
  -backend value
        delivery backend: importer, tidb, local (default importer)
...
  1. What version of TiUP are you using (tiup --version)?
1.4.3 tiup
Go Version: go1.16.4
Git Ref: v1.4.3
GitHash: 0faec47a553138b68c4e1529a771746cc2e17011

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown TiUP 1.4.3 commands, comparing tiup tidb-lightning -tidb-host 127.0.0.1 with the direct tidb-lightning invocation. Trace how TiUP proxies component arguments, especially single-dash multi-character options containing h. Done means these options reach the subcomponent unchanged instead of producing TiUP or help output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.