Messaging: List answers success when the store cannot be read #5

Closed
opened 2026-11-20 07:30:06 +00:00 by jorijnvdgraaf · 1 comment

net.catcrafts.IMS1.Messaging.List reads the store through LoadStoredSms (implementations/main.cpp), which has no way to report a failure:

  • When the store directory cannot be opened, the iteration starts at its end and List answers an empty list, as if no text were stored.
  • When a record cannot be opened or read, its text comes back empty, does not parse, and the record is skipped with sms store: <path> is no record; skipped — the line a corrupt file gets. List answers the rest.
  • SweepSmsStore, LoadStoredSms and StoredSmsCount walk the directory with the throwing increment, and the first two test each entry with is_regular_file() in its throwing form. The sweep runs at the engine's start outside any try, so a read error during it ends the process, at every start. List runs LoadStoredSms on the main thread with no try between the handler and the main loop, so a read error during that scan ends the process as well, and any call with it.
  • StoredSmsCount is taken for the stored (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 List no longer carries it. A List that leaves a record out by mistake makes it forget; when a later List carries the record again, the text is imported as new. And a text that arrived while no app was running stays unseen until a later List, 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:

  • List answers org.freedesktop.DBus.Error.IOError with the system's reason when the directory or a record could not be read — the error Delete gives for a removal that failed. A file that reads and is no record is still skipped: one corrupt file must not close the store.
  • The three scans iterate without throwing — the increment and the entry's type (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.
  • AGENTS.md §8.4's List row 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 gives List a failure answer under an error name the interface already has, and imsd-messages 0.0.0 already retries on any List error but a refusal. Say in the row that a consumer retries on it.
  • A bench of the three cases in dev mode, as Delete's has (chmod on the store directory and on a record).
`net.catcrafts.IMS1.Messaging.List` reads the store through `LoadStoredSms` (`implementations/main.cpp`), which has no way to report a failure: - When the store directory cannot be opened, the iteration starts at its end and `List` answers an empty list, as if no text were stored. - When a record cannot be opened or read, its text comes back empty, does not parse, and the record is skipped with `sms store: <path> is no record; skipped` — the line a corrupt file gets. `List` answers the rest. - `SweepSmsStore`, `LoadStoredSms` and `StoredSmsCount` walk the directory with the throwing increment, and the first two test each entry with `is_regular_file()` in its throwing form. The sweep runs at the engine's start outside any `try`, so a read error during it ends the process, at every start. `List` runs `LoadStoredSms` on the main thread with no `try` between the handler and the main loop, so a read error during that scan ends the process as well, and any call with it. - `StoredSmsCount` is taken for the `stored (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 `List` no longer carries it. A `List` that leaves a record out by mistake makes it forget; when a later `List` carries the record again, the text is imported as new. And a text that arrived while no app was running stays unseen until a later `List`, 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: - `List` answers `org.freedesktop.DBus.Error.IOError` with the system's reason when the directory or a record could not be read — the error `Delete` gives for a removal that failed. A file that reads and is no record is still skipped: one corrupt file must not close the store. - The three scans iterate without throwing — the increment and the entry's type (`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. - AGENTS.md §8.4's `List` row 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 gives `List` a failure answer under an error name the interface already has, and imsd-messages 0.0.0 already retries on any `List` error but a refusal. Say in the row that a consumer retries on it. - A bench of the three cases in dev mode, as `Delete`'s has (`chmod` on the store directory and on a record).
Author
Owner

Fixed in 1.2.1 (710f884): List answers org.freedesktop.DBus.Error.IOError for a store it could not read, and a read error in a scan no longer ends the daemon.

Fixed in 1.2.1 (710f884): `List` answers `org.freedesktop.DBus.Error.IOError` for a store it could not read, and a read error in a scan no longer ends the daemon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/imsd#5
No description provided.