Skip to content

fix: keep edits and invalid content of the ignore file - #56

Open
Arthurvroum wants to merge 1 commit into
mainfrom
43-ignore-file-data-loss
Open

Arthurvroum wants to merge 1 commit into
mainfrom
43-ignore-file-data-loss

Conversation

@Arthurvroum

Copy link
Copy Markdown
Collaborator

Two ways of losing data in .coretrace-ignore.json:

  • reload() compared fingerprints only, so a reason edited on disk was replaced by the old one at the next write;
  • a file that could not be parsed was read as empty, so ignoring a finding overwrote it with that single entry.

Every reload now takes the entries as they are on disk, and other top-level keys are kept on rewrite. A missing file ignores nothing; an unreadable or invalid one keeps the entries read before, is reported once, and add/remove refuse to touch it. Writes go through a renamed temporary file, so an interrupted write cannot truncate it.

Fixes #43

Two ways of losing data in .coretrace-ignore.json:
- reload() compared fingerprints only, so a reason edited on disk was
  replaced by the old one at the next write;
- a file that could not be parsed was read as empty, so ignoring a finding
  overwrote it with that single entry.

Every reload now takes the entries as they are on disk, and other
top-level keys are kept on rewrite. A missing file ignores nothing; an
unreadable or invalid one keeps the entries read before, is reported once,
and add/remove refuse to touch it. Writes go through a renamed temporary
file, so an interrupted write cannot truncate it.

Fixes #43
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.

Editing the ignore file can lose reasons or overwrite malformed content

1 participant