From 2575dc7c05a83eeb1ae28e32d7067173861b3785 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Wed, 29 May 2024 11:43:31 -0700 Subject: sys-power/nut: fix systemd-analyze sandbox violation Signed-off-by: Robin H. Johnson Closes: https://bugs.gentoo.org/932962 --- sys-power/nut/files/systemd_notify.patch | 50 ++++++++++++++++++++++++++++++++ sys-power/nut/files/systemd_notify.path | 50 -------------------------------- sys-power/nut/nut-2.8.2.ebuild | 5 ++-- sys-power/nut/nut-9999.ebuild | 5 ++-- 4 files changed, 56 insertions(+), 54 deletions(-) create mode 100644 sys-power/nut/files/systemd_notify.patch delete mode 100644 sys-power/nut/files/systemd_notify.path (limited to 'sys-power') diff --git a/sys-power/nut/files/systemd_notify.patch b/sys-power/nut/files/systemd_notify.patch new file mode 100644 index 000000000000..657e0075420c --- /dev/null +++ b/sys-power/nut/files/systemd_notify.patch @@ -0,0 +1,50 @@ +--- old/configure.ac 2023-06-09 00:53:54.121886669 +0200 ++++ new/configure.ac 2023-06-09 00:57:13.149792791 +0200 +@@ -3220,45 +3220,8 @@ + AC_PATH_PROG([SYSTEMD_ANALYZE_PROGRAM], [systemd-analyze], [/usr/bin/systemd-analyze]) + + dnl Relevant since 2023: https://github.com/systemd/systemd/pull/25916 +-SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=no +-AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ +- AC_MSG_CHECKING([if your systemd version supports Type=notify]) +- myFILE="`mktemp systemd-analyze-XXXXXX.service`" +- cat > "$myFILE" << EOF +-@<:@Unit@:>@ +-Description=temp +-@<:@Service@:>@ +-ExecStart=/bin/true +-Type=notify +-EOF +- if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" \ +- && ! (echo "$myOUT" | grep "Failed to parse service type, ignoring") \ +- ; then +- SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes +- fi +- rm -f "$myFILE" +- AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY}]) +- ]) +- +-SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=no +-AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ +- AC_MSG_CHECKING([if your systemd version supports Type=notify-reload]) +- myFILE="`mktemp systemd-analyze-XXXXXX.service`" +- cat > "$myFILE" << EOF +-@<:@Unit@:>@ +-Description=temp +-@<:@Service@:>@ +-ExecStart=/bin/true +-Type=notify-reload +-EOF +- if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" \ +- && ! (echo "$myOUT" | grep "Failed to parse service type, ignoring") \ +- ; then +- SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes +- fi +- rm -f "$myFILE" +- AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD}]) +- ]) ++SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes ++SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes + + AS_IF([test x"${with_libsystemd}" = xyes && test x"${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY}" = xyes], [ + dnl Built with sd_notify support diff --git a/sys-power/nut/files/systemd_notify.path b/sys-power/nut/files/systemd_notify.path deleted file mode 100644 index 657e0075420c..000000000000 --- a/sys-power/nut/files/systemd_notify.path +++ /dev/null @@ -1,50 +0,0 @@ ---- old/configure.ac 2023-06-09 00:53:54.121886669 +0200 -+++ new/configure.ac 2023-06-09 00:57:13.149792791 +0200 -@@ -3220,45 +3220,8 @@ - AC_PATH_PROG([SYSTEMD_ANALYZE_PROGRAM], [systemd-analyze], [/usr/bin/systemd-analyze]) - - dnl Relevant since 2023: https://github.com/systemd/systemd/pull/25916 --SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=no --AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ -- AC_MSG_CHECKING([if your systemd version supports Type=notify]) -- myFILE="`mktemp systemd-analyze-XXXXXX.service`" -- cat > "$myFILE" << EOF --@<:@Unit@:>@ --Description=temp --@<:@Service@:>@ --ExecStart=/bin/true --Type=notify --EOF -- if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" \ -- && ! (echo "$myOUT" | grep "Failed to parse service type, ignoring") \ -- ; then -- SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes -- fi -- rm -f "$myFILE" -- AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY}]) -- ]) -- --SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=no --AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ -- AC_MSG_CHECKING([if your systemd version supports Type=notify-reload]) -- myFILE="`mktemp systemd-analyze-XXXXXX.service`" -- cat > "$myFILE" << EOF --@<:@Unit@:>@ --Description=temp --@<:@Service@:>@ --ExecStart=/bin/true --Type=notify-reload --EOF -- if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" \ -- && ! (echo "$myOUT" | grep "Failed to parse service type, ignoring") \ -- ; then -- SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes -- fi -- rm -f "$myFILE" -- AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD}]) -- ]) -+SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes -+SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes - - AS_IF([test x"${with_libsystemd}" = xyes && test x"${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY}" = xyes], [ - dnl Built with sd_notify support diff --git a/sys-power/nut/nut-2.8.2.ebuild b/sys-power/nut/nut-2.8.2.ebuild index fbd9812f3c08..9a6702956acb 100644 --- a/sys-power/nut/nut-2.8.2.ebuild +++ b/sys-power/nut/nut-2.8.2.ebuild @@ -69,8 +69,9 @@ RDEPEND=" PATCHES=( "${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch" - "${FILESDIR}/systemd_notify.path" + "${FILESDIR}/systemd_notify.patch" ) +PATCH_NEEDS_AUTOGEN=1 pkg_pretend() { if use i2c; then @@ -102,7 +103,7 @@ pkg_setup() { src_prepare() { default - if [[ ${PV} == *9999 ]] ; then + if [[ ${PV} == *9999 ]] || [[ ${PATCH_NEEDS_AUTOGEN} == 1 ]] ; then ./autogen.sh || die fi diff --git a/sys-power/nut/nut-9999.ebuild b/sys-power/nut/nut-9999.ebuild index fbd9812f3c08..9a6702956acb 100644 --- a/sys-power/nut/nut-9999.ebuild +++ b/sys-power/nut/nut-9999.ebuild @@ -69,8 +69,9 @@ RDEPEND=" PATCHES=( "${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch" - "${FILESDIR}/systemd_notify.path" + "${FILESDIR}/systemd_notify.patch" ) +PATCH_NEEDS_AUTOGEN=1 pkg_pretend() { if use i2c; then @@ -102,7 +103,7 @@ pkg_setup() { src_prepare() { default - if [[ ${PV} == *9999 ]] ; then + if [[ ${PV} == *9999 ]] || [[ ${PATCH_NEEDS_AUTOGEN} == 1 ]] ; then ./autogen.sh || die fi -- cgit v1.2.3-65-gdbad