mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Fix crash when parsing command line with -noincludeconf=0
This commit is contained in:
parent
eb4df9a628
commit
fa9f711c37
2 changed files with 9 additions and 2 deletions
|
@ -369,7 +369,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
||||||
bool success = true;
|
bool success = true;
|
||||||
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
|
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
|
||||||
for (const auto& include : util::SettingsSpan(*includes)) {
|
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;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,14 @@ class IncludeConfTest(BitcoinTestFramework):
|
||||||
|
|
||||||
self.log.info("-includeconf cannot be used as command-line arg")
|
self.log.info("-includeconf cannot be used as command-line arg")
|
||||||
self.stop_node(0)
|
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)/'")
|
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:
|
with open(os.path.join(self.options.tmpdir, "node0", "relative.conf"), "a", encoding="utf8") as f:
|
||||||
|
|
Loading…
Add table
Reference in a new issue