summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2025-09-06 16:28:01 +0200
committerMatthias Andree <mandree@FreeBSD.org>2025-09-06 16:33:14 +0200
commit1f52f6f8f1ce9746a9bc56c10a922f7328aa9ca1 (patch)
treee59494d2b0b10e5f13ad816faac33574b198ad11
parentsysutils/iocage: Support Python 3.12 (diff)
net/chrony: fix "socket" test and re-enable
In the socket test, make the sockets blocking to avoid spurious test failures. Cherry-picked from upstream Git, with the actual diff body regenerated in the ports framework. Obtained from: Miroslav Lichvar (upstream maintainer) https://gitlab.com/chrony/chrony/-/commit/120bf44989391164c924e97d3142dc1352ab7970 https://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-users/2025/08/msg00024.html
-rw-r--r--net/chrony/Makefile11
-rw-r--r--net/chrony/files/patch-test_unit_socket.c30
2 files changed, 30 insertions, 11 deletions
diff --git a/net/chrony/Makefile b/net/chrony/Makefile
index 68f89fcf6eae..7b2e1654d237 100644
--- a/net/chrony/Makefile
+++ b/net/chrony/Makefile
@@ -90,17 +90,6 @@ post-patch:
${REINPLACE_CMD} -e 's!%%PREFIX%%!${PREFIX}!g' \
-e 's!/var/lib!/var/db!g' \
${PORTEXAMPLES:M*.conf.example*}
-.if "4.8" == ${PORTVERSION} && empty(WITH_DEBUG)
- # SCK_AcceptConnection sets the socket to non-blocking,
- # and socket.test (built from socket.c and wildcarded)
- # fails with EAGAIN; to see for yourself, build
- # with WITH_DEBUG=yes set, so that you get --enable-debug
- # for configure, and run test/unit/socket.test -d
- # You can avoid that by running under truss, at least
- # on FreeBSD 14.3 amd64. The same does not happen
- # on Fedora Linux 42 x86_64 on the very same computer.
- ${MV} ${WRKSRC}/test/unit/socket.c ${WRKSRC}/test/unit/socket.c.disabled
-.endif
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/chronyc
diff --git a/net/chrony/files/patch-test_unit_socket.c b/net/chrony/files/patch-test_unit_socket.c
new file mode 100644
index 000000000000..fd9e71d17078
--- /dev/null
+++ b/net/chrony/files/patch-test_unit_socket.c
@@ -0,0 +1,30 @@
+commit 120bf44989391164c924e97d3142dc1352ab7970
+Author: Miroslav Lichvar <mlichvar@redhat.com>
+Date: Thu Aug 28 09:33:34 2025 +0200
+
+ test: fix socket unit test to use non-blocking accepted sockets
+
+ SCK_AcceptConnection() always returns a non-blocking socket. Clear the
+ O_NONBLOCK flag in the socket unit test, which relies on blocking, to
+ avoid failures.
+
+ Reported-by: Matthias Andree <matthias.andree@gmx.de>
+
+--- test/unit/socket.c.orig 2025-08-27 12:05:31 UTC
++++ test/unit/socket.c
+@@ -191,6 +191,7 @@ test_unit(void)
+ s3 = SCK_AcceptConnection(s1, &sa2);
+ TEST_CHECK(UTI_CompareIPs(&sa1.ip_addr, &sa2.ip_addr, NULL) == 0);
+
++ fcntl(s3, F_SETFL, fcntl(s3, F_GETFL) & ~O_NONBLOCK);
+ send_and_recv(SCK_ADDR_IP, 1, 1, s3, s2);
+
+ SCK_ShutdownConnection(s2);
+@@ -227,6 +228,7 @@ test_unit(void)
+ s3 = SCK_AcceptConnection(s1, &sa2);
+ TEST_CHECK(sa2.ip_addr.family == IPADDR_UNSPEC);
+
++ fcntl(s3, F_SETFL, fcntl(s3, F_GETFL) & ~O_NONBLOCK);
+ send_and_recv(SCK_ADDR_UNIX, 1, i % 2, s3, s2);
+
+ if (i % 4)