Problems with command-line options silently ignored #1044

laanwj opened this Issue Apr 5, 2012 · 8 comments


None yet

4 participants

laanwj commented Apr 5, 2012

In this case, the rpcport argument is silently ignored:

-testnet -nolisten -server -connect -rpcport=12345

However, when adding a = after connect, it works, i.e.

-testnet -nolisten -server -connect= -rpcport=12345

It could be that the first is simply wrong; in that case, it should probably show an error message.

Diapolo commented Apr 6, 2012

I didn't look in the code, but if a case does not match the detection routine, why should there be an error? If the function searches for -connect= to do sth. it's not said it should throw an error if it only gets -connect.

laanwj commented Apr 6, 2012

Because it frustrates the shit out of users if they pass arguments and they somehow, without any clue, don't work.

Edit: and yes, it is a low-priority issue, but I do want to put it here just in case.

Diapolo commented Apr 6, 2012

I understand the intention, so you propose a standard for all parameters / switches an not only certain ones, right?


supplied "-connect IP" -> parameter incomplete
supplied "-conne=" -> parameter not recognized

laanwj commented Apr 6, 2012

Yep, something like that. I don't think the verification has to go very deep, just some sanity check.

my biggest gripe with the above really was that the rpcport argument is ignored, because the connect part is wrong, without any indication of either.

laanwj commented Jun 3, 2014

See the extensive discussion in #4194 on possible solutions for this.

@laanwj laanwj changed the title from Command-line options sometimes silently ignored to Problems with command-line options silently ignored Jun 3, 2014
laanwj commented Nov 24, 2015

Other long-term improvements to option parsing would be:

  • Type-safe argument parsing. Prevent issues where arguments are assigned to signed integer types in one place and unsigned in other place. Same issue with different sizes (32 versus 64).
  • Parse arguments once, in initialization. There is no need to parse arguments from string every time they are used, which tends to happen now.

Also unknown (=deprecated) params should be detected.

Links to #4194 (comment)

jtimon commented Jan 19, 2016

It would be also nice if all the glohal initializations were in init.o (obviously not for bitcoin-tx) and getArg () [which internally uses the global argsMap] wasn't call from all over the place (and new places when we introduce new functionality but are too lazy to properly implement the new command line options or is not a priority to o things right(tm) (ie like in the case of the mempool limit ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment