diff options
author | fanquake <fanquake@gmail.com> | 2023-09-05 11:40:21 +0300 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-09-05 11:41:02 +0300 |
commit | 337d6f35a29c2a009e22860c6e2fc93b79b650d8 (patch) | |
tree | 6f8198684d13851aaf716966ce3f89738e1f63ca | |
parent | 6f03c45f6bb5a6edaa3051968b6a1ca4f84d2ccb (diff) | |
parent | 6e8f6468cbf1320b70cf01333002a31b44cb7c33 (diff) |
Merge bitcoin/bitcoin#28291: rpc: removed StrFormatInternalBug quote delimitation
6e8f6468cbf1320b70cf01333002a31b44cb7c33 removed StrFormatInternalBug quote delimitation (Reese Russell)
Pull request description:
This PR rectifies an unnecessary set of quotes delimiting the contents of ```StrFormatInternalBug```. This is a follow up to MarcoFalke https://github.com/bitcoin/bitcoin/pull/28123#discussion_r1297191493. The method of action was to remove the escaped quotes that were a part of strprintf. A single functional test case was modified to reflect the new output format.
```STR_INTERNAL_BUG``` was applied to https://github.com/bitcoin/bitcoin/pull/28123 in ```std::string RPCArg::ToString(const bool oneline)``` in ```rpc/util.cpp```
The results can be seen below.
Previously

This PR

Additional context can be found here.
https://github.com/bitcoin/bitcoin/pull/28123#discussion_r1271871716
Thank you.
ACKs for top commit:
MarcoFalke:
review ACK 6e8f6468cbf1320b70cf01333002a31b44cb7c33
stickies-v:
ACK 6e8f6468cbf1320b70cf01333002a31b44cb7c33
Tree-SHA512: 35317e31a527630495b566407e37db9941dab7f81cfaeb1ea3309683c48e4273284645ad615f73e646a137b4f2ae35933603e9182a7dbdd22cac98d038c491dc
-rw-r--r-- | src/rpc/util.cpp | 7 | ||||
-rw-r--r-- | src/util/check.cpp | 2 | ||||
-rwxr-xr-x | test/functional/rpc_misc.py | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 45b7d89a7b..74ef04033e 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -1187,10 +1187,9 @@ std::string RPCArg::ToString(const bool oneline) const if (oneline && !m_opts.oneline_description.empty()) { if (m_opts.oneline_description[0] == '\"' && m_type != Type::STR_HEX && m_type != Type::STR && gArgs.GetBoolArg("-rpcdoccheck", DEFAULT_RPC_DOC_CHECK)) { throw std::runtime_error{ - strprintf("Internal bug detected: non-string RPC arg \"%s\" quotes oneline_description:\n%s\n%s %s\nPlease report this issue here: %s\n", - m_names, m_opts.oneline_description, - PACKAGE_NAME, FormatFullVersion(), - PACKAGE_BUGREPORT)}; + STR_INTERNAL_BUG(strprintf("non-string RPC arg \"%s\" quotes oneline_description:\n%s", + m_names, m_opts.oneline_description) + )}; } return m_opts.oneline_description; } diff --git a/src/util/check.cpp b/src/util/check.cpp index 795dce7124..c4d4b0cc28 100644 --- a/src/util/check.cpp +++ b/src/util/check.cpp @@ -18,7 +18,7 @@ std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func) { - return strprintf("Internal bug detected: \"%s\"\n%s:%d (%s)\n" + return strprintf("Internal bug detected: %s\n%s:%d (%s)\n" "%s %s\n" "Please report this issue here: %s\n", msg, file, line, func, PACKAGE_NAME, FormatFullVersion(), PACKAGE_BUGREPORT); diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py index 43d1e2c731..20485c01d3 100755 --- a/test/functional/rpc_misc.py +++ b/test/functional/rpc_misc.py @@ -27,7 +27,7 @@ class RpcMiscTest(BitcoinTestFramework): self.log.info("test CHECK_NONFATAL") assert_raises_rpc_error( -1, - 'Internal bug detected: "request.params[9].get_str() != "trigger_internal_bug""', + 'Internal bug detected: request.params[9].get_str() != "trigger_internal_bug"', lambda: node.echo(arg9='trigger_internal_bug'), ) |