Review report

bitcoin-core/gui-qml: PR #883

5 minor findings · 1 suggestion

Findings

Link

[minor] · Config-redirected data directories can crash pre-init resolution

A bitcoin.conf data directory that the launching user cannot search can now cause an uncaught filesystem exception instead of opening the directory chooser.

Location: qml/onboarding_settings.cpp:861 (head).

Details and suggested fix

custom_datadir_usable validates only the saved GUI selection, not a directory subsequently selected by datadir= in bitcoin.conf. Core can stat that directory successfully even when POSIX permissions prevent searching it. ReadResolvedProfile then reads settings.json outside the config-reading catch, and the pinned Core's throwing fs::exists can raise EACCES for the child path. This escapes pre-init resolution without a GUI error. Base validated the resolved custom directory before reading settings and offered the chooser for the non-writable case. Validate the resolved non-command-line directory before reading settings, retaining the chooser fallback, and catch filesystem exceptions across the complete profile read. No user report of this configuration was found; the trigger requires permissions that restrict the launching user.


Link

[minor] · Unwritable legacy settings can block ordinary startup

With no onboarding or reset, a failed legacy-settings cleanup now rolls back settings.json and aborts startup, even when the legacy values were already migrated.

Location: qml/onboarding_settings.cpp:1214 (head).

Details and suggested fix

A readable legacy QSettings store can still contain keys whose values already exist in settings.json. Persist mode removes those keys anyway, marks the store dirty, and synchronizes it. If file or directory permissions prevent writeback, CommitStores reports an error and FinalizeStartupSettings rolls back settings.json and returns false, causing ordinary startup to exit. Base ignored the sync failure and continued, so leftover keys can make this repeat on every launch after upgrading. The unchanged-store guard does not help a store containing these keys. On ordinary startup, report failed cleanup as a warning and retain the committed Core settings, while preserving strict rollback for onboarding apply and reset. Already-migrated values need not be removed from the legacy store for startup to proceed.


Link

[minor] · A new folder can trigger false profile drift with an absolute -conf

Selecting a nonexistent custom folder skips configuration in Preview, so an absolute -conf selecting a different chain or reset flag makes finalization reject an unchanged profile.

Location: qml/onboarding_settings.cpp:998 (head).

Details and suggested fix

For a custom folder that does not yet exist, Preview skips ReadResolvedProfile and records the command-line chain, reset flag, and derived settings path. refreshPreview replaces the model's target with those values, and prepareNode marks it complete. After preparation creates the folder, InitConfig reads the absolute -conf independently of the data directory. A configuration selecting, for example, testnet4=1 or resetguisettings=1 then fails ValidatePendingApply, despite no external change. Startup stops after Core has created the network directory and written settings.json. Base read configuration during apply without this comparison. Resolve an absolute configuration during preview even for a nonexistent selection, then derive the expected target from it. No user report was found; this requires both an absolute -conf and a newly selected folder.


Link

[minor] · Malformed settings.json is overwritten before its backup is saved

Reset recovery retains malformed settings.json only in memory while Core replaces it, so a subsequent GUI-store or backup-write failure can lose the original bytes.

Location: qml/bitcoin.cpp:349 (head).

Details and suggested fix

When the user selects Reset, or supplies -resetguisettings, ErrorSettingsRead captures the original bytes in a local optional and permits InitConfig to continue. The pinned Core immediately writes a replacement settings file. The raw-byte .bak is not committed until finalization, after the active and bootstrap GUI-store checks. An unreadable required store can return before that backup, and a failed backup commit also returns without restoring the original file. Exiting then discards the in-memory copy, potentially leaving no copy of the malformed bytes. Base rejected the malformed settings read before replacing the file. Commit the raw-byte backup inside the recovery callback before authorizing replacement, and abort if preservation fails. This requires a malformed settings file plus a second failure.


Link

[minor] · Nested custom settings paths fail before their parent is created

First-time onboarding with a missing parent for -settings now fails because InitConfig writes the file before the GUI helper creates that parent.

Location: qml/bitcoin.cpp:663 (head).

Details and suggested fix

For a fresh profile with -settings=sub/settings.json, or an absolute settings path with a missing parent, the read-only preview accepts the absent file. After confirmation, PrepareApplyToArgs creates the data directory but not the settings parent. InitConfig then attempts the first settings write, opening the temporary file directly, and returns FAILED_WRITE. The GUI's EnsureSettingsDirectory runs only during later finalization, which is never reached. Base applied onboarding through that helper before calling InitConfig. Create the resolved settings parent after confirmation and before Core's first write, without re-reading configuration into live arguments. Manually creating the parent works around the failure. No current caller or user supplying a nested -settings path was found, so production occurrence is unconfirmed.


Optional improvements

Link

[suggestion] · Explicit listen-off choices are elided when onboarding enables a proxy

On a fresh or reset profile, explicitly disabling listening before enabling a proxy no longer saves listen=false, so removing the proxy later can restore listening after restart.

Location: qml/onboarding_settings.cpp:625 (head).

Details and suggested fix

ApplyPendingCoreSettings now writes the proxy first and recomputes parameter interactions before writing listening. With no existing listen override, Core soft-sets listening off for the proxy. GuiOverrideValue then treats the touched listen=false as redundant and removes its persistent key. Base computed interactions before the new proxy was written and saved that choice; the functional fixture now explicitly expects the key to be absent. Preserve an explicitly touched listen-off value even when it equals the proxy-implied value, so it survives later proxy removal. This keeps current proxy behavior while retaining the user's independent choice. Matching the Settings page's elision policy does not provide that persistence; if implication rather than persistence is intended, make that policy explicit to users.


Coverage details