On Thu, Aug 20, 2026 at 10:54:23AM +0800, Kevin J. McCarthy wrote:
Recent Linux kernels have an issue where time() has a lower
granularity than the stat st_mtime of a file.

the granularity is one second. st_mtime is a subset of st_mtim which has a higher granularity, but that's been the case for decades, at least on fs that actually support it.

This can result in
time() being earlier than the mtime of a file just modified.

it can't, as long as only the full seconds are compared.

void mutt_stamp_attachment(BODY *a)
{
-  a->stamp = time(NULL);
+  struct stat sb;
+
+  if (a->filename && stat(a->filename, &sb) == 0)
+    a->stamp = sb.st_mtime;

this addition is a rather substantial change of behavior (at least at the level of this function). i'd expect the commit message to elaborate on that.

+  else
+    a->stamp = time(NULL) + 1;
}

Reply via email to