Skip to content

Conversation

@str4d
Copy link
Contributor

@str4d str4d commented Mar 14, 2018

@str4d str4d added C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-rpc-interface Area: RPC interface labels Mar 14, 2018
@str4d str4d added this to the v1.1.0 milestone Mar 14, 2018
@str4d str4d requested review from braddmiller and mdr0id March 14, 2018 16:13
@str4d
Copy link
Contributor Author

str4d commented Mar 14, 2018

These are some generally useful changes, that also remove merge conflicts for bitcoin/bitcoin#8883, which itself will remove merge conflicts for pulling in the upstream Bech32 PRs for Sapling.

@str4d str4d requested a review from daira March 21, 2018 11:34
@str4d str4d added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 28, 2018
@zkbot
Copy link
Contributor

zkbot commented Mar 30, 2018

☔ The latest upstream changes (presumably #3098) made this pull request unmergeable. Please resolve the merge conflicts.

@str4d str4d force-pushed the cli-binary-improvements-1 branch from 5c2bf90 to 23959f5 Compare March 30, 2018 20:21
@str4d
Copy link
Contributor Author

str4d commented Mar 30, 2018

Rebased on master to fix merge conflict.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some non-blocking comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens to avoid the process table issue because echo is (usually) a shell builtin, but I think this would more clearly avoid it:

$ src/zcash-cli -stdin walletpassphrase
mysecretcode
120
^D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

static_assert(CONTINUE_EXECUTION != EXIT_FAILURE,
              "CONTINUE_EXECUTION should be different from EXIT_FAILURE");
static_assert(CONTINUE_EXECUTION != EXIT_SUCCESS,
              "CONTINUE_EXECUTION should be different from EXIT_SUCCESS");

(This problem will never occur on POSIX or Windows systems, but could technically occur on other platforms. Note that although EXIT_SUCCESS is equivalent to 0 as the return value from main, it is not necessarily defined to be 0.)

src/bitcoind.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an exit(1) on line 141 that should probably be return false;.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like that got changed to exit(EXIT_FAILURE). But I still think it should probably be return false, for consistency with other returns in that function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be addressed when we pull in bitcoin/bitcoin#10447 and bitcoin/bitcoin#11511 (which we can do in a subsequent PR).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another case of atoi being used on untrusted input; see #2075.

@str4d str4d modified the milestones: v1.1.0, v1.1.1 Apr 4, 2018
Copy link
Contributor

@braddmiller braddmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@zkbot
Copy link
Contributor

zkbot commented Apr 5, 2018

☔ The latest upstream changes (presumably #2814) made this pull request unmergeable. Please resolve the merge conflicts.

dgenr8 and others added 11 commits April 12, 2018 18:08
A non-zero locktime also causes input sequences to be set to
non-max, activating the locktime.
Implements #7442 by adding an option `-stdin` which reads
additional arguments from stdin, one per line.

For example

```bash
echo -e "mysecretcode\n120" | src/bitcoin-cli -stdin walletpassphrase
echo -e "walletpassphrase\nmysecretcode\n120" | src/bitcoin-cli -stdin
```
- `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error)
- error reading config file should exit with `1`

Slightly refactor AppInitRPC/AppInitRawTx to return standard exit codes (EXIT_FAILURE/EXIT_SUCCESS) or CONTINUE_EXECUTION (-1)
@str4d str4d force-pushed the cli-binary-improvements-1 branch from 23959f5 to abf5dd3 Compare April 13, 2018 00:28
@str4d
Copy link
Contributor Author

str4d commented Apr 13, 2018

Rebased on master to fix merge conflict, and address some of the non-blocking comments.

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Apr 13, 2018

📌 Commit abf5dd3 has been approved by str4d

@zkbot
Copy link
Contributor

zkbot commented Apr 13, 2018

⌛ Testing commit abf5dd3 with merge 3b0a5bcd249d98355ee57c197c9017ac4cf3eedc...

@str4d
Copy link
Contributor Author

str4d commented Apr 13, 2018

util-test failed because I didn't tweak the test case data for Zcash (binary renaming, and re-prefixing t-addrs). Pushed a trivial commit to fix.

@str4d
Copy link
Contributor Author

str4d commented Apr 13, 2018

@zkbot force

@str4d
Copy link
Contributor Author

str4d commented Apr 13, 2018

@zkbot r+ ee6220c

@zkbot
Copy link
Contributor

zkbot commented Apr 13, 2018

⌛ Testing commit ee6220c with merge 65a8f9f...

zkbot added a commit that referenced this pull request Apr 13, 2018
CLI binary improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5936
- bitcoin/bitcoin#7550
- bitcoin/bitcoin#7989
- bitcoin/bitcoin#7957
- bitcoin/bitcoin#9067
- bitcoin/bitcoin#9220

Excludes any changes that affected the QT code.
@zkbot
Copy link
Contributor

zkbot commented Apr 13, 2018

☀️ Test successful - pr-merge
Approved by: str4d
Pushing 65a8f9f to master...

@zkbot zkbot merged commit ee6220c into zcash:master Apr 13, 2018
@str4d str4d mentioned this pull request Apr 13, 2018
@str4d str4d deleted the cli-binary-improvements-1 branch April 13, 2018 13:37
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-hoc ACK abf5dd3 and ee6220c

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

Labels

A-rpc-interface Area: RPC interface C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants