util: Treat empty settings.json file as valid #23096

pull AaronDewes wants to merge 2 commits into bitcoin:master from AaronDewes:allow-empty-settings-json changing 1 files +7 −0
  1. AaronDewes commented at 6:55 pm on September 25, 2021: none

    Previously, if the settings.json file was empty, it failed to parse. Now, it is handled like non-existent, which should help avoid issues if

    • The user decides to empty it
    • The file gets saved improperly
    • The user touches it before starting Bitcoin Core
  2. util: Treat empty settings.json file as valid
    Previously, if the settings.json file was empty, it failed to parse.
    Now, it is handled like non-existent, which should help avoid issues if
    
    - The user decides to empty it
    - The file gets saved improperly
    - The user touches it before starting Bitcoin Core
    ab20d62080
  3. DrahtBot added the label Utils/log/libs on Sep 25, 2021
  4. Still throw permission errors 9269918cbc
  5. ryanofsky commented at 11:31 am on September 27, 2021: member

    A zero size settings file is a corrupt settings file, not different from other corrupt files. If critical settings that affect security, privacy, or performance (tor settings, pruning settings, etc) have been configured it could be harmful to ignore corruption like nothing happened.

    For non interactive bitcoind use, when corrupt settings are detected I think the best thing bitcoin can do is print a clear and helpful error message and not start when it detects corruption. For interactive GUI use, the application can be more proactive and give an option to reset the corrupt file or move it out of the way.

    The current behavior may not be ideal if the error message is not clear about the problem and potential fixes, or if the GUI is not presenting enough options. It seems useful to do a good job handling this case because the settings file is one of the first files read on startup, and if it has a problem, it could be indication of other problems with the datadir. Maybe also the settings file could be written in a more robust way, like maybe it would help to add a sync call before renaming on write. But I don’t think allowing corruption would be a good thing to do here.

  6. AaronDewes closed this on Sep 28, 2021

  7. DrahtBot locked this on Oct 30, 2022

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

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