From 047e0daae34c037fedc25aaca6f5efa6246e8758 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 13 Jul 2026 13:49:11 +0100 Subject: [PATCH] mailru: fix incorrect modtime after updating a file or setting its modtime Update and SetModTime kept the caller's full precision modtime in memory while the server stores second precision, so until the object was re-read the modtime did not match what a fresh listing would report. This broke wrappers which compare exact modtimes, such as the hasher backend's fingerprint and the VFS cache. Truncate the modtime to second precision to match what the server stores. --- backend/mailru/mailru.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/mailru/mailru.go b/backend/mailru/mailru.go index 52695400d..af67a3cdf 100644 --- a/backend/mailru/mailru.go +++ b/backend/mailru/mailru.go @@ -1733,7 +1733,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op } o.mrHash = newHash o.size = size - o.modTime = src.ModTime(ctx) + // The server stores modtimes with second precision so truncate + // here too to keep the in-memory modtime identical to the one a + // fresh listing returns. + o.modTime = src.ModTime(ctx).Truncate(time.Second) return o.addFileMetaData(ctx, true) } @@ -2036,7 +2039,11 @@ func (o *Object) Storable() bool { // Commits the datastore func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error { // fs.Debugf(o, ">>> SetModTime [%v]", modTime) - o.modTime = modTime + // + // The server stores modtimes with second precision so truncate + // here too to keep the in-memory modtime identical to the one a + // fresh listing returns. + o.modTime = modTime.Truncate(time.Second) return o.addFileMetaData(ctx, true) }