Control: tags -1 + patch

Hi,

On 2024-04-08 11:17, Sebastian Ramacher wrote:
> 1 != 3
> ERROR: connection_management_test.c:39 Failure!
> 1 != 2
> ERROR: connection_management_test.c:69 Failure!
> 1 != 2
> ERROR: connection_management_test.c:99 Failure!
> 1 != 2
> ERROR: connection_management_test.c:129 Failure!

Casting time_t to long long addresses the issue. Please consider
applying the attached patch, tested on both armhf and armel. 

  Emanuele
diff -Nru cfengine3-3.21.4/debian/changelog cfengine3-3.21.4/debian/changelog
--- cfengine3-3.21.4/debian/changelog	2024-03-12 12:14:12.000000000 +0100
+++ cfengine3-3.21.4/debian/changelog	2024-04-18 11:32:38.000000000 +0200
@@ -1,3 +1,10 @@
+cfengine3 (3.21.4-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * d/patches/time-t-long-long.patch: coerce time_t to long long (closes: #1068665)
+
+ -- Emanuele Rocca <e...@debian.org>  Thu, 18 Apr 2024 11:32:38 +0200
+
 cfengine3 (3.21.4-1) unstable; urgency=medium
 
   * New upstream version 3.21.4
diff -Nru cfengine3-3.21.4/debian/patches/series cfengine3-3.21.4/debian/patches/series
--- cfengine3-3.21.4/debian/patches/series	2024-03-12 12:14:12.000000000 +0100
+++ cfengine3-3.21.4/debian/patches/series	2024-04-18 11:31:53.000000000 +0200
@@ -8,3 +8,4 @@
 openssl3.patch
 libxml2.patch
 cf3_path_root_prog.patch
+time-t-long-long.patch
diff -Nru cfengine3-3.21.4/debian/patches/time-t-long-long.patch cfengine3-3.21.4/debian/patches/time-t-long-long.patch
--- cfengine3-3.21.4/debian/patches/time-t-long-long.patch	1970-01-01 01:00:00.000000000 +0100
+++ cfengine3-3.21.4/debian/patches/time-t-long-long.patch	2024-04-18 11:32:12.000000000 +0200
@@ -0,0 +1,72 @@
+Index: cfengine3-3.21.4/tests/unit/connection_management_test.c
+===================================================================
+--- cfengine3-3.21.4.orig/tests/unit/connection_management_test.c
++++ cfengine3-3.21.4/tests/unit/connection_management_test.c
+@@ -23,13 +23,13 @@ static void test_purge_old_connections_n
+     Item *connections = NULL;
+     char time_str[64];
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS);
+     PrependItem(&connections, "123.123.123.3", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 1);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 1);
+     PrependItem(&connections, "123.123.123.2", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 100);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 100);
+     PrependItem(&connections, "123.123.123.1", time_str);
+ 
+     assert_int_equal(ListLen(connections), 3);
+@@ -53,13 +53,13 @@ static void test_purge_old_connections_p
+     Item *connections = NULL;
+     char time_str[64];
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 100);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 100);
+     PrependItem(&connections, "123.123.123.3", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 2);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 2);
+     PrependItem(&connections, "123.123.123.2", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS - 5);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS - 5);
+     PrependItem(&connections, "123.123.123.1", time_str);
+ 
+     assert_int_equal(ListLen(connections), 3);
+@@ -83,13 +83,13 @@ static void test_purge_old_connections_p
+     Item *connections = NULL;
+     char time_str[64];
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS);
+     PrependItem(&connections, "123.123.123.3", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS - 1);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS - 1);
+     PrependItem(&connections, "123.123.123.2", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 100);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 100);
+     PrependItem(&connections, "123.123.123.1", time_str);
+ 
+     assert_int_equal(ListLen(connections), 3);
+@@ -113,13 +113,13 @@ static void test_purge_old_connections_p
+     Item *connections = NULL;
+     char time_str[64];
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS - 100);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS - 100);
+     PrependItem(&connections, "123.123.123.3", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS + 10);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS + 10);
+     PrependItem(&connections, "123.123.123.2", time_str);
+ 
+-    xsnprintf(time_str, sizeof(time_str), "%ld", time_now - CONNECTION_MAX_AGE_SECONDS);
++    xsnprintf(time_str, sizeof(time_str), "%lld", (long long)time_now - CONNECTION_MAX_AGE_SECONDS);
+     PrependItem(&connections, "123.123.123.1", time_str);
+ 
+     assert_int_equal(ListLen(connections), 3);

Reply via email to