Skip to content

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Apr 2, 2020

This fixes compile errors trying to build bitcoin-tx and bitcoin-wallet without libevent, which were reported by Luke Dashjr in #18465

The fix avoiding bitcoin-tx dependency on libevent just adds a conditional build rule. This is implemented in the first commit (more details in commit description).

The fix avoiding bitcoin-wallet dependency on libevent requires minor code changes, because bitcoin-wallet (unlike bitcoin-tx) links against code that calls urlDecode / evhttp_uridecode. This fix is implemented in the second commit (again details in the commit description).

Don't include util/url.cpp to libbitcoin_util.a when libevent isn't available.
This fixes a compile error trying to build bitcoin-tx without libevent reported
by Luke Dashjr in bitcoin#18465

Fixes bitcoin#18465
Don't require urlDecode function in wallet code since urlDecode implementation
currently uses libevent. Just call urlDecode indirectly though URL_DECODE
function pointer constant if available.

In bitcoind and bitcoin-qt, URL_DECODE is implemented and used to interpret RPC
wallet requests. In bitcoin-wallet, URL_DECODE is null to avoid depending on
libevent.
@ryanofsky
Copy link
Contributor Author

Updated ddfe373 -> 01a3392 (pr/dep-libevent.1 -> pr/dep-libevent.2, compare) with msvc fix

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 3, 2020

Gitian builds

File commit dce6f3b
(master)
commit 8a62b9f
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz 4fba473976a3a85e... 0d64e50e2d3f59f1...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz c135739e69c4472d... e30313e60ae497ec...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz 06bb06c0f823bf90... 1f32dc21b2b701b5...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 7734e4d5cbcb4825... bc88b45b1e981d67...
bitcoin-0.19.99-osx-unsigned.dmg 0b344910a70199be... a857203c058c0b26...
bitcoin-0.19.99-osx64.tar.gz 46e9c05f70086290... eac6982eb274eebd...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz 7831492494057bba... 535f6b1abe9bcc58...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz f83ac254cfddb085... 9461af2417ad155b...
bitcoin-0.19.99-win64-debug.zip 604e4c5e227d50f0... ff4e0bc3d6086b09...
bitcoin-0.19.99-win64-setup-unsigned.exe b7fc22b59cfd6f6d... 69d02bb813f8a712...
bitcoin-0.19.99-win64.zip f2836d8a06e7d42c... 2456958b486469ab...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz 75df0e07d2339760... 5999775aa35e1fce...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz f3a6db85e94d7cff... 06b0f9039cfaae4d...
bitcoin-0.19.99.tar.gz b478cb46b9bb5433... a1a382d30fbbb817...
bitcoin-core-linux-0.20-res.yml ccc64b0731859e36... 0de1fdbeba9f53f7...
bitcoin-core-osx-0.20-res.yml af46833e50fab798... d0a755fa1d01a73a...
bitcoin-core-win-0.20-res.yml aa9152d74d049f56... 2e51f6b663bb34e3...
linux-build.log 984685556f83f6c0... fef31aab904b165a...
osx-build.log 1e5a6165090ecbec... 67449ea283c6fb2e...
win-build.log 7472b49c6539ee86... 65255c959c9db8d6...
bitcoin-core-linux-0.20-res.yml.diff 6033300b201259e3...
bitcoin-core-osx-0.20-res.yml.diff 5cb3edb9f1c0ff19...
bitcoin-core-win-0.20-res.yml.diff 8991f12e402dc537...
linux-build.log.diff 1701dfe791eb446e...
osx-build.log.diff f5ecaa77996b17c5...
win-build.log.diff aa1c34d8e895a371...

@jonasschnelli
Copy link
Contributor

utACK 01a3392.
Gitian Build: https://bitcoin.jonasschnelli.ch/gitian/build/74

@maflcko
Copy link
Member

maflcko commented Apr 8, 2020

cc @luke-jr

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

Kind of ugly, but utACK

Nit: URL_DECODE should probably be named g_url_decode_fn or something...

@ryanofsky
Copy link
Contributor Author

Nit: URL_DECODE should probably be named g_url_decode_fn or something...

Constant naming is used because it is a constant, not a global variable

@maflcko
Copy link
Member

maflcko commented Apr 8, 2020

Constant naming is used because it is a constant, not a global variable

G_URL_DECODE like G_TRANSLATION_FUN 😬 ?

@luke-jr
Copy link
Member

luke-jr commented Apr 8, 2020

G_URL_DECODE_FUN sounds better in that case...

But it's not really a constant - its value varies between builds.

@maflcko
Copy link
Member

maflcko commented Apr 8, 2020

The docs say "compile time constants", not "build time constants"

@maflcko
Copy link
Member

maflcko commented Apr 8, 2020

Anyway, I was mostly joking about that style nit. Let's not hold back this pull based on naming guidelines.

@luke-jr
Copy link
Member

luke-jr commented Apr 8, 2020

It's definitely not a compile time constant! ;)

@ryanofsky
Copy link
Contributor Author

It's definitely not a compile time constant! ;)

FWIW, following this up in #18568

@practicalswift
Copy link
Contributor

Concept ACK, but wouldn't it be easier to implement std::string urlDecode(const std::string &urlEncoded) without evhttp_uridecode?

It has always seemed weird to me that we depend on third-party code for such a trivial function :)

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 9, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@@ -77,9 +77,9 @@ bool HaveKey(const SigningProvider& wallet, const CKey& key)

bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name)
{
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
if (URL_DECODE && request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
Copy link

@sidhujag sidhujag Apr 13, 2020

Choose a reason for hiding this comment

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

Shouldn't this be #ifdef URL_DECODE, ie: on bitcoin-tx the symbol does not exist if libevent is not used.

Copy link
Member

Choose a reason for hiding this comment

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

The symbol URL_DECODE is always defined

Choose a reason for hiding this comment

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

my bad, thx

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 13, 2020
…encies on libevent

01a3392 Drop bitcoin-wallet dependency on libevent (Russell Yanofsky)
0660119 Drop unintended bitcoin-tx dependency on libevent (Russell Yanofsky)

Pull request description:

  This fixes compile errors trying to build bitcoin-tx and bitcoin-wallet without libevent, which were reported by Luke Dashjr in bitcoin#18465

  The fix avoiding `bitcoin-tx` dependency on libevent just adds a conditional build rule. This is implemented in the first commit (more details in commit description).

  The fix avoiding `bitcoin-wallet` dependency on libevent requires minor code changes, because `bitcoin-wallet` (unlike `bitcoin-tx`) links against code that calls `urlDecode` / `evhttp_uridecode`. This fix is implemented in the second commit (again details in the commit description).

ACKs for top commit:
  jonasschnelli:
    utACK 01a3392.

Tree-SHA512: d2245e912ab494cccceeb427a1eca8e55b01a0006ff93eebcfb5461ae7cecd1083ac2de443d9db036b18bdc6f0fb615546caaa20c585046f66d234937f74870a
PhotoshiNakamoto added a commit to PhotonicBitcoin/pBTC-core that referenced this pull request Dec 11, 2021
Bitcoin Core PR: bitcoin/bitcoin#18504

Pull request description:

  This fixes compile errors trying to build bitcoin-tx and bitcoin-wallet without libevent, which were reported by Luke Dashjr in bitcoin/bitcoin#18465

  The fix avoiding `bitcoin-tx` dependency on libevent just adds a conditional build rule. This is implemented in the first commit (more details in commit description).

  The fix avoiding `bitcoin-wallet` dependency on libevent requires minor code changes, because `bitcoin-wallet` (unlike `bitcoin-tx`) links against code that calls `urlDecode` / `evhttp_uridecode`. This fix is implemented in the second commit (again details in the commit description).
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants