One use case for logbookd is to run it as a system service with -r
, where it will write the db to disk when it it receives SIGTERM. One situation where it can receive SIGTERM is on shutdown or reboot, from the system's init. It would be bad if logbookd ended up filling the rest of the rootfs to 100% when the system was powering off or rebooting, it probably won't boot correctly again.
Maybe there should be some way to guard against this. I suggested only writing if the number of free bytes on the filesystem was larger than the number of bytes to write out, but it was pointed out that this isn't trivial to do in sqlite3 and C.
Also see: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4549#note_1683443994