sys-apps/attr: Sync with Gentoo

It's from Gentoo commit cab7a58fc4eb39c994fbdf820ca83f192513c5c2.
This commit is contained in:
Krzesimir Nowak 2022-10-21 12:05:36 +02:00
parent d9047e2c17
commit 197fc9e824
5 changed files with 248 additions and 43 deletions

View File

@ -1 +1 @@
DIST attr-2.5.1.tar.gz 465714 BLAKE2B 05928f8274b0b4beee31b329c8459436c5b9019ebd2f937667b7beb8df7a455c48742a90d9c4faca5c0b38c9c3812043d3d66f9587108d3424c6184fef494b56 SHA512 8b4c043d61f8f3e0cd098e701181069f51117b85fd6ba18bfe9af77d894ea671232377d4793ffc822e9259ceee6ac71d75732eb93b2830c6cb5d0d918ba2d21b DIST attr-2.5.1.tar.xz 318188 BLAKE2B 876dcbd802ea79b7851640f208820ffdfb73dc46065af673037c6dd50ad2af158f9f74b34cf45728baf9d0cc5572b40c3f102aa2907245a877db0d3879e38f04 SHA512 9e5555260189bb6ef2440c76700ebb813ff70582eb63d446823874977307d13dfa3a347dfae619f8866943dfa4b24ccf67dadd7e3ea2637239fdb219be5d2932

View File

@ -1,28 +1,33 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI="7" EAPI=8
inherit flag-o-matic libtool toolchain-funcs multilib-minimal usr-ldscript inherit toolchain-funcs multilib-minimal usr-ldscript
if [[ ${PV} == 9999 ]] ; then if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git" EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git"
inherit autotools git-r3 inherit autotools git-r3
else else
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux" inherit libtool
SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz"
fi fi
DESCRIPTION="Extended attributes tools" DESCRIPTION="Extended attributes tools"
HOMEPAGE="https://savannah.nongnu.org/projects/attr" HOMEPAGE="https://savannah.nongnu.org/projects/attr"
LICENSE="LGPL-2.1" LICENSE="LGPL-2.1"
SLOT="0" SLOT="0"
IUSE="debug nls static-libs" IUSE="debug nls static-libs"
BDEPEND="nls? ( sys-devel/gettext )" BDEPEND="nls? ( sys-devel/gettext )"
PATCHES=(
"${FILESDIR}"/${PN}-2.5.1-r2-fix-symver.patch
)
src_prepare() { src_prepare() {
default default
@ -31,35 +36,28 @@ src_prepare() {
eautopoint eautopoint
eautoreconf eautoreconf
else else
elibtoolize #580792 # bug #580792
elibtoolize
fi fi
} }
src_configure() {
# Remove -flto* from flags as this breaks binaries (bug #644048)
filter-flags -flto*
append-ldflags "-Wl,--no-gc-sections" #700116
tc-ld-force-bfd #644048
append-lfs-flags #760857
multilib-minimal_src_configure
}
multilib_src_configure() { multilib_src_configure() {
local myeconfargs=( local myeconfargs=(
--bindir="${EPREFIX}"/bin --bindir="${EPREFIX}"/bin
--libexecdir="${EPREFIX}"/usr/$(get_libdir)
--enable-shared --enable-shared
$(use_enable static-libs static) $(use_enable static-libs static)
$(use_enable nls) $(use_enable nls)
--libexecdir="${EPREFIX}"/usr/$(get_libdir)
$(use_enable debug) $(use_enable debug)
) )
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
} }
multilib_src_install() { multilib_src_install() {
emake DESTDIR="${D}" install emake DESTDIR="${D}" install
# Sanity check until we track down why this is happening. #644048 # Sanity check until we track down why this is happening. bug #644048
local lib="${ED}/usr/$(get_libdir)/libattr.so.1" local lib="${ED}/usr/$(get_libdir)/libattr.so.1"
if [[ -e ${lib} ]] ; then if [[ -e ${lib} ]] ; then
local versions=$($(tc-getREADELF) -V "${lib}") local versions=$($(tc-getREADELF) -V "${lib}")
@ -73,18 +71,19 @@ multilib_src_install() {
echo "${versions}" echo "${versions}"
echo "# readelf -sW ${lib}" echo "# readelf -sW ${lib}"
echo "${symbols}" echo "${symbols}"
die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048" die "Symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048"
else else
einfo "${lib} passed symbol checks" einfo "${lib} passed symbol checks"
fi fi
fi fi
if multilib_is_native_abi; then if multilib_is_native_abi; then
# we install attr into /bin, so we need the shared lib with it # We install attr into /bin, so we need the shared lib with it
gen_usr_ldscript -a attr gen_usr_ldscript -a attr
fi fi
# Add a wrapper until people upgrade. # Add a wrapper until people upgrade.
# TODO: figure out when this was added & when we can drop it!
insinto /usr/include/attr insinto /usr/include/attr
newins "${FILESDIR}"/xattr-shim.h xattr.h newins "${FILESDIR}"/xattr-shim.h xattr.h
} }

View File

@ -1,28 +1,33 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI="7" EAPI=8
inherit flag-o-matic libtool toolchain-funcs multilib-minimal usr-ldscript inherit toolchain-funcs multilib-minimal usr-ldscript
if [[ ${PV} == 9999 ]] ; then if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git" EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git"
inherit autotools git-r3 inherit autotools git-r3
else else
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" inherit libtool
SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz"
fi fi
DESCRIPTION="Extended attributes tools" DESCRIPTION="Extended attributes tools"
HOMEPAGE="https://savannah.nongnu.org/projects/attr" HOMEPAGE="https://savannah.nongnu.org/projects/attr"
LICENSE="LGPL-2.1" LICENSE="LGPL-2.1"
SLOT="0" SLOT="0"
IUSE="debug nls static-libs" IUSE="debug nls static-libs"
BDEPEND="nls? ( sys-devel/gettext )" BDEPEND="nls? ( sys-devel/gettext )"
PATCHES=(
"${FILESDIR}"/${PN}-2.5.1-r2-fix-symver.patch
)
src_prepare() { src_prepare() {
default default
@ -31,35 +36,28 @@ src_prepare() {
eautopoint eautopoint
eautoreconf eautoreconf
else else
elibtoolize #580792 # bug #580792
elibtoolize
fi fi
} }
src_configure() {
# Remove -flto* from flags as this breaks binaries (bug #644048)
filter-flags -flto*
append-ldflags "-Wl,--no-gc-sections" #700116
tc-ld-force-bfd #644048
append-lfs-flags #760857
multilib-minimal_src_configure
}
multilib_src_configure() { multilib_src_configure() {
local myeconfargs=( local myeconfargs=(
--bindir="${EPREFIX}"/bin --bindir="${EPREFIX}"/bin
--libexecdir="${EPREFIX}"/usr/$(get_libdir)
--enable-shared --enable-shared
$(use_enable static-libs static) $(use_enable static-libs static)
$(use_enable nls) $(use_enable nls)
--libexecdir="${EPREFIX}"/usr/$(get_libdir)
$(use_enable debug) $(use_enable debug)
) )
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
} }
multilib_src_install() { multilib_src_install() {
emake DESTDIR="${D}" install emake DESTDIR="${D}" install
# Sanity check until we track down why this is happening. #644048 # Sanity check until we track down why this is happening. bug #644048
local lib="${ED}/usr/$(get_libdir)/libattr.so.1" local lib="${ED}/usr/$(get_libdir)/libattr.so.1"
if [[ -e ${lib} ]] ; then if [[ -e ${lib} ]] ; then
local versions=$($(tc-getREADELF) -V "${lib}") local versions=$($(tc-getREADELF) -V "${lib}")
@ -73,18 +71,19 @@ multilib_src_install() {
echo "${versions}" echo "${versions}"
echo "# readelf -sW ${lib}" echo "# readelf -sW ${lib}"
echo "${symbols}" echo "${symbols}"
die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048" die "Symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048"
else else
einfo "${lib} passed symbol checks" einfo "${lib} passed symbol checks"
fi fi
fi fi
if multilib_is_native_abi; then if multilib_is_native_abi; then
# we install attr into /bin, so we need the shared lib with it # We install attr into /bin, so we need the shared lib with it
gen_usr_ldscript -a attr gen_usr_ldscript -a attr
fi fi
# Add a wrapper until people upgrade. # Add a wrapper until people upgrade.
# TODO: figure out when this was added & when we can drop it!
insinto /usr/include/attr insinto /usr/include/attr
newins "${FILESDIR}"/xattr-shim.h xattr.h newins "${FILESDIR}"/xattr-shim.h xattr.h
} }

View File

@ -0,0 +1,206 @@
https://lists.nongnu.org/archive/html/acl-devel/2022-05/msg00000.html
Bug: https://bugs.gentoo.org/644048
Bug: https://bugs.gentoo.org/700116
From a9ca51afd2b9f68f57de3a4c3d962d1d763572ca Mon Sep 17 00:00:00 2001
From: Alexander Miller <alex.miller@gmx.de>
Date: Thu, 28 Nov 2019 22:17:24 +0100
Subject: [PATCH] Better supported way to set symbol versions for legacy
syscalls
Using a linker script to set a symbol versions is an undocumented
hack and doesn't work reliably in many cases. It works (to some
degree) with the bfd linker, but fails with gold or lld. And even
with bfd it can break when using --gc-sections or LTO.
The result may be a library where the code has been discarded and
the versioned symbols are unusable, e.g.
23: 00000000 0 NOTYPE GLOBAL DEFAULT ABS getxattr@ATTR_1.0
instead of
23: 000033c0 0 FUNC GLOBAL DEFAULT 11 getxattr@ATTR_1.0
Remove the linker script entirely and set symbol versions with the
symver attribute if available (in gcc >= 10, but not in clang),
otherwise use the traditional global asm solution with a .symver
directive.
Those are the documented ways to do it and well supported by (almost)
all configurations. (The exception is old gcc with LTO; a workaround
is included, but some versions may still need -flto-partition=none).
Signed-off-by: Alexander Miller <alex.miller@gmx.de>
--- a/libattr/Makemodule.am
+++ b/libattr/Makemodule.am
@@ -8,7 +8,7 @@ LT_CURRENT = 2
LT_AGE = 1
LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libattr_la_DEPENDENCIES = exports libattr/libattr.lds
+libattr_la_DEPENDENCIES = exports
libattr_la_SOURCES = \
libattr/attr_copy_action.c \
libattr/attr_copy_check.c \
@@ -20,7 +20,4 @@ libattr_la_SOURCES = \
libattr_la_CFLAGS = -include libattr/libattr.h
libattr_la_LDFLAGS = \
-Wl,--version-script,$(top_srcdir)/exports \
- -Wl,$(top_srcdir)/libattr/libattr.lds \
-version-info $(LTVERSION)
-
-EXTRA_DIST += libattr/libattr.lds
--- a/Makefile.in
+++ b/Makefile.in
@@ -647,9 +647,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = exports examples/copyattr.c examples/Makefile \
- libattr/libattr.lds test/README test/run \
- test/sort-getfattr-output $(TESTS)
+EXTRA_DIST = exports examples/copyattr.c examples/Makefile test/README \
+ test/run test/sort-getfattr-output $(TESTS)
SUBDIRS = po
AM_CPPFLAGS = \
-I$(top_builddir)/include \
@@ -689,7 +688,7 @@ LT_CURRENT = 2
#LT_REVISION =
LT_AGE = 1
LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-libattr_la_DEPENDENCIES = exports libattr/libattr.lds
+libattr_la_DEPENDENCIES = exports
libattr_la_SOURCES = \
libattr/attr_copy_action.c \
libattr/attr_copy_check.c \
@@ -702,7 +701,6 @@ libattr_la_SOURCES = \
libattr_la_CFLAGS = -include libattr/libattr.h
libattr_la_LDFLAGS = \
-Wl,--version-script,$(top_srcdir)/exports \
- -Wl,$(top_srcdir)/libattr/libattr.lds \
-version-info $(LTVERSION)
libmisc_la_SOURCES = \
--- a/libattr/libattr.lds
+++ /dev/null
@@ -1,12 +0,0 @@
-"fgetxattr@ATTR_1.0" = libattr_fgetxattr;
-"flistxattr@ATTR_1.0" = libattr_flistxattr;
-"fremovexattr@ATTR_1.0" = libattr_fremovexattr;
-"fsetxattr@ATTR_1.0" = libattr_fsetxattr;
-"getxattr@ATTR_1.0" = libattr_getxattr;
-"lgetxattr@ATTR_1.0" = libattr_lgetxattr;
-"listxattr@ATTR_1.0" = libattr_listxattr;
-"llistxattr@ATTR_1.0" = libattr_llistxattr;
-"lremovexattr@ATTR_1.0" = libattr_lremovexattr;
-"lsetxattr@ATTR_1.0" = libattr_lsetxattr;
-"removexattr@ATTR_1.0" = libattr_removexattr;
-"setxattr@ATTR_1.0" = libattr_setxattr;
--- a/libattr/syscalls.c
+++ b/libattr/syscalls.c
@@ -26,6 +26,27 @@
#include <sys/syscall.h>
#include <sys/xattr.h>
+/*
+ * Versioning of compat symbols:
+ * prefer symver attribute if available (since gcc 10),
+ * fall back to traditional .symver asm directive otherwise.
+ */
+#ifdef __has_attribute
+# if __has_attribute(symver)
+# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((symver(vn)))
+# elif __has_attribute(no_reorder)
+ /*
+ * Avoid wrong partitioning with older gcc and LTO. May not work reliably
+ * with all versions; use -flto-partition=none if you encounter problems.
+ */
+# define SYMVER(cn, vn) __typeof(cn) cn __attribute__((noreorder)); \
+ __asm__(".symver " #cn "," vn)
+# endif
+#endif
+#ifndef SYMVER
+# define SYMVER(cn, vn) __asm__(".symver " #cn "," vn)
+#endif
+
#ifdef HAVE_VISIBILITY_ATTRIBUTE
# pragma GCC visibility push(default)
#endif
@@ -35,66 +56,78 @@ int libattr_setxattr(const char *path, const char *name,
{
return syscall(__NR_setxattr, path, name, value, size, flags);
}
+SYMVER(libattr_setxattr, "setxattr@ATTR_1.0");
int libattr_lsetxattr(const char *path, const char *name,
void *value, size_t size, int flags)
{
return syscall(__NR_lsetxattr, path, name, value, size, flags);
}
+SYMVER(libattr_lsetxattr, "lsetxattr@ATTR_1.0");
int libattr_fsetxattr(int filedes, const char *name,
void *value, size_t size, int flags)
{
return syscall(__NR_fsetxattr, filedes, name, value, size, flags);
}
+SYMVER(libattr_fsetxattr, "fsetxattr@ATTR_1.0");
ssize_t libattr_getxattr(const char *path, const char *name,
void *value, size_t size)
{
return syscall(__NR_getxattr, path, name, value, size);
}
+SYMVER(libattr_getxattr, "getxattr@ATTR_1.0");
ssize_t libattr_lgetxattr(const char *path, const char *name,
void *value, size_t size)
{
return syscall(__NR_lgetxattr, path, name, value, size);
}
+SYMVER(libattr_lgetxattr, "lgetxattr@ATTR_1.0");
ssize_t libattr_fgetxattr(int filedes, const char *name,
void *value, size_t size)
{
return syscall(__NR_fgetxattr, filedes, name, value, size);
}
+SYMVER(libattr_fgetxattr, "fgetxattr@ATTR_1.0");
ssize_t libattr_listxattr(const char *path, char *list, size_t size)
{
return syscall(__NR_listxattr, path, list, size);
}
+SYMVER(libattr_listxattr, "listxattr@ATTR_1.0");
ssize_t libattr_llistxattr(const char *path, char *list, size_t size)
{
return syscall(__NR_llistxattr, path, list, size);
}
+SYMVER(libattr_llistxattr, "llistxattr@ATTR_1.0");
ssize_t libattr_flistxattr(int filedes, char *list, size_t size)
{
return syscall(__NR_flistxattr, filedes, list, size);
}
+SYMVER(libattr_flistxattr, "flistxattr@ATTR_1.0");
int libattr_removexattr(const char *path, const char *name)
{
return syscall(__NR_removexattr, path, name);
}
+SYMVER(libattr_removexattr, "removexattr@ATTR_1.0");
int libattr_lremovexattr(const char *path, const char *name)
{
return syscall(__NR_lremovexattr, path, name);
}
+SYMVER(libattr_lremovexattr, "lremovexattr@ATTR_1.0");
int libattr_fremovexattr(int filedes, const char *name)
{
return syscall(__NR_fremovexattr, filedes, name);
}
+SYMVER(libattr_fremovexattr, "fremovexattr@ATTR_1.0");
#ifdef HAVE_VISIBILITY_ATTRIBUTE
# pragma GCC visibility pop

View File

@ -7,5 +7,6 @@
</maintainer> </maintainer>
<upstream> <upstream>
<remote-id type="cpe">cpe:/a:attr_project:attr</remote-id> <remote-id type="cpe">cpe:/a:attr_project:attr</remote-id>
<remote-id type="savannah-nongnu">attr</remote-id>
</upstream> </upstream>
</pkgmetadata> </pkgmetadata>