Skip to content

get: harden repos.json save/load against empty/corrupted state#33

Open
timkicker wants to merge 1 commit intofortheusers:mainfrom
timkicker:fix/repos-json-resilience
Open

get: harden repos.json save/load against empty/corrupted state#33
timkicker wants to merge 1 commit intofortheusers:mainfrom
timkicker:fix/repos-json-resilience

Conversation

@timkicker
Copy link
Copy Markdown

@timkicker timkicker commented May 3, 2026

Fixes fortheusers/hb-appstore#163.
saveRepos now writes via tmp + atomic rename with fsync and loadRepos regenerates the default for empty/corrupted files (with the bad file preserved as repos.json.bad).

  state

saveRepos writes via tmp + atomic rename with fsync, so a crash
  mid-write can't truncate the file. loadRepos regenerates the default when
  the parsed repos array is empty or the JSON is corrupted; on parse failure
  the bad file is moved to repos.json.bad instead of being overwritten.
  Drive-by: missing <cstdint> include in Utils.hpp.

Closes
  fortheusers/hb-appstore#163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(WIIU) hb app store keeps emptying ./get/repos.json

1 participant