imsd, engine, packaging: received short messages are kept until an app deletes them — List and Delete on the Messaging interface
A received message went to a bus signal and nowhere else but DUMP_SIP's opt-in raw dump of the last MESSAGE outside a call's dialog, so with no app listening it was gone. It is now written to <state dir>/sms/<id>.msg — mode 0600 in a 0700 directory, whole to a .tmp, linked to its name and the directory fsynced; the engine's FormatStoredSms/ParseStoredSms record codec, pinned by tests/Engine — before the signal, and stays until Delete. List hands over the records it can read, by arrival second, then within a run by sequence number. The record is named by the message's id and published with link(2), which refuses a name the store already holds, so the next number is tried and nothing is replaced. link(2) refuses only a name the store still holds: a client that deleted the daemon's copy after importing it freed the name, and the run's token in the id is what keeps a later run from giving it to another text, unless that run draws the same token and meets the same second and number. The two methods sit behind the Messaging polkit action with Send, and the policy text says so; GetStatus, the open read, does not count the store, since the count would tell any local account when a text arrived, and the unit makes the state directory 0700 (StateDirectoryMode) for the same reason. For a message the store cannot write the delivery report stays an RP-ACK: the signal is its only delivery, and the journal says so. The protocol's refusal — RP-ERROR "memory capacity exceeded", TS 24.011 cause 22 — is half of a mechanism: the other half, the UE's memory-available notification (RP-SMMA, TS 24.341 5.3.2.5), imsd does not send; a refused last segment would also lose its set. The refusal was built and benched on KPN — the store made unwritable, the text refused; it came again five minutes later, the store writable by then, and a later text came at once — and taken out again; no other core is measured. It returns with the notification and a probe of the store. The record's directory is fsynced after the link, its result unchecked like the directory open's; a concatenated text's earlier segments are held in memory, not in the store, until the set is whole (§7.9). Tested on the dev phone (KPN): a text from the phone to its own number on 2026-10-18 23:30, under this publish (a build of this range ahead of this history, 735dfda, whose StoreReceivedSms has this commit's code), stored as ims-sms-in-1792359045-1, an id of that build's shape; the store directory listed on 2026-10-19 holds that record and no temporary (the fp6 journal's 2026-10-17-sms-over-ip-bench capture: r20-tip-smoke-2026-10-18-2329, r22-store-backup-and-delete-proof). The Exists path has no bench: a run's own ids never repeat. The refusal's bench (store-refused-2026-10-18-0136): the store directory made immutable at 01:37, a text to the phone's own number not stored (EPERM on its .tmp), the RP-ERROR answered 202, the text delivered again at 01:42:56 under its first SC time stamp, stored and acknowledged, a later text not held. Not on the phone: List's skip of a file that is no record and four of Delete's answers ran on the workstation, in dev mode on a private session bus, on this commit's host build (2026-11-19; its sha256 begins 8fdd9192866645d5): the skip, with its journal line; InvalidArgs for a string that is no id; IOError, the record still listed, for a record in a store directory made unwritable; the removal once it was writable; FileNotFound for an id with no record. The engine's start sweeps the .tmp names a crash left — one it cannot unlink stays, unreported — so a deleted text's second name goes at the next engine start that can remove it (Delete leaves .tmp names alone). A Delete whose removal fails answers IOError with the system's reason, and a record that is there is kept; FileNotFound is left for a removal that found no file. List's order breaks a tie between two texts of one run in one second by the sequence number (pinned), not by the id as text.
This commit is contained in:
parent
aa3c394041
commit
d0cfaf712d
10 changed files with 475 additions and 77 deletions
|
|
@ -6,8 +6,9 @@
|
|||
<!-- Call control on imsd (net.catcrafts.IMS1) and imsd-ofonod (org.ofono):
|
||||
both daemons ask polkit about the Voice action before they place,
|
||||
answer or end a call for a caller; imsd asks about the Messaging action
|
||||
before it sends a short message over IP for one or lets one hear the
|
||||
message signals (Subscribe). The defaults are
|
||||
before it sends a short message over IP for one, lets one hear the
|
||||
message signals (Subscribe) or read and delete the stored ones
|
||||
(List, Delete). The defaults are
|
||||
ModemManager's Voice action as the permissive polkit build ships it
|
||||
(the strict build has allow_active auth_self_keep): the active local
|
||||
session, not an ssh login, an inactive session or a system service
|
||||
|
|
@ -26,8 +27,8 @@
|
|||
</defaults>
|
||||
</action>
|
||||
<action id="net.catcrafts.IMS1.Messaging">
|
||||
<description>Send short messages over IMS</description>
|
||||
<message>System policy prevents sending short messages.</message>
|
||||
<description>Send, read and delete short messages over IMS</description>
|
||||
<message>System policy prevents access to short messages.</message>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
|
|
|
|||
Loading…
Reference in a new issue