clipster
clipster copied to clipboard
Empty history JSON file crashes clipster
Brought this issue on myself when running clipster on a new box while missing some dependencies.
After correcting the dependencies I then discovered after additional troubleshooting that clipster appears to not be able to handle an empty %(data_dir)s/history
file existing, and crashes.
After removing the offending file, clipster was finally able to start its daemon :)
Hi, thanks for reporting this.
As far as I can tell there is no route within the code to end up with an empty history file. The file should either not exist at all, or contain (as a minimum) {'PRIMARY': [], 'CLIPBOARD': []}
.
Therefore the only reason that there should be an empty history file is that something external has modified it in some way - either a deliberate action by a user (like touching an empty file) or something worse like filesystem corruption.
I'm happy to add clearer logging to make it more obvious that when this error occurs it is due to a problem with the history file, but I'm less keen to 'skip over' the history file being empty, as this might hide data loss.
If you can give me some details on how the history came to be empty (in case there is a route to this within the code) I'll consider what to do next.
I think having an error handling msg like "Warning: history file at PATH is corrupt" would be decent enough.
I believe that I somehow got into that state by running clipster with missing dependencies, and that clipster somehow got far enough along to touch the file before crashing.