commit:     038e31c37d6e59768ae7abf5083559a0950c308f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  1 06:08:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar  1 07:54:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=038e31c3

sys-process/acct: update EAPI 7 -> 8, fix _F_S=3 crash, fix startup

* EAPI 8
* Fix crash with _FORTIFY_SOURCE=3 (bug #925419)
* Use tmpfiles to create /var/accounts/pacct which fixes startup/use on new 
installs
* Drop ancient workaround (bug #239748)

Bug: https://bugs.gentoo.org/239748
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-process/acct/acct-6.6.4-r4.ebuild              | 55 ++++++++++++++++++++++
 ...-fortify-source-3-sprintf-buffer-overflow.patch | 15 ++++++
 sys-process/acct/files/acct.tmpfiles               |  1 +
 3 files changed, 71 insertions(+)

diff --git a/sys-process/acct/acct-6.6.4-r4.ebuild 
b/sys-process/acct/acct-6.6.4-r4.ebuild
new file mode 100644
index 000000000000..980c95891435
--- /dev/null
+++ b/sys-process/acct/acct-6.6.4-r4.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools systemd tmpfiles
+
+DESCRIPTION="GNU system accounting utilities"
+HOMEPAGE="https://savannah.gnu.org/projects/acct/";
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="selinux"
+
+RDEPEND="selinux? ( sec-policy/selinux-acct )"
+BDEPEND="sys-apps/texinfo"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-6.6.4-cross-compile-fixed.patch
+       "${FILESDIR}"/${PN}-6.6.4-fortify-source-3-sprintf-buffer-overflow.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf --enable-linux-multiformat
+}
+
+src_install() {
+       default
+
+       keepdir /var/account
+
+       newinitd "${FILESDIR}"/acct.initd-r2 acct
+       newconfd "${FILESDIR}"/acct.confd-r1 acct
+
+       systemd_dounit "${FILESDIR}"/acct.service
+
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/acct.logrotate-r1 psacct
+
+       # sys-apps/sysvinit already provides this
+       rm "${ED}"/usr/bin/last "${ED}"/usr/share/man/man1/last.1 || die
+
+       newtmpfiles "${FILESDIR}"/acct.tmpfiles acct.conf
+}
+
+pkg_postinst() {
+       tmpfiles_process acct.conf
+}

diff --git 
a/sys-process/acct/files/acct-6.6.4-fortify-source-3-sprintf-buffer-overflow.patch
 
b/sys-process/acct/files/acct-6.6.4-fortify-source-3-sprintf-buffer-overflow.patch
new file mode 100644
index 000000000000..83f6e33415e7
--- /dev/null
+++ 
b/sys-process/acct/files/acct-6.6.4-fortify-source-3-sprintf-buffer-overflow.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/925419
+https://bugzilla.redhat.com/2190057
+https://src.fedoraproject.org/rpms/psacct/blob/rawhide/f/psacct-6.6.4-sprintf-buffer-overflow.patch
+
+--- a/dev_hash.c
++++ b/dev_hash.c
+@@ -147,7 +147,7 @@ static void setup_devices(char *dirname)
+     {
+       char *fullname = (char *) alloca ((strlen (dirname)
+                                          + NAMLEN (dp)
+-                                         + 1) * sizeof (char));
++                                         + 2) * sizeof (char));  /* slash + 
null; Fedora BZ#2190057 */
+ 
+       (void)sprintf (fullname, "%s/%s", dirname, dp->d_name);
+       if (stat (fullname, &sp))

diff --git a/sys-process/acct/files/acct.tmpfiles 
b/sys-process/acct/files/acct.tmpfiles
new file mode 100644
index 000000000000..8f2b1e6f303c
--- /dev/null
+++ b/sys-process/acct/files/acct.tmpfiles
@@ -0,0 +1 @@
+f      /var/account/pacct      0600    -       -       -       -

Reply via email to