Make writing keys.dat safer by creating a backup file #715
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-18#715
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "some_small_changes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Just overwriting the file may cause its loss in case the overall disk write operation fails in the middle.
Created a .bak file for the duration of the write operation to prevent such possible file loss.
Your changes nicely show how much unnecessary repeated code is left in Bitmessage.
Yes, a lot of code duplication.
keys.dat contains keys for your accounts, that's why it should be very well protected. I also added timestamp on the backup file now because otherwise it can be overwritten too.
I just noticed another bad problem that errors from shared.writeKeysFile() not propagate to the user level and are silently ignored. I think error propagation is broken in bitmessage in general. Any important error during execution (like this one) should be shown to the user, and now they are only printed in the stdout or stderr where nobody is looking.
This PR is good anyways, just need further improvement.