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

issue ryanofsky openend 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. 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 :)

  4. 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!

  5. willcl-ark referenced this in commit 8fcbdadfad on Mar 9, 2023
  6. fanquake closed this on Mar 11, 2023

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


ryanofsky hebasto

Labels
Bug


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: 2024-12-27 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me