Skip to content

Command line options after any non-hyphen arguments are silently ignored #741

@john-moffett

Description

@john-moffett

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

For example, invoking bitcoin-qt -server=1 foo -regtest on a fresh install will run mainnet instead of the expected regtest.

Expected behaviour

I would expect it to do one of the following:

  1. Run regtest
  2. Warn me that my arguments contained a "command" and any subsequent options were ignored
  3. Exit with an error message

The problem is that ArgsManager::ParseParameters interprets any non-hypen ('-' or '--') arguments as "commands", with later arguments being assigned to that command.

This is not an issue with bitcoind since it has additional logic to detect "loose" commands and refuses to start:

https://github.com/bitcoin/bitcoin/blob/c6287faae4c0e705a9258a340dfcf548906f12af/src/bitcoind.cpp#L127-L132

Steps to reproduce

Invoke bitcoin-qt foo -regtest on a fresh install

Relevant log output

No response

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

master@d6ee03507f39

Operating system and version

MacOS Ventura 13.5

Machine specifications

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions