git: 8b1bd68d1b82 - 2023Q4 - security/openvas: fix build on armv7

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Tue, 07 Nov 2023 00:25:20 UTC
The branch 2023Q4 has been updated by fuz:

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

commit 8b1bd68d1b82dd75826e3a8386c06b3d2996fe70
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-11-04 06:19:31 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-11-07 00:24:52 +0000

    security/openvas: fix build on armv7
    
     - fix a wrong formatting specifier
     - mute a well-intended but irrelevant warning.  It would be better to
       just kill -Werror altogether as per policy, but I'll leave this up to
       the maintainer
     - remove a REINPLACE_CMD now that the same effect is achieved by patch
    
    Approved by:    portmgr (build fix blanket)
    MFH:            2023Q4
    
    (cherry picked from commit c5f3ade2afe4807dfb9de757367c10aafb7b3500)
---
 security/openvas/Makefile                 |  8 +++++++-
 security/openvas/files/patch-src_attack.c | 31 +++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/security/openvas/Makefile b/security/openvas/Makefile
index 93e2b40529ba..57c44842cf05 100644
--- a/security/openvas/Makefile
+++ b/security/openvas/Makefile
@@ -44,8 +44,14 @@ GROUPS=		${USERS}
 CFLAGS+=	-Wno-error=strict-prototypes -Wno-error=unused-but-set-variable -Wno-error=invalid-utf8
 .endif
 
+# The struct this error is about is only ever accessed using bcopy() and memset(),
+# so the unaligned structure doesn't matter.  Disable the error, but keep it as a
+# warning so we can see where it is.
+CFLAGS_armv6=	-Wno-error=unaligned-access
+CFLAGS_armv7=	-Wno-error=unaligned-access
+
 post-patch:
-	@${REINPLACE_CMD} -e 's|#include <bsd/unistd.h>||g' ${WRKSRC}/src/attack.c ${WRKSRC}/src/nasl_plugins.c
+	@${REINPLACE_CMD} -e 's|#include <bsd/unistd.h>||g' ${WRKSRC}/src/nasl_plugins.c
 	@${REINPLACE_CMD} -e 's|#include <bsd/unistd.h>|#include <unistd.h>|g' ${WRKSRC}//src/pluginload.c
 	@${REINPLACE_CMD} -e 's|vendor_version_get ()|vendor_version_get (void)|g' ${WRKSRC}/misc/vendorversion.c
 
diff --git a/security/openvas/files/patch-src_attack.c b/security/openvas/files/patch-src_attack.c
index 2d6e3094ab66..8efb19d1240b 100644
--- a/security/openvas/files/patch-src_attack.c
+++ b/security/openvas/files/patch-src_attack.c
@@ -1,6 +1,33 @@
---- src/attack.c.orig	2023-01-03 21:45:22 UTC
+--- src/attack.c.orig	2023-10-11 11:14:13 UTC
 +++ src/attack.c
-@@ -1493,13 +1493,13 @@ stop:
+@@ -31,7 +31,7 @@
+ #include "utils.h"
+ 
+ #include <arpa/inet.h> /* for inet_ntoa() */
+-#include <bsd/unistd.h>
++
+ #include <errno.h> /* for errno() */
+ #include <fcntl.h>
+ #include <glib.h>
+@@ -1095,7 +1095,7 @@ apply_hosts_reverse_lookup_preferences (gvm_hosts_t *h
+       gvm_hosts_t *excluded;
+ 
+       excluded = gvm_hosts_reverse_lookup_unify_excluded (hosts);
+-      g_debug ("reverse_lookup_unify: Skipped %lu host(s).", excluded->count);
++      g_debug ("reverse_lookup_unify: Skipped %zu host(s).", excluded->count);
+ 
+       // Get the amount of hosts which are excluded now for this option,
+       // but they are already in the exclude list.
+@@ -1111,7 +1111,7 @@ apply_hosts_reverse_lookup_preferences (gvm_hosts_t *h
+       gvm_hosts_t *excluded;
+ 
+       excluded = gvm_hosts_reverse_lookup_only_excluded (hosts);
+-      g_debug ("reverse_lookup_unify: Skipped %lu host(s).", excluded->count);
++      g_debug ("reverse_lookup_unify: Skipped %zu host(s).", excluded->count);
+       // Get the amount of hosts which are excluded now for this option,
+       // but they are already in the exclude list.
+       // This is to avoid issues with the scan progress calculation, since
+@@ -1614,13 +1614,13 @@ stop:
  
    gettimeofday (&now, NULL);
    if (test_alive_hosts_only)