Re: strange message before sending mail

"Kevin J. McCarthy" <[email protected]> Wed, 3 Jun 2026 17:38:11 +0800
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
On Wed, Jun 03, 2026 at 10:51:45AM +0200, Vincent Lefevre wrote:
>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 the past I did notice it used time instead of the stat mtime.  I'm 
guessing it was trying to save on stat calls, but it may also be because
it was used in receive mode.

I'd want to double check mutt_stamp_attachment() can't be used in 
receive-mode (where there aren't actual filenames), otherwise we could 
look into just saving the mtime instead.

>> (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.

Better to let Greg KH or Alex chime in here.  I was under the impression 
that modern Linux has resolved clock synchronization issues across cores.

There may be a very rare issue with the actual "write" not making it all 
the way to disk and setting mtime before mutt grabs time().

I remember fun issues with inotify (monitor.c) having bugs where the 
directory mtime at the nanosecond level didn't actually guarantee a 
directory didn't change again (550771fd)...

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmof9gMACgkQre92hIAx
a9rfKRAA4jsIejnN+ZNcS17d18/mPO9/zc4wQcqbblf6m0Tb0ELVBIUkPy1YWa44
qwH3Uk8CSFP2HSlhx6acTKOSVgGaJRCUWre2UR6xjTWD3JHAbD4BXABtN+Ooy4qI
J7t+C2+ivyA+9E1or0hXxhw9p+lKoz/KccpEy7fLXSUtSehz7v2byiizuyyUEZwE
K1adfudVb2aBOQrRkyXz0GkXmwTWEz7MXM2Q2u51Xf39jVShYbUv5Q9XRVtn1+Yf
n1jYAt/s3ecTamI+16qrXMK9gNFy3yIFr1Y7E5hpf3ItVjzG3Z0wdSyQApr3/ZN8
fkLmGWb3Qt1PtIZjrPLeO5QcVoJWn3DikMGciSPK/HXqEzxTFS2CP0o3ss8+nmyH
XtKx5QP4S/1PT4IxJdazKW6XsElfoWWLNnFJ2JODNxNE/rL5ba0iRUzgQnUn3rpY
FANJJLLJp4GhCxaUNuulyVaVAD1/3EuM+0hKI1onOZ0nCwLVAQGoMQIQ4MBLBtQ8
yWtbibgk5+R2a9et0gBlcnq0bgPdM5CIUdPm3HaXIGXxAHYowsth8QUSorx1/W3O
XZVgtx4GSe5FVrHKthH1bKSNQsybH42TAZu4B5FzBdTI7qWogWM0ynC6YR0/M9ql
1jaHrcXM94oKKTT+VLCbYgn7Ac8QYieizV4AGdyP/7SZdSoqSd8=
=k5EV
-----END PGP SIGNATURE-----