aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-05-21 10:52:46 +0200
committerfanquake <fanquake@gmail.com>2021-06-30 10:23:51 +0800
commit70eac6fcd02b6c44cb4b1f2fb895eae147e3f490 (patch)
tree2e520127b2a886a4ee525a42ec852e54e8e95d5b
parentc5357fa4151e1ac90427ae0493a7bb3e451f8de5 (diff)
Fix crash when parsing command line with -noincludeconf=0
Github-Pull: #22002 Rebased-From: fa9f711c3746ca3962f15224285a453744cd45b3
-rw-r--r--src/util/system.cpp2
-rwxr-xr-xtest/functional/feature_includeconf.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 5f30136fa2..3512bb8bff 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -340,7 +340,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
bool success = true;
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
for (const auto& include : util::SettingsSpan(*includes)) {
- error += "-includeconf cannot be used from commandline; -includeconf=" + include.get_str() + "\n";
+ error += "-includeconf cannot be used from commandline; -includeconf=" + include.write() + "\n";
success = false;
}
}
diff --git a/test/functional/feature_includeconf.py b/test/functional/feature_includeconf.py
index 6f1a0cd348..8eb20adf5b 100755
--- a/test/functional/feature_includeconf.py
+++ b/test/functional/feature_includeconf.py
@@ -43,7 +43,14 @@ class IncludeConfTest(BitcoinTestFramework):
self.log.info("-includeconf cannot be used as command-line arg")
self.stop_node(0)
- self.nodes[0].assert_start_raises_init_error(extra_args=["-includeconf=relative2.conf"], expected_msg="Error: Error parsing command line arguments: -includeconf cannot be used from commandline; -includeconf=relative2.conf")
+ self.nodes[0].assert_start_raises_init_error(
+ extra_args=['-noincludeconf=0'],
+ expected_msg='Error: Error parsing command line arguments: -includeconf cannot be used from commandline; -includeconf=true',
+ )
+ self.nodes[0].assert_start_raises_init_error(
+ extra_args=['-includeconf=relative2.conf'],
+ expected_msg='Error: Error parsing command line arguments: -includeconf cannot be used from commandline; -includeconf="relative2.conf"',
+ )
self.log.info("-includeconf cannot be used recursively. subversion should end with 'main; relative)/'")
with open(os.path.join(self.options.tmpdir, "node0", "relative.conf"), "a", encoding="utf8") as f: