macOS: QML ignores Bitcoin-Qt’s saved custom data directory #1076

Open
opened 2026-11-05 17:22:41 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-05 17:22:41 +00:00 (Migrated from github.com)

On macOS, QML’s legacy-settings reader opens a different preference domain from the one Bitcoin-Qt uses. As a result, QML fails to discover Bitcoin-Qt’s saved custom data directory and presents the storage-location page with Default selected.

This breaks the existing-profile adoption implemented in #742. The existing directory remains available and can be selected manually, but continuing with Default can initialize a separate node directory.

Steps to reproduce

  1. On macOS, use Bitcoin-Qt’s directory chooser to select a custom data directory and start the node.
  2. Exit Bitcoin-Qt.
  3. Launch QML under the same user account, with no existing QML directory preference and without passing -datadir.
  4. Proceed through onboarding to the storage-location page.

Actual behavior

QML does not recognize Bitcoin-Qt’s saved directory. It offers Default storage rather than adopting the existing custom location.

Expected behavior

QML should discover Bitcoin-Qt’s saved custom directory and treat it as an existing profile. First-run QML onboarding may still be necessary, but it should use that profile and preserve its settings.

Cause

Bitcoin-Qt sets its organization name to Bitcoin and its organization domain to bitcoin.org. Its default-constructed QSettings therefore uses this macOS preference domain:

org.bitcoin.Bitcoin-Qt

In qml/legacy_settings_migration.cpp, OpenLegacyDataDirSettings() instead calls OpenSettings("Bitcoin", "Bitcoin-Qt"). That helper uses the explicit organization-name constructor, which does not inherit Bitcoin-Qt’s organization domain. Qt generates a .com domain from the supplied name, so QML reads:

com.bitcoin.Bitcoin-Qt

QmlDataDir::ReadGuiDataDirWithSource() consequently finds no legacy strDataDir and falls back to the default location.

Linux uses the organization name directly, so this specific domain mismatch concerns native macOS preferences. The fix should preserve each platform’s existing settings identity.

Existing test coverage

legacyQtDataDirFallbackReadsOldQtSetting explicitly tests that QML adopts the legacy directory. However, its fixture writes the preference using the same organization-name constructor as the reader. On macOS, both access the same incorrect domain, so the test does not establish compatibility with Bitcoin-Qt’s actual preferences.

Coverage should create the legacy preference using Bitcoin-Qt’s organization name, domain and application name, then verify that QML discovers it.

Reproduced on merged qt6 at 6e54a48ab571, macOS arm64, Qt 6.9.0. In isolated native-preference tests, installed Bitcoin-Qt 25.1 successfully opened a seeded custom-directory profile; after its clean shutdown, QML missed that same profile. A control placing the setting in the domain QML reads successfully opened the custom directory. The saved preference was seeded rather than created through Bitcoin-Qt’s chooser.

Related: #704 and #742. The legacy lookup in the current #883 branch at 8e5b4d1f090a still uses the same organization-name constructor.

On macOS, QML’s legacy-settings reader opens a different preference domain from the one Bitcoin-Qt uses. As a result, QML fails to discover Bitcoin-Qt’s saved custom data directory and presents the storage-location page with **Default** selected. This breaks the existing-profile adoption implemented in #742. The existing directory remains available and can be selected manually, but continuing with Default can initialize a separate node directory. **Steps to reproduce** 1. On macOS, use Bitcoin-Qt’s directory chooser to select a custom data directory and start the node. 2. Exit Bitcoin-Qt. 3. Launch QML under the same user account, with no existing QML directory preference and without passing `-datadir`. 4. Proceed through onboarding to the storage-location page. **Actual behavior** QML does not recognize Bitcoin-Qt’s saved directory. It offers **Default** storage rather than adopting the existing custom location. **Expected behavior** QML should discover Bitcoin-Qt’s saved custom directory and treat it as an existing profile. First-run QML onboarding may still be necessary, but it should use that profile and preserve its settings. **Cause** Bitcoin-Qt sets its organization name to `Bitcoin` and its organization domain to `bitcoin.org`. Its default-constructed `QSettings` therefore uses this macOS preference domain: `org.bitcoin.Bitcoin-Qt` In `qml/legacy_settings_migration.cpp`, `OpenLegacyDataDirSettings()` instead calls `OpenSettings("Bitcoin", "Bitcoin-Qt")`. That helper uses the explicit organization-name constructor, which does not inherit Bitcoin-Qt’s organization domain. Qt generates a `.com` domain from the supplied name, so QML reads: `com.bitcoin.Bitcoin-Qt` `QmlDataDir::ReadGuiDataDirWithSource()` consequently finds no legacy `strDataDir` and falls back to the default location. Linux uses the organization name directly, so this specific domain mismatch concerns native macOS preferences. The fix should preserve each platform’s existing settings identity. **Existing test coverage** `legacyQtDataDirFallbackReadsOldQtSetting` explicitly tests that QML adopts the legacy directory. However, its fixture writes the preference using the same organization-name constructor as the reader. On macOS, both access the same incorrect domain, so the test does not establish compatibility with Bitcoin-Qt’s actual preferences. Coverage should create the legacy preference using Bitcoin-Qt’s organization name, domain and application name, then verify that QML discovers it. Reproduced on merged `qt6` at `6e54a48ab571`, macOS arm64, Qt 6.9.0. In isolated native-preference tests, installed Bitcoin-Qt 25.1 successfully opened a seeded custom-directory profile; after its clean shutdown, QML missed that same profile. A control placing the setting in the domain QML reads successfully opened the custom directory. The saved preference was seeded rather than created through Bitcoin-Qt’s chooser. Related: #704 and #742. The legacy lookup in the current #883 branch at `8e5b4d1f090a` still uses the same organization-name constructor.
Sign in to join this conversation.
No description provided.