#27409 Make GUI and CLI tools use the same datadir

ReviewabilityReviewsAgreementSize
#27409 ryanofsky Make GUI and CLI tools use the same datadirAuthor silent 383d0Blocked455 + 10 tests
  • Ensure GUI and CLI tools default to the same datadir
  • Prevent CLI tools from silently using the wrong datadir, re-downloading blocks, or missing wallets
  • Review #27302 first
  • Wait for author update: needs rebase, author noted PR is in-progress, and author has been silent for 349 days
  • No review verdicts recorded
  • Unaddressed objection: Windows shell CSIDL retrieval fails in functional tests (pinheadmz)
  • Clarified concern about bitcoin.conf placement in GUI-selected datadir (luke-jr)
  • 455 lines added or modified outside tests
  • 10 lines added or modified in tests
  • 103 lines removed in total
  • 13 files, 3 commits
Utilities (logging, arguments, libraries)#6 of 59
P2 · bug fix
  • P2 because it prevents silent datadir divergence, duplicate block syncs, and missing wallets
  • Fixes a configuration flaw where CLI tools ignore custom datadirs selected via the GUI
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Aligns the data directory used by GUI and CLI tools by default. Rather than storing custom GUI directory paths in platform-specific Qt settings that CLI tools ignore, the GUI establishes a symlink or fallback text file at the default datadir location pointing to the target directory. It also updates `bitcoin-wallet` and test harnesses to parse config files during initialization.

Problem: When users select a custom data directory via the GUI setup screen, the setting is saved to Qt settings (`strDataDir` in config files, plist, or registry) which CLI tools cannot read. As a result, running `bitcoind`, `bitcoin-cli`, or `bitcoin-wallet` without an explicit `-datadir` argument either errors out or silently accesses a completely different datadir, risking duplicate block downloads and inaccessible wallets.

Evidence of importance:

  • Author notes in commit 5864569922: 'This means `bitcoin-cli` and `bitcoin-wallet` will try to use the wrong datadir and show errors if they are called without a -datadir arguments, and `bitcoind` will appear to work but use a different datadir, not loading the same wallets and settings, and downloading blocks into the wrong place.'
  • Author notes follow-up relationship to bitcoin-core/gui#602 and related inconsistencies identified in #27273.

Scope: A significant portion of the PR (+282/-40) resides in the Qt intro dialog (`src/qt/intro.cpp`) to handle datadir selection, migration of legacy `strDataDir` Qt settings, and conflict resolution prompts if existing GUI and CLI datadirs disagree.

What the assessment lacked:

  • rest_of_diff

Reviewability

Stale · Author silent 383d

No author activity for 383 days; a review may wait a long time for a response.

Waiting on (from the thread read):

  • author: author stated PR is in-progress and not ready yet, plus needs to fix Windows test issue 2024-06-28
  • author: completing draft implementation, resolving Windows CSIDL issue, and adding Qt tests 2024-06-28

Agreement

Blocked

objection that needs a change, nobody has replied (pinheadmz)

Thread notes: Added question from luke-jr about bitcoin.conf placement which was answered and settled. Updated pinheadmz's Windows test failure objection clears_with to change. / Added luke-jr's question from c:1603385642 which was answered and settled. Updated pinheadmz's claim to clears_with change as it reports a defect in test execution.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
luke-jr (member)question, correctnessWon't this change or break putting bitcoin.conf in the GUI-selected datadir?accepted · author replied and luke-jr confirmed he had not checked the code yet and was only asking from the PR descriptionansweredyes2023-06-22: 'Won't this change/break putting the bitcoin.conf in the GUI-selected datadir?'
Status from: 2023-06-22: luke-jr: 'No, I didn't get to the code yet - was just commenting from the description of this PR and #27302'
pinheadmz (member)objection, correctnessWindows shell CSIDL retrieval fails in feature_config_args functional testopenchangedno2023-10-03: 'Confirmed, doesn't work :-('

Participants:

  • pinheadmz (member, objection, 2 statements 2023-04-15 to 2023-10-03): noted issue 8106 and reported broken Windows CSIDL logic in functional tests
  • luke-jr (member, question, 2 statements 2023-06-22 to 2023-06-22): asked whether datadir changes break bitcoin.conf placement, clarifying it was just an initial reaction
  • maflcko (member, neutral, 1 statements 2024-06-28 to 2024-06-28): asked for a status update

Dependencies

Depends on: #27302

Files

12 lines under test/bench/ci.

  • src/qt/intro.cpp +282/-40
  • src/common/config.cpp +127/-13
  • src/common/init.cpp +9/-21
  • src/common/args.h +17/-1
  • src/qt/bitcoin.cpp +9/-3
  • src/common/args.cpp +1/-10
  • src/qt/optionsmodel.cpp +0/-11
  • src/test/argsman_tests.cpp +5/-0
  • src/test/util/setup_common.cpp +4/-1
  • src/bitcoin-wallet.cpp +4/-0
  • src/common/init.h +3/-1
  • src/qt/intro.h +3/-1
  • test/functional/tool_wallet.py +1/-1

Card

The short text the ranking pass compares across PRs.

Synchronizes default datadir handling between GUI and CLI binaries so choosing a custom directory in the GUI applies universally across the toolchain. Currently, custom GUI datadirs are stored in Qt settings that CLI utilities ignore, leading `bitcoin-cli`, `bitcoin-wallet`, and `bitcoind` to look in standard paths and produce errors or split state unless `-datadir` is passed explicitly. The change enables default datadir paths to redirect via symlinks or plain-text files pointing to external targets, migrates existing GUI configs, and updates the wallet tool to load config files. It builds on the merged #27302.

Data

dossier JSON · extract JSON · model ledger, generated 2026-09-29T01:27, confidence high, input hash 16b3735233e58f83
thread read through 2024-06-28 (8 statements), head 5864569922
labels: Needs rebase · draft

Categories

Utilities (logging, arguments, libraries)

P2 · bug fix

Resolves a long-standing configuration flaw where CLI tools ignore custom data directories selected via the GUI, preventing silent datadir divergence, duplicate syncs, and missing wallets.

Membership: Changes argument, config, and startup handling across src/common/config.cpp, src/common/args.cpp, and src/common/init.cpp.

Factors: security/stability 1, bug 2, performance 0, user value 2, leverage 1