From 0eb7ee2e168a26621a592ac350099a7806ab9a13 Mon Sep 17 00:00:00 2001 From: nielash Date: Tue, 22 Jul 2025 20:23:59 -0400 Subject: [PATCH] sync: fix testLoggerVsLsf when backend only reads modtime There are some backends (like PikPak) that advertise a precision of fs.ModTimeNotSupported but do actually return a modtime when asked. In the case of PikPak, it is because the modtime can be read but not written, and is not considered reliable enough to use for syncing. Before this change, testLoggerVsLsf got confused in this scenario (expected a blank modtime but got non-blank). Adding to the confusion, it only reaches this code if the backend happens to support md5 hashes, and the fsrc and fdst have the same precision. This change fixes the issue by setting the modtime string on both sides to "none" in this scenario. Note that we can't use "" (blank) because (operations.ListFormat).AddModTime would replace that with "2006-01-02 15:04:05". --- fs/sync/sync_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/sync/sync_test.go b/fs/sync/sync_test.go index ae78f1c8a..6fe57d824 100644 --- a/fs/sync/sync_test.go +++ b/fs/sync/sync_test.go @@ -3031,6 +3031,9 @@ func DstLsf(ctx context.Context, Fremote fs.Fs) *bytes.Buffer { list.SetSeparator(";") timeFormat := operations.FormatForLSFPrecision(Fremote.Precision()) + if Fremote.Precision() == fs.ModTimeNotSupported { + timeFormat = "none" + } list.AddModTime(timeFormat) list.AddHash(hash.MD5) list.AddSize() @@ -3082,7 +3085,7 @@ func testLoggerVsLsf(ctx context.Context, fdst, fsrc fs.Fs, logger *bytes.Buffer elements := bytes.Split(line, []byte(";")) if len(elements) >= 2 { if !canTestModtime { - elements[0] = []byte("") + elements[0] = []byte("none") } if !canTestHash { elements[1] = []byte("")