When naming a configuration file using a relative path using the -conf
command line parameter, the configuration parser will present an error if the datadir
option is listed in the named configuration file. The configuration parser will expect the named config file in both the default datadir
and the named datadir
.
For example. Given the config file named usb.conf
with the contents:
0# Bitcoin Config file: %APPDATA%\Bitcoin\usb.conf
1datadir=D:\Bitcoin
And calling bitcoin with the following "%PROGRAMFILES%\Bitcoin\Bitcoin-qt.exe" -conf=usb.conf
the config parser will present an error if D:\Bitcoin\usb.conf
does not exist. Clearly it has found and parsed %APPDATA%\Bitcoin\usb.conf
but yet it still needs to parse D:\Bitcoin\usb.conf
Expected behavior
Command line arguments should trump config file arguments. So since -datadir
is not specified on the command line, the location for the named config file should correctly resolve to %APPDATA%\Bitcoin\usb.conf
without further dependencies on D:\Bitcoin\usb.conf
. Once the initial path location is resolved, it should not be reevaluated. This is understandably a “special case”. Normally relative paths are resolved from datadir
, but the -conf
parameter is already special in the sense that is not supported in the config file parsing, so should not be influenced by what is parsed from the config file.
Actual behavior
The config parser throws an error if the config file does not exist both in the default datadir
and the named datadir
Note, as a workaround, providing the full path to the config file mutes the error. This is only related to how relative paths are interpreted.
To reproduce
Completely reproducible
System information
- Windows 10.0.18363 Build 18363
- Precompiled 0.20.1 Windows x64 binaries landed from installer downloaded from
bitcoin.org
- Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz, 3001 Mhz, 4 Core(s), 4 Logical Processor(s)
- Disk0: WDC WD10EZEX
- Disk1: Generic USB mounted SSD