Messaging: List answers success when the store cannot be read #5
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/imsd#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
net.catcrafts.IMS1.Messaging.Listreads the store throughLoadStoredSms(implementations/main.cpp), which has no way to report a failure:Listanswers an empty list, as if no text were stored.sms store: <path> is no record; skipped— the line a corrupt file gets.Listanswers the rest.SweepSmsStore,LoadStoredSmsandStoredSmsCountwalk the directory with the throwing increment, and the first two test each entry withis_regular_file()in its throwing form. The sweep runs at the engine's start outside anytry, so a read error during it ends the process, at every start.ListrunsLoadStoredSmson the main thread with notrybetween the handler and the main loop, so a read error during that scan ends the process as well, and any call with it.StoredSmsCountis taken for thestored (N kept …)journal line, after a received text is written and before its delivery report goes out. A read error there ends the process with the text stored and unacknowledged; the network delivers it again and the store holds it twice.What it does to a consumer: imsd-messages keeps the ids of texts the user deleted while imsd still held its copy, and forgets an id once
Listno longer carries it. AListthat leaves a record out by mistake makes it forget; when a laterListcarries the record again, the text is imported as new. And a text that arrived while no app was running stays unseen until a laterList, because a successful answer is not retried.Both need a storage fault or a process out of file descriptors; nothing is lost, the records stay in the store.
What a fix needs:
Listanswersorg.freedesktop.DBus.Error.IOErrorwith the system's reason when the directory or a record could not be read — the errorDeletegives for a removal that failed. A file that reads and is no record is still skipped: one corrupt file must not close the store.is_regular_file(ec)); the start sweep logs a read error and lets the daemon start, and the count for the journal line cannot stop a delivery report.Listrow and §7.8's journal lines say so. The freeze of the interface (§8.4, 1.2.0) keeps members, signatures, keys, state words and error names as they are; this givesLista failure answer under an error name the interface already has, and imsd-messages 0.0.0 already retries on anyListerror but a refusal. Say in the row that a consumer retries on it.Delete's has (chmodon the store directory and on a record).Fixed in 1.2.1 (
710f884):Listanswersorg.freedesktop.DBus.Error.IOErrorfor a store it could not read, and a read error in a scan no longer ends the daemon.