Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

--help option returns 1, not 0 #8851

Closed
MarkusTeufelberger opened this issue Jun 10, 2018 · 4 comments · Fixed by #8863
Closed

--help option returns 1, not 0 #8851

MarkusTeufelberger opened this issue Jun 10, 2018 · 4 comments · Fixed by #8863
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M4-core ⛓ Core client code / Rust. P5-sometimesoon 🌲 Issue is worth doing soon.
Milestone

Comments

@MarkusTeufelberger
Copy link

I'm running:

  • Which Parity version?: 1.10.6
  • Which operating system?: Linux
  • How installed?: binaries
  • Are you fully synchronized?: no
  • Which network are you connected to?: none
  • Did you try to restart the node?: no

Your issue description goes here below. Try to include actual vs. expected behavior and steps to reproduce the issue.

Expected behavior:

ethkeys --help (and the other binaries too) display a help message and exist the binary with code 0.

Actual behavior:

All binaries return with 1 instead. This usually indicates some failure mode.

@gnunicorn
Copy link
Contributor

Thanks for reporting, @MarkusTeufelberger.

Confirming this is happening and is not as we want it to be. Looks like we are not properly using docopts to figure out, whether we have a fatal or non-fatal exit. I have a patch for that.

@MarkusTeufelberger

and the other binaries too

Can you tell me which ones show that behaviour? parity itself works as expected (on master). If I am submitting a patch I'd like to fix it wherever we might have that issue.

@MarkusTeufelberger
Copy link
Author

Did you try the official binaries or are you building from master? I tried the binaries (1.10.6 as mentioned above) and all 4 had this behavior in a ubuntu:18.04 docker container from dockerhub.

gnunicorn added a commit to gnunicorn/parity that referenced this issue Jun 11, 2018
Docopt handles `--help` automatically for us, however we've handled those
Errors the same as all others: by exiting with Return Code `1`, which is wrong
for a totally appropriate a quit on `--help`. Fortunately `docopt:Error`
provides an `exit` helper function that discriminates properly between fatal
and non-fatal errors and exist appropriately.

This patch makes sure we use that handy function in case we encounter such an
error in the CLI of ethkey, ethstore and whisper. Thus those are now giving
the appropriate Return code on `--help`.

fixes openethereum#8851
@gnunicorn
Copy link
Contributor

gnunicorn commented Jun 11, 2018

@MarkusTeufelberger yes, I am checking this against master - ignoring where it has been fixed already.

I was able to confirm the bug on the CLI of whisper, ethstore and ethkey, however, parity and evmbin are not effected (they give the appropriate 0 return value on --help). And I've send in a PR to fix them, so the behaviour should be fixed in the next release!

@Tbaut Tbaut added P5-sometimesoon 🌲 Issue is worth doing soon. F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M4-core ⛓ Core client code / Rust. labels Jun 11, 2018
@Tbaut Tbaut added this to the 1.12 milestone Jun 11, 2018
@MarkusTeufelberger
Copy link
Author

Thanks! :-)

niklasad1 pushed a commit that referenced this issue Jun 11, 2018
Docopt handles `--help` automatically for us, however we've handled those
Errors the same as all others: by exiting with Return Code `1`, which is wrong
for a totally appropriate a quit on `--help`. Fortunately `docopt:Error`
provides an `exit` helper function that discriminates properly between fatal
and non-fatal errors and exist appropriately.

This patch makes sure we use that handy function in case we encounter such an
error in the CLI of ethkey, ethstore and whisper. Thus those are now giving
the appropriate Return code on `--help`.

fixes #8851
tavakyan referenced this issue in C4Coin/c4coin-parity Jun 14, 2018
Docopt handles `--help` automatically for us, however we've handled those
Errors the same as all others: by exiting with Return Code `1`, which is wrong
for a totally appropriate a quit on `--help`. Fortunately `docopt:Error`
provides an `exit` helper function that discriminates properly between fatal
and non-fatal errors and exist appropriately.

This patch makes sure we use that handy function in case we encounter such an
error in the CLI of ethkey, ethstore and whisper. Thus those are now giving
the appropriate Return code on `--help`.

fixes #8851
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. M4-core ⛓ Core client code / Rust. P5-sometimesoon 🌲 Issue is worth doing soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants