Bug: ArgsManager::ReadSettingsFile can return false even when it does load settings #22638

issue ryanofsky opened this issue on August 5, 2021
  1. ryanofsky commented at 7:13 PM on August 5, 2021: contributor

    Credit to @luke-jr for helping uncovering this bug https://github.com/bitcoin-core/gui/pull/379#discussion_r680408927

    This bug has no user-visible effects currently, but combined with PR bitcoin-core/gui#379 and a corrupt settings.json file that is corrupted specifically by specifying the same JSON keys multiple times, it can cause some dialog text added in that PR to be misleading. This is a basically an impossible-to-hit rube goldberg bug, but is only fixable at the util level not the GUI level, so I'm tracking this outside the GUI repository.

    Simplest fix would be to just change ReadSettingsFile to call rw_settings.clear() on error. It would also be nice to add a unit test for the regression.

    Code path that triggers this is:

    https://github.com/bitcoin/bitcoin/blob/d67330d11245b11fbdd5e2dd5343ee451186931e/src/util/system.cpp#L548 https://github.com/bitcoin/bitcoin/blob/d67330d11245b11fbdd5e2dd5343ee451186931e/src/util/settings.cpp#L89 https://github.com/bitcoin/bitcoin/blob/d67330d11245b11fbdd5e2dd5343ee451186931e/src/util/settings.cpp#L92

  2. ryanofsky added the label Bug on Aug 5, 2021
  3. ryanofsky cross-referenced this on Aug 5, 2021 from issue Prompt to reset settings when settings.json cannot be read by ryanofsky
  4. hebasto commented at 3:23 PM on August 6, 2021: member

    @ryanofsky

    Credit to @luke-jr for helping uncovering this bug bitcoin-core/gui#379 (comment)

    Looks like a link to @luke-jr's comment should be fixed :)

  5. ryanofsky commented at 3:59 PM on August 6, 2021: contributor

    Looks like a link to @luke-jr's comment should be fixed :)

    Thanks, fixed the link!

  6. willcl-ark referenced this in commit 8fcbdadfad on Mar 9, 2023
  7. willcl-ark cross-referenced this on Mar 10, 2023 from issue util: fix argsman dupe key error by willcl-ark
  8. fanquake closed this on Mar 11, 2023

  9. fanquake referenced this in commit 87af64a1a1 on Mar 11, 2023
  10. sidhujag referenced this in commit 7ef87fa38c on Mar 12, 2023
  11. bitcoin locked this on Mar 10, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:53 UTC