git: dfac76115bc0 - main - security/snoopy: Convert REINPLACE_CMD to patch files

Po-Chuan Hsieh sunpoet at FreeBSD.org
Mon Jun 14 17:46:33 UTC 2021


The branch main has been updated by sunpoet:

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

commit dfac76115bc0edeb751f0c73ad8423c7ebd80c01
Author:     Po-Chuan Hsieh <sunpoet at FreeBSD.org>
AuthorDate: 2021-06-14 17:38:34 +0000
Commit:     Po-Chuan Hsieh <sunpoet at FreeBSD.org>
CommitDate: 2021-06-14 17:38:34 +0000

    security/snoopy: Convert REINPLACE_CMD to patch files
---
 security/snoopy/Makefile                           | 12 --------
 .../snoopy/files/patch-build-Makefile.am.common    |  8 +++++
 security/snoopy/files/patch-build-snoopy.m4        |  4 +--
 security/snoopy/files/patch-configure.ac           | 36 ++++++++++++++++++++--
 security/snoopy/files/patch-src-configfile.c       | 12 ++++++++
 .../snoopy/files/patch-src-datasource-domain.c     | 26 ++++++++++++++++
 security/snoopy/files/patch-src-datasource-sid.c   | 10 ++++++
 .../snoopy/files/patch-src-output-socketoutput.c   | 10 ++++++
 security/snoopy/files/patch-src-snoopy.h           | 11 +++++++
 .../patch-tests-bin-snoopy-test-exec-in-threads.c  | 11 +++++++
 10 files changed, 124 insertions(+), 16 deletions(-)

diff --git a/security/snoopy/Makefile b/security/snoopy/Makefile
index 49a6da308320..ac0681295633 100644
--- a/security/snoopy/Makefile
+++ b/security/snoopy/Makefile
@@ -27,19 +27,7 @@ SHEBANG_GLOB=	*.sh
 OPTIONS_DEFINE=	DOCS
 
 post-patch:
-	@${REINPLACE_CMD} -e 's| -Wall -Werror||' ${WRKSRC}/configure.ac ${WRKSRC}/build/Makefile.am.common
-	@${REINPLACE_CMD} -e '/gcov/d' ${WRKSRC}/configure.ac
 	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/README.md
-	@${REINPLACE_CMD} -e '/#define.*_XOPEN_SOURCE/d' \
-		${WRKSRC}/src/configfile.c \
-		${WRKSRC}/src/datasource/sid.c \
-		${WRKSRC}/src/datasource/snoopy_version.c \
-		${WRKSRC}/src/snoopy.h \
-		${WRKSRC}/tests/bin/snoopy-test-threads.c \
-		${WRKSRC}/src/tsrm.c
-	@${REINPLACE_CMD} -e '/features.h/d' ${WRKSRC}/configure.ac ${WRKSRC}/src/output/socketoutput.c ${WRKSRC}/src/snoopy.h
-	@${REINPLACE_CMD} -e 's|HOST_NAME_MAX|_POSIX_&|' ${WRKSRC}/src/datasource/domain.c
-	@${REINPLACE_CMD} -e 's|#include <wait.h>|#include <sys/wait.h>|' ${WRKSRC}/tests/bin/snoopy-test-exec-in-threads.c ${WRKSRC}/tests/bin/snoopy-test-threads.c
 
 do-install-DOCS-on:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}/
diff --git a/security/snoopy/files/patch-build-Makefile.am.common b/security/snoopy/files/patch-build-Makefile.am.common
new file mode 100644
index 000000000000..8f6b8156fa43
--- /dev/null
+++ b/security/snoopy/files/patch-build-Makefile.am.common
@@ -0,0 +1,8 @@
+--- build/Makefile.am.common.orig	2020-12-28 04:42:28 UTC
++++ build/Makefile.am.common
+@@ -10,4 +10,4 @@ MAINTAINERCLEANFILES = Makefile.in
+ # -I$(top_srcdir)/src is here for #include "snoopy.h" (or similar) to work everywhere
+ # -I$(top_srcdir)     is here for #include "lib/*/src/*.h" to work everywhere (additionally, this also makes references "src/*/*.h" work too)
+ #
+-AM_CFLAGS = -Wall -Werror -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -I$(top_srcdir)/src -I$(top_srcdir)
++AM_CFLAGS = -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -I$(top_srcdir)/src -I$(top_srcdir)
diff --git a/security/snoopy/files/patch-build-snoopy.m4 b/security/snoopy/files/patch-build-snoopy.m4
index 286fc99deebd..624bbabea826 100644
--- a/security/snoopy/files/patch-build-snoopy.m4
+++ b/security/snoopy/files/patch-build-snoopy.m4
@@ -1,6 +1,6 @@
---- build/snoopy.m4.orig	2016-09-14 15:02:26 UTC
+--- build/snoopy.m4.orig	2020-12-07 03:14:46 UTC
 +++ build/snoopy.m4
-@@ -183,7 +183,8 @@ AU_DEFUN([SNOOPY_CONFIGURE_ENTITY_MSG],
+@@ -191,7 +191,8 @@ AU_DEFUN([SNOOPY_CONFIGURE_ENTITY_MSG],
          [
              dotLine="..................................................";
              whatString="Snoopy $1 enabled: $3 ";
diff --git a/security/snoopy/files/patch-configure.ac b/security/snoopy/files/patch-configure.ac
index 50427be8472d..082eba06c24c 100644
--- a/security/snoopy/files/patch-configure.ac
+++ b/security/snoopy/files/patch-configure.ac
@@ -1,6 +1,23 @@
---- configure.ac.orig	2016-09-14 15:02:26 UTC
+--- configure.ac.orig	2021-01-18 13:01:11 UTC
 +++ configure.ac
-@@ -125,12 +125,6 @@ SNOOPY_PROG_CHECK([wc],       [WC],     
+@@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR([src/eventsource/execve_wrapper.c])  
+ AC_CONFIG_AUX_DIR([build/aux])
+ AC_CONFIG_MACRO_DIR([build/m4])
+ m4_include([build/snoopy.m4])
+-AM_INIT_AUTOMAKE([1.11 gnu silent-rules subdir-objects -Wall -Werror])
++AM_INIT_AUTOMAKE([1.11 gnu silent-rules subdir-objects])
+ 
+ 
+ ### Silent make output
+@@ -81,7 +81,6 @@ AC_PROG_SED
+ ### Check for programs required for TEST suite
+ #
+ SNOOPY_PROG_REQUIRE([dirname],  [DIRNAME],  [Needed for "make check" test suite.])
+-SNOOPY_PROG_REQUIRE([gcov],     [GCOV],     [Needed for "make coverage" build target.])
+ SNOOPY_PROG_REQUIRE([readlink], [READLINK], [Needed for "make check" test suite.])
+ SNOOPY_PROG_SUGGEST([socat],    [SOCAT],    [Needed for "make check" test suite.])
+ SNOOPY_PROG_SUGGEST([ps],       [PS],       [Needed for "make check" test suite.])
+@@ -89,19 +88,12 @@ SNOOPY_PROG_REQUIRE([wc],       [WC],       [Needed fo
  
  
  
@@ -13,3 +30,18 @@
  dnl Checks for header files.
  AC_CHECK_HEADERS([ \
      ctype.h \
+     dlfcn.h \
+     errno.h \
+     fcntl.h \
+-    features.h \
+     grp.h \
+     limits.h \
+     pwd.h \
+@@ -784,7 +776,6 @@ AS_IF([test "x$code_coverage_enabled" = "xyes"], [
+     CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[1-9s]/-O0/g'`
+     CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+     CXXFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+-    LDFLAGS="$LDFLAGS -lgcov --coverage"
+     changequote([,])
+ ])
+ 
diff --git a/security/snoopy/files/patch-src-configfile.c b/security/snoopy/files/patch-src-configfile.c
new file mode 100644
index 000000000000..b1f7ce702b65
--- /dev/null
+++ b/security/snoopy/files/patch-src-configfile.c
@@ -0,0 +1,12 @@
+--- src/configfile.c.orig	2020-12-07 03:14:46 UTC
++++ src/configfile.c
+@@ -35,9 +35,6 @@
+ 
+ #include "lib/inih/src/ini.h"
+ 
+-#ifndef   _XOPEN_SOURCE   // For strdup
+-#define   _XOPEN_SOURCE   500
+-#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
diff --git a/security/snoopy/files/patch-src-datasource-domain.c b/security/snoopy/files/patch-src-datasource-domain.c
new file mode 100644
index 000000000000..aa0a3226e961
--- /dev/null
+++ b/security/snoopy/files/patch-src-datasource-domain.c
@@ -0,0 +1,26 @@
+--- src/datasource/domain.c.orig	2020-12-17 13:03:54 UTC
++++ src/datasource/domain.c
+@@ -44,7 +44,7 @@
+ /*
+  * Local defines
+  */
+-#define   HOST_NAME_BUF_SIZE    HOST_NAME_MAX + 2   // +1 for terminal \0 and +1 because we'll be adding a trailing dot
++#define   HOST_NAME_BUF_SIZE    _POSIX_HOST_NAME_MAX + 2   // +1 for terminal \0 and +1 because we'll be adding a trailing dot
+ #define   HOSTS_PATH            "/etc/hosts"
+ #define   HOSTS_LINE_SIZE_MAX   1024
+ #define   HOSTS_LINE_POS_MAX    1023
+@@ -76,12 +76,12 @@ int snoopy_datasource_domain (char * const result, cha
+      * START: COPY FROM datasource/hostname
+      */
+     /* Get my hostname first */
+-    retVal = gethostname(hostname, HOST_NAME_MAX);
++    retVal = gethostname(hostname, _POSIX_HOST_NAME_MAX);
+     if (0 != retVal) {
+         return snprintf(result, SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE, "(error @ gethostname(): %d)", errno);
+     }
+ 
+-    // If hostname was something alien (longer than HOST_NAME_MAX), then the
++    // If hostname was something alien (longer than _POSIX_HOST_NAME_MAX), then the
+     // last character may not be NULL (the behavior is unspecified).
+     // Let's avoid any surprises and null-terminate at the end of this buffer.
+     hostname[HOST_NAME_BUF_SIZE-1] = '\0';
diff --git a/security/snoopy/files/patch-src-datasource-sid.c b/security/snoopy/files/patch-src-datasource-sid.c
new file mode 100644
index 000000000000..e931d170a183
--- /dev/null
+++ b/security/snoopy/files/patch-src-datasource-sid.c
@@ -0,0 +1,10 @@
+--- src/datasource/sid.c.orig	2020-12-06 01:59:36 UTC
++++ src/datasource/sid.c
+@@ -30,7 +30,6 @@
+ #include "snoopy.h"
+ 
+ #ifndef   _XOPEN_SOURCE   /* Needed to get getpgid and getsid on older glibc */
+-#define   _XOPEN_SOURCE   500
+ #endif
+ #include <stdio.h>
+ #include <sys/types.h>
diff --git a/security/snoopy/files/patch-src-output-socketoutput.c b/security/snoopy/files/patch-src-output-socketoutput.c
new file mode 100644
index 000000000000..daba0cda43d3
--- /dev/null
+++ b/security/snoopy/files/patch-src-output-socketoutput.c
@@ -0,0 +1,10 @@
+--- src/output/socketoutput.c.orig	2020-12-07 03:14:46 UTC
++++ src/output/socketoutput.c
+@@ -30,7 +30,6 @@
+ #include "snoopy.h"
+ #include "configuration.h"
+ 
+-#include <features.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
diff --git a/security/snoopy/files/patch-src-snoopy.h b/security/snoopy/files/patch-src-snoopy.h
new file mode 100644
index 000000000000..e358ebb2a715
--- /dev/null
+++ b/security/snoopy/files/patch-src-snoopy.h
@@ -0,0 +1,11 @@
+--- src/snoopy.h.orig	2021-02-09 23:00:14 UTC
++++ src/snoopy.h
+@@ -31,8 +31,6 @@
+ /* This must be the first file to be included, or implicit inclusion
+  * (by i.e. <features.h>) does the wrong thing
+  */
+-#define  _XOPEN_SOURCE   700
+-#include <features.h>   /* Needed for GLIBC macros here */
+ #include <syslog.h>     /* Needed for syslog defaults */
+ #include <unistd.h>
+ 
diff --git a/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c b/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c
new file mode 100644
index 000000000000..2474375760e4
--- /dev/null
+++ b/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c
@@ -0,0 +1,11 @@
+--- tests/bin/snoopy-test-exec-in-threads.c.orig	2020-12-07 03:14:46 UTC
++++ tests/bin/snoopy-test-exec-in-threads.c
+@@ -31,7 +31,7 @@
+ #include <string.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+-#include <wait.h>
++#include <sys/wait.h>
+ 
+ 
+ 


More information about the dev-commits-ports-main mailing list