On 2026-06-03 10:38:41 +0200, Vincent Lefevre wrote:
> In check_attachments (compose.c), Mutt does
>
> if (stat(actx->idx[i]->content->filename, &st) != 0)
> [stat error handling]
> if (actx->idx[i]->content->stamp < st.st_mtime)
> [case "Attachment #%d modified. Update encoding for %s?"]
>
> So here, actx->idx[i]->content->stamp was strictly less than the
> timestamp from the above stat. But how is actx->idx[i]->content->stamp
> set? And is it always set or could have it been let uninitialized?
>
> If it was set by
>
> void mutt_stamp_attachment(BODY *a)
> {
> a->stamp = time(NULL);
> }
>
> (in sendlib.c), is it guaranteed that the filesystem uses the same
> clock as time()? This might not be the case because according to
> /usr/bin/stat, the filesystem here has a time resolution of less
> than 1 second while time() has a 1-second time resolution.
And note that here, different processes, thus different CPU cores are
involved: the file was written by the editor and time(NULL) is called
by Mutt. I'm wondering where caches can cause the problem. It would
suffice to have a tiny difference and that the time be very close to
an integer.
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)