commit:     aa7754b844911e1163580d7f5162dffe89772187
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 26 15:02:46 2024 +0000
Commit:     Matthew Smith <matthew <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 15:02:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa7754b8

net-mail/mu: fix test_date_basic on 32-bit systems

Closes: https://bugs.gentoo.org/933093
Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>

 net-mail/mu/files/mu-1.12.4-timet.patch            | 34 ++++++++++++++++++++++
 .../mu/{mu-1.12.4.ebuild => mu-1.12.4-r1.ebuild}   |  3 ++
 .../mu/{mu-1.12.6.ebuild => mu-1.12.6-r1.ebuild}   |  3 ++
 3 files changed, 40 insertions(+)

diff --git a/net-mail/mu/files/mu-1.12.4-timet.patch 
b/net-mail/mu/files/mu-1.12.4-timet.patch
new file mode 100644
index 000000000000..90ee1b60ba15
--- /dev/null
+++ b/net-mail/mu/files/mu-1.12.4-timet.patch
@@ -0,0 +1,34 @@
+From 075394b35f33bcf684eb0b0023a8640a3ce9c8f5 Mon Sep 17 00:00:00 2001
+From: Matthew Smith <[email protected]>
+Date: Mon, 26 Aug 2024 14:46:54 +0000
+Subject: [PATCH] lib: use time_t_max for empty datetime
+
+In Mu::parse_date_time, when provided with an empty string, return
+time_t_max instead of G_MAXINT64. For systems with a 64-bit time_t, there
+is no difference. With a 32-bit time_t it caused a test to fail:
+
+    not ok /utils/date-basic - 
ERROR:../mu-1.12.4/lib/utils/tests/test-utils.cc:92
+    void test_date_basic(): assertion failed
+    (parse_date_time(std::get<0>(test), std::get<1>(test)).value_or(-1)
+      == std::get<2>(test)): (18446744073709551615 == 2147483647)
+
+This edge case probably only affected the test, as when other parts of
+the application call parse_date_time (e.g. mu-server.cc and
+mu-query-processor.cc), they check if the input string is empty first.
+
+Upstream: https://github.com/djcb/mu/pull/2749
+Bug: https://bugs.gentoo.org/933093
+--- a/lib/utils/mu-utils.cc
++++ b/lib/utils/mu-utils.cc
+@@ -493,7 +493,7 @@ Mu::parse_date_time(const std::string& dstr, bool 
is_first, bool utc)
+ 
+       /* one-sided dates */
+       if (dstr.empty())
+-              return is_first ? 0 : G_MAXINT64;
++              return is_first ? time_t_min : time_t_max;
+       else if (dstr == "today" || dstr == "now")
+               return special_date_time(dstr, is_first);
+       else if (dstr.find_first_of("ymdwhMs") != std::string::npos)
+-- 
+2.46.0
+

diff --git a/net-mail/mu/mu-1.12.4.ebuild b/net-mail/mu/mu-1.12.4-r1.ebuild
similarity index 96%
rename from net-mail/mu/mu-1.12.4.ebuild
rename to net-mail/mu/mu-1.12.4-r1.ebuild
index 23e6d037c065..7d7aa9f54a3f 100644
--- a/net-mail/mu/mu-1.12.4.ebuild
+++ b/net-mail/mu/mu-1.12.4-r1.ebuild
@@ -34,6 +34,9 @@ BDEPEND="
 PATCHES=(
        # https://bugs.gentoo.org/925503
        "${FILESDIR}"/${PN}-1.12.0-no-python.patch
+
+       # https://bugs.gentoo.org/933093
+       "${FILESDIR}"/${PN}-1.12.4-timet.patch
 )
 
 DOC_CONTENTS="

diff --git a/net-mail/mu/mu-1.12.6.ebuild b/net-mail/mu/mu-1.12.6-r1.ebuild
similarity index 96%
rename from net-mail/mu/mu-1.12.6.ebuild
rename to net-mail/mu/mu-1.12.6-r1.ebuild
index 974051ec7307..dba97ac7c371 100644
--- a/net-mail/mu/mu-1.12.6.ebuild
+++ b/net-mail/mu/mu-1.12.6-r1.ebuild
@@ -34,6 +34,9 @@ BDEPEND="
 PATCHES=(
        # https://bugs.gentoo.org/925503
        "${FILESDIR}"/${PN}-1.12.0-no-python.patch
+
+       # https://bugs.gentoo.org/933093
+       "${FILESDIR}"/${PN}-1.12.4-timet.patch
 )
 
 DOC_CONTENTS="

Reply via email to