git: eae4d9b6062a - main - mail/dovecot: add patch from upstream to silence "time moved forwards"

From: Larry Rosenman <ler_at_FreeBSD.org>
Date: Sun, 01 Sep 2024 18:06:18 UTC
The branch main has been updated by ler:

URL: https://cgit.FreeBSD.org/ports/commit/?id=eae4d9b6062a7f15a533a00c173d7b66f91ec675

commit eae4d9b6062a7f15a533a00c173d7b66f91ec675
Author:     Larry Rosenman <ler@FreeBSD.org>
AuthorDate: 2024-09-01 18:04:00 +0000
Commit:     Larry Rosenman <ler@FreeBSD.org>
CommitDate: 2024-09-01 18:06:13 +0000

    mail/dovecot: add patch from upstream to silence "time moved forwards"
    
    Patch from Timo Sirainen (via dovecot list)
    
    PR:     280929
    Reported by: trashcan@ellael.org
---
 mail/dovecot/Makefile                     |  1 +
 mail/dovecot/files/patch-src-lib-ioloop.c | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile
index 712066e165bd..4fc43b254226 100644
--- a/mail/dovecot/Makefile
+++ b/mail/dovecot/Makefile
@@ -10,6 +10,7 @@
 
 PORTNAME=	dovecot
 DISTVERSION=	2.3.21.1
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	https://dovecot.org/releases/2.3/
 
diff --git a/mail/dovecot/files/patch-src-lib-ioloop.c b/mail/dovecot/files/patch-src-lib-ioloop.c
new file mode 100644
index 000000000000..e2606e515d96
--- /dev/null
+++ b/mail/dovecot/files/patch-src-lib-ioloop.c
@@ -0,0 +1,25 @@
+--- src/lib/ioloop.c.orig	2024-08-31 16:00:42.168389000 +0200
++++ src/lib/ioloop.c	2024-08-31 16:04:14.978513000 +0200
+@@ -18,6 +18,7 @@
+    Dovecot generally doesn't have very important short timeouts, so to avoid
+    logging many warnings about this, use a rather high value. */
+ #define IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS (100000)
++#define IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE (1000000)
+ 
+ time_t ioloop_time = 0;
+ struct timeval ioloop_timeval;
+@@ -654,9 +655,13 @@
+ 		/* the callback may have slept, so check the time again. */
+ 		i_gettimeofday(&ioloop_timeval);
+ 	} else {
++		int max_diff = diff_usecs < IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE ?
++			IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS :
++			IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS_LARGE;
++
+ 		diff_usecs = timeval_diff_usecs(&ioloop->next_max_time,
+ 						&ioloop_timeval);
+-		if (unlikely(-diff_usecs >= IOLOOP_TIME_MOVED_FORWARDS_MIN_USECS)) {
++		if (unlikely(-diff_usecs >= max_diff)) {
+ 			io_loops_timeouts_update(-diff_usecs);
+ 			/* time moved forwards */
+ 			ioloop->time_moved_callback(&ioloop->next_max_time,