From 6731e63c549adf1b2f99f593880f0b4b00fcb9f4 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 29 Jun 2026 21:11:48 +0100 Subject: [PATCH] app-arch/tar: fix build w/ >=sys-apps/acl-2.4.0 Bug: https://bugs.gentoo.org/978280 Signed-off-by: Sam James --- app-arch/tar/files/tar-1.35-acl-2.4.0.patch | 99 ++++++++++++++++ app-arch/tar/tar-1.35-r1.ebuild | 122 ++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 app-arch/tar/files/tar-1.35-acl-2.4.0.patch create mode 100644 app-arch/tar/tar-1.35-r1.ebuild diff --git a/app-arch/tar/files/tar-1.35-acl-2.4.0.patch b/app-arch/tar/files/tar-1.35-acl-2.4.0.patch new file mode 100644 index 0000000000000..dfaf2fb1d5122 --- /dev/null +++ b/app-arch/tar/files/tar-1.35-acl-2.4.0.patch @@ -0,0 +1,99 @@ +https://bugs.gentoo.org/978280 +https://lists.gnu.org/archive/html/bug-tar/2026-06/msg00013.html + +From f1ecf60ea59c1503e63e887e455756b68db04806 Mon Sep 17 00:00:00 2001 +From: Pavel Cahyna +Date: Wed, 24 Jun 2026 18:45:30 +0200 +Subject: [PATCH] Avoid acl_ prefix for functions + +The acl.h header from libacl uses acl_ prefix for its functions. Avoid +defining functions with the same name in order to protect its namespace. +--- + src/xattrs.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/xattrs.c b/src/xattrs.c +index 86a7e59..c872ae3 100644 +--- a/src/xattrs.c ++++ b/src/xattrs.c +@@ -139,13 +139,13 @@ static struct + #ifdef HAVE_POSIX_ACLS + + /* acl-at wrappers, TODO: move to gnulib in future? */ +-static acl_t acl_get_file_at (int, const char *, acl_type_t); +-static int acl_set_file_at (int, const char *, acl_type_t, acl_t); ++static acl_t tar_acl_get_file_at (int, const char *, acl_type_t); ++static int tar_acl_set_file_at (int, const char *, acl_type_t, acl_t); + static int file_has_acl_at (int, char const *, struct stat const *); +-static int acl_delete_def_file_at (int, char const *); ++static int tar_acl_delete_def_file_at (int, char const *); + +-/* acl_get_file_at */ +-#define AT_FUNC_NAME acl_get_file_at ++/* tar_acl_get_file_at */ ++#define AT_FUNC_NAME tar_acl_get_file_at + #define AT_FUNC_RESULT acl_t + #define AT_FUNC_FAIL (acl_t)NULL + #define AT_FUNC_F1 acl_get_file +@@ -159,8 +159,8 @@ static int acl_delete_def_file_at (int, char const *); + #undef AT_FUNC_POST_FILE_PARAM_DECLS + #undef AT_FUNC_POST_FILE_ARGS + +-/* acl_set_file_at */ +-#define AT_FUNC_NAME acl_set_file_at ++/* tar_acl_set_file_at */ ++#define AT_FUNC_NAME tar_acl_set_file_at + #define AT_FUNC_F1 acl_set_file + #define AT_FUNC_POST_FILE_PARAM_DECLS , acl_type_t type, acl_t acl + #define AT_FUNC_POST_FILE_ARGS , type, acl +@@ -170,8 +170,8 @@ static int acl_delete_def_file_at (int, char const *); + #undef AT_FUNC_POST_FILE_PARAM_DECLS + #undef AT_FUNC_POST_FILE_ARGS + +-/* acl_delete_def_file_at */ +-#define AT_FUNC_NAME acl_delete_def_file_at ++/* tar_acl_delete_def_file_at */ ++#define AT_FUNC_NAME tar_acl_delete_def_file_at + #define AT_FUNC_F1 acl_delete_def_file + #define AT_FUNC_POST_FILE_PARAM_DECLS + #define AT_FUNC_POST_FILE_ARGS +@@ -299,10 +299,10 @@ xattrs__acls_set (struct tar_stat_info const *st, + /* No "default" IEEE 1003.1e ACL set for directory. At this moment, + FILE_NAME may already have inherited default acls from parent + directory; clean them up. */ +- if (acl_delete_def_file_at (chdir_fd, file_name)) ++ if (tar_acl_delete_def_file_at (chdir_fd, file_name)) + WARNOPT (WARN_XATTR_WRITE, + (0, errno, +- _("acl_delete_def_file_at: Cannot drop default POSIX ACLs " ++ _("tar_acl_delete_def_file_at: Cannot drop default POSIX ACLs " + "for file '%s'"), + file_name)); + return; +@@ -316,11 +316,11 @@ xattrs__acls_set (struct tar_stat_info const *st, + return; + } + +- if (acl_set_file_at (chdir_fd, file_name, type, acl) == -1) ++ if (tar_acl_set_file_at (chdir_fd, file_name, type, acl) == -1) + /* warn even if filesystem does not support acls */ + WARNOPT (WARN_XATTR_WRITE, + (0, errno, +- _ ("acl_set_file_at: Cannot set POSIX ACLs for file '%s'"), ++ _ ("tar_acl_set_file_at: Cannot set POSIX ACLs for file '%s'"), + file_name)); + + acl_free (acl); +@@ -357,10 +357,10 @@ acls_get_text (int parentfd, const char *file_name, acl_type_t type, + char *val = NULL; + acl_t acl; + +- if (!(acl = acl_get_file_at (parentfd, file_name, type))) ++ if (!(acl = tar_acl_get_file_at (parentfd, file_name, type))) + { + if (errno != ENOTSUP) +- call_arg_warn ("acl_get_file_at", file_name); ++ call_arg_warn ("tar_acl_get_file_at", file_name); + return; + } + diff --git a/app-arch/tar/tar-1.35-r1.ebuild b/app-arch/tar/tar-1.35-r1.ebuild new file mode 100644 index 0000000000000..624cc6c1f9ed9 --- /dev/null +++ b/app-arch/tar/tar-1.35-r1.ebuild @@ -0,0 +1,122 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/tar.asc +inherit branding multiprocessing verify-sig + +DESCRIPTION="Use this to make tarballs :)" +HOMEPAGE="https://www.gnu.org/software/tar/" +SRC_URI=" + mirror://gnu/tar/${P}.tar.xz + https://alpha.gnu.org/gnu/tar/${P}.tar.xz + verify-sig? ( + mirror://gnu/tar/${P}.tar.xz.sig + https://alpha.gnu.org/gnu/tar/${P}.tar.xz.sig + ) +" + +LICENSE="GPL-3+" +SLOT="0" +if [[ -z "$(ver_cut 3)" || "$(ver_cut 3)" -lt 90 ]] ; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris" +fi +IUSE="acl minimal nls selinux xattr" + +RDEPEND=" + acl? ( virtual/acl ) + selinux? ( sys-libs/libselinux ) +" +DEPEND=" + ${RDEPEND} + xattr? ( elibc_glibc? ( sys-apps/attr ) ) +" +BDEPEND=" + nls? ( sys-devel/gettext ) + verify-sig? ( sec-keys/openpgp-keys-tar ) +" +PDEPEND=" + app-alternatives/tar +" + +PATCHES=( + "${FILESDIR}"/${PN}-1.35-acl-2.4.0.patch +) + +src_configure() { + # -fanalyzer doesn't make sense for us in ebuilds, as it's for static analysis + export gl_cv_warn_c__fanalyzer=no + + local myeconfargs=( + --bindir="${EPREFIX}"/bin + # Avoid -Werror + --disable-gcc-warnings + --enable-backup-scripts + --libexecdir="${EPREFIX}"/usr/sbin + $(use_with acl posix-acls) + $(use_enable nls) + $(use_with selinux) + $(use_with xattr xattrs) + + # autoconf looks for gtar before tar (in configure scripts), hence + # in Prefix it is important that it is there, otherwise, a gtar from + # the host system (FreeBSD, Solaris, Darwin) will be found instead + # of the Prefix provided (GNU) tar + --program-prefix=g + ) + + # https://savannah.gnu.org/support/?111394 + # This can be removed when we patch dev-build/autoconf, though + # packages w/o eautoreconf will still need it. + [[ ${enable_year2038} == "no" ]] && myeconfargs+=( --disable-year2038 ) + + # Drop CONFIG_SHELL hack after 1.35: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=7687bf4acc4dc4554538389383d7fb4c3e6521cd + CONFIG_SHELL="${BROOT}"/bin/bash FORCE_UNSAFE_CONFIGURE=1 econf "${myeconfargs[@]}" +} + +src_test() { + # Drop after 1.35: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=18f90676e4695ffcf13413e9fbb24cc0ae2ae9d5 + local -x XZ_OPT= XZ_DEFAULTS= + + emake check TESTSUITEFLAGS="--jobs=$(get_makeopts_jobs)" +} + +src_install() { + default + + # A nasty yet required piece of baggage + exeinto /etc + doexe "${FILESDIR}"/rmt + + mv "${ED}"/usr/sbin/{gbackup,backup-tar} || die + mv "${ED}"/usr/sbin/{grestore,restore-tar} || die + mv "${ED}"/usr/sbin/{g,}backup.sh || die + mv "${ED}"/usr/sbin/{g,}dump-remind || die + + if use minimal ; then + find "${ED}"/etc "${ED}"/*bin/ "${ED}"/usr/*bin/ \ + -type f -a '!' -name gtar \ + -delete || die + fi + + if ! use minimal; then + dosym grmt /usr/sbin/rmt + fi + dosym grmt.8 /usr/share/man/man8/rmt.8 +} + +pkg_postinst() { + # Ensure to preserve the symlink before app-alternatives/tar + # is installed + if [[ ! -h ${EROOT}/bin/tar ]]; then + if [[ -e ${EROOT}/usr/bin/tar ]] ; then + # bug #904887 + ewarn "${EROOT}/usr/bin/tar exists but is not a symlink." + ewarn "This is expected during Prefix bootstrap and unusual otherwise." + ewarn "Moving away unexpected ${EROOT}/usr/bin/tar to .bak." + mv "${EROOT}/usr/bin/tar" "${EROOT}/usr/bin/tar.bak" || die + fi + ln -s gtar "${EROOT}/bin/tar" || die + fi +}