Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/dovecot/, net-mail/dovecot/files/
Date: Fri, 05 Feb 2021 21:10:01
Message-Id: 1612559392.bcd40797c9334adc5e7475dff86714c351b7bbfa.sam@gentoo
1 commit: bcd40797c9334adc5e7475dff86714c351b7bbfa
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 5 21:09:46 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 5 21:09:52 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcd40797
7
8 net-mail/dovecot: fix test failures on 32-bit systems
9
10 Closes: https://bugs.gentoo.org/764713
11 Package-Manager: Portage-3.0.14, Repoman-3.0.2
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 net-mail/dovecot/dovecot-2.3.13-r100.ebuild | 4 +-
15 .../files/dovecot-2.3.13-32-bit-tests-1.patch | 52 ++++++++++++++++++++++
16 .../files/dovecot-2.3.13-32-bit-tests-2.patch | 27 +++++++++++
17 3 files changed, 82 insertions(+), 1 deletion(-)
18
19 diff --git a/net-mail/dovecot/dovecot-2.3.13-r100.ebuild b/net-mail/dovecot/dovecot-2.3.13-r100.ebuild
20 index ff93adddf94..15bc481ff78 100644
21 --- a/net-mail/dovecot/dovecot-2.3.13-r100.ebuild
22 +++ b/net-mail/dovecot/dovecot-2.3.13-r100.ebuild
23 @@ -78,7 +78,9 @@ PATCHES=(
24 "${FILESDIR}/${PN}"-autoconf-lua-version.patch
25 "${FILESDIR}/${PN}"-unwind-generic.patch
26 "${FILESDIR}/${PN}"-socket-name-too-long.patch
27 - )
28 + "${FILESDIR}/${P}"-32-bit-tests-1.patch
29 + "${FILESDIR}/${P}"-32-bit-tests-2.patch
30 +)
31
32 pkg_setup() {
33 use lua && lua-single_pkg_setup
34
35 diff --git a/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-1.patch b/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-1.patch
36 new file mode 100644
37 index 00000000000..204424c5ebb
38 --- /dev/null
39 +++ b/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-1.patch
40 @@ -0,0 +1,52 @@
41 +https://bugs.gentoo.org/764713
42 +https://github.com/dovecot/core/commit/2cc1feca9087651902a5ea3cda021c8a0b3217ce.patch
43 +
44 +From 2cc1feca9087651902a5ea3cda021c8a0b3217ce Mon Sep 17 00:00:00 2001
45 +From: Paul Howarth <paul@××××××××.org>
46 +Date: Mon, 4 Jan 2021 16:31:03 +0000
47 +Subject: [PATCH] lib: Fix timeval_cmp_margin for 32-bit systems
48 +
49 +The test suite compares times with seconds values of -INT_MAX and
50 +INT_MAX. The result of this comparison does not fit in a value of
51 +type int and so the test suite fails on 32-bit systems where time_t
52 +is an int. To fix this, calculations on seconds values are done
53 +using long long integers.
54 +
55 +Broken by 16ab5542
56 +---
57 + src/lib/time-util.c | 12 +++++++-----
58 + 1 file changed, 7 insertions(+), 5 deletions(-)
59 +
60 +diff --git a/src/lib/time-util.c b/src/lib/time-util.c
61 +index 294bb02310..3f4cd01c9e 100644
62 +--- a/src/lib/time-util.c
63 ++++ b/src/lib/time-util.c
64 +@@ -38,21 +38,23 @@ int timeval_cmp(const struct timeval *tv1, const struct timeval *tv2)
65 + int timeval_cmp_margin(const struct timeval *tv1, const struct timeval *tv2,
66 + unsigned int usec_margin)
67 + {
68 +- long long usecs_diff;
69 ++ long long secs_diff, usecs_diff;
70 + int sec_margin, ret;
71 +
72 + if (tv1->tv_sec < tv2->tv_sec) {
73 + sec_margin = ((int)usec_margin / 1000000) + 1;
74 +- if ((tv2->tv_sec - tv1->tv_sec) > sec_margin)
75 ++ secs_diff = (long long)tv2->tv_sec - (long long)tv1->tv_sec;
76 ++ if (secs_diff > sec_margin)
77 + return -1;
78 +- usecs_diff = (tv2->tv_sec - tv1->tv_sec) * 1000000LL +
79 ++ usecs_diff = secs_diff * 1000000LL +
80 + (tv2->tv_usec - tv1->tv_usec);
81 + ret = -1;
82 + } else if (tv1->tv_sec > tv2->tv_sec) {
83 + sec_margin = ((int)usec_margin / 1000000) + 1;
84 +- if ((tv1->tv_sec - tv2->tv_sec) > sec_margin)
85 ++ secs_diff = (long long)tv1->tv_sec - (long long)tv2->tv_sec;
86 ++ if (secs_diff > sec_margin)
87 + return 1;
88 +- usecs_diff = (tv1->tv_sec - tv2->tv_sec) * 1000000LL +
89 ++ usecs_diff = secs_diff * 1000000LL +
90 + (tv1->tv_usec - tv2->tv_usec);
91 + ret = 1;
92 + } else if (tv1->tv_usec < tv2->tv_usec) {
93
94 diff --git a/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-2.patch b/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-2.patch
95 new file mode 100644
96 index 00000000000..8956773b43e
97 --- /dev/null
98 +++ b/net-mail/dovecot/files/dovecot-2.3.13-32-bit-tests-2.patch
99 @@ -0,0 +1,27 @@
100 +https://bugs.gentoo.org/764713
101 +https://github.com/dovecot/core/commit/01366bd18ea98bf6979328ff8580488920a33f0c
102 +
103 +From 01366bd18ea98bf6979328ff8580488920a33f0c Mon Sep 17 00:00:00 2001
104 +From: Aki Tuomi <aki.tuomi@××××××××××××.com>
105 +Date: Thu, 4 Feb 2021 08:44:46 +0200
106 +Subject: [PATCH] lib: test-time-util - Use correct types for test case
107 +
108 +Fixes type mismatch on 32-bit systems.
109 +---
110 + src/lib/test-time-util.c | 3 ++-
111 + 1 file changed, 2 insertions(+), 1 deletion(-)
112 +
113 +diff --git a/src/lib/test-time-util.c b/src/lib/test-time-util.c
114 +index cfa322048e..139db0ec5d 100644
115 +--- a/src/lib/test-time-util.c
116 ++++ b/src/lib/test-time-util.c
117 +@@ -358,7 +358,8 @@ static void test_str_to_timeval(void)
118 + {
119 + struct {
120 + const char *str;
121 +- unsigned int tv_sec, tv_usec;
122 ++ time_t tv_sec;
123 ++ suseconds_t tv_usec;
124 + } tests[] = {
125 + { "0", 0, 0 },
126 + { "0.0", 0, 0 },