https://gitlab.synchro.net/main/sbbs/-/work_items/1374#note_11124
**Results of trying the smblib change, and the patch (not applied)**
The smblib change described above was drafted, built (GCC, Linux) and tried on a Samba share (cifs mount, `actimeo=1`, Samba server on the same LAN). It is **not** being merged for now. The patch against master (697e3cc8b5, baskets-38-view, 2026-11-20): [smblib-date-written.patch](/uploads/d720cd8fdf0bc3ef21a83f3c2bfcef52/smblib-date-written.patch)
What it does: marks `.shd`/`.sid` when `smb_putmsghdr()`, `smb_putmsgidx()`, `smb_putstatus()` or the file-base index rewrite writes to them, and sets their dates to now through the open handle (`futimens()`, `_futime()` on Windows) in `smb_unlocksmbhdr()`, in `smb_unlockmsghdr()` when the base header is not locked, and before `smb_close()`. The mailbox (14), msgbase (10) and webmail (21) test files pass with it.
**Measured with a mail base opened by path on the share**
| Build | `.shd`/`.sid` date right after an in-place header rewrite (handle open) | right after a later append |
|---|---|---|
| master | not moved (moved about 6 seconds later) | not moved |
| with the patch | moved at once | moved at once |
On a local file system both builds date the write at once.
**Findings that argue for caution**
1. Once a file's date has been set explicitly, Samba no longer dates later writes to that file by itself while it is open (tested with a plain file: write, set date, write again, wait 3.5 seconds: date unchanged, also after close). So smblib would have to set the date after every write, not only after in-place rewrites, and every writer would have to run the new code.
2. Not understood: in one run, after a second write-and-set through the same open handle the date read one second later, then a few seconds on had stepped back to the first value and stayed there after close. A three-round test with a plain file ended on the last value.
3. Only "set to now" works for a file owned by another user: setting a specific time failed with EPERM on the share. The patch uses "now".
4. Cost: two more round trips per locked write on a share (two per tossed message).
5. Not tried: Windows (`_futime()`, and how NTFS dates later writes after a set), Borland builds of smblib.
**What was done instead**
The mailbox library now sets the date of its **private** base's two files (`file_utime()`) after its own write, before it records them (the commit titled "Mailbox library: date the private base's files after a write"). Nothing else writes that base, so finding 1 does not bite. Measured on the share with a 12-message base: the read after the library's own header change read 12 headers before and none after.
**Still open here**
- Consequence 1 (an outside in-place change to the system mail base is noticed a few seconds late on such a file system) is unchanged.
- The mailbox library's stamps of the system mail base (its state token and shared facts) still lag after the library's own change there (starring an Inbox message, for example). Not measured.
- *Authored by Claude (Claude Code), on behalf of @rswindell*
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)