commit:     6ded56cd9ef0b4f86918d9b675bbb87ca143d344
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  1 22:28:38 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Sep  1 22:29:06 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ded56cd

sys-apps/attr: switch back to syscall

Link: https://lists.nongnu.org/archive/html/acl-devel/2018-08/msg00000.html
Package-Manager: Portage-2.3.48, Repoman-2.3.10

 sys-apps/attr/attr-2.4.48-r3.ebuild                |  86 ++++++++++++++
 .../files/attr-2.4.48-switch-back-to-syscall.patch | 123 +++++++++++++++++++++
 2 files changed, 209 insertions(+)

diff --git a/sys-apps/attr/attr-2.4.48-r3.ebuild 
b/sys-apps/attr/attr-2.4.48-r3.ebuild
new file mode 100644
index 00000000000..2e011e44eea
--- /dev/null
+++ b/sys-apps/attr/attr-2.4.48-r3.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit libtool toolchain-funcs multilib-minimal
+
+DESCRIPTION="Extended attributes tools"
+HOMEPAGE="https://savannah.nongnu.org/projects/attr";
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="debug nls static-libs"
+
+DEPEND="nls? ( sys-devel/gettext )"
+
+PATCHES=(
+       "${FILESDIR}/${P}-perl-5.26.patch"
+       "${FILESDIR}/${P}-switch-back-to-syscall.patch"
+)
+
+src_prepare() {
+       default
+       elibtoolize #580792
+}
+
+multilib_src_configure() {
+       unset PLATFORM #184564
+       export OPTIMIZER=${CFLAGS}
+       export DEBUG=-DNDEBUG
+
+       tc-ld-disable-gold #644048
+
+       local myeconfargs=(
+               --bindir="${EPREFIX%/}"/bin
+               --enable-shared
+               $(use_enable static-libs static)
+               $(use_enable nls)
+               --libexecdir="${EPREFIX%/}"/usr/$(get_libdir)
+               $(use_enable debug)
+       )
+       ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_install() {
+       emake DESTDIR="${D%/}" install
+
+       # Sanity check until we track down why this is happening. #644048
+       local lib="${ED%/}/usr/$(get_libdir)/libattr.so.1"
+       if [[ -e ${lib} ]] ; then
+               local versions=$(readelf -V "${lib}")
+               local symbols=$(readelf -sW "${lib}")
+               if [[ "${versions}" != *"ATTR_1.0"* || \
+                     "${versions}" != *"ATTR_1.1"* || \
+                     "${versions}" != *"ATTR_1.2"* || \
+                     "${versions}" != *"ATTR_1.3"* || \
+                     "${symbols}" != *"getxattr@ATTR_1.0"* ]] ; then
+                       echo "# readelf -V ${lib}"
+                       echo "${versions}"
+                       echo "# readelf -sW ${lib}"
+                       echo "${symbols}"
+                       die "symbol version sanity check failed; please comment 
on https://bugs.gentoo.org/644048";
+               else
+                       einfo "${lib} passed symbol checks"
+               fi
+       fi
+
+       if multilib_is_native_abi; then
+               # we install attr into /bin, so we need the shared lib with it
+               gen_usr_ldscript -a attr
+       fi
+
+       # Add a wrapper until people upgrade.
+       insinto /usr/include/attr
+       newins "${FILESDIR}"/xattr-shim.h xattr.h
+}
+
+multilib_src_install_all() {
+       if ! use static-libs; then
+               find "${ED%/}" -name '*.la' -delete || die
+       fi
+
+       einstalldocs
+}

diff --git a/sys-apps/attr/files/attr-2.4.48-switch-back-to-syscall.patch 
b/sys-apps/attr/files/attr-2.4.48-switch-back-to-syscall.patch
new file mode 100644
index 00000000000..5691b15420c
--- /dev/null
+++ b/sys-apps/attr/files/attr-2.4.48-switch-back-to-syscall.patch
@@ -0,0 +1,123 @@
+From 14adc898a36948267bfe5c63b399996879e94c98 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <[email protected]>
+Date: Fri, 17 Aug 2018 14:07:31 +0200
+Subject: Switch back to syscall()
+
+Switch back to syscall() for the *xattr system calls.  The current
+mechanism of forwarding those calls to glibc breaks libraries like
+libfakeroot (fakeroot) and libasan (the gcc address sanitizer; gcc
+-fsanitize=address).
+
+Those libraries provide wrappers for functions defined in other shared
+libraries, usually glibc, do their own processing, and forward calls to
+the original symbols looke dup via dlsym(RTLD_NEXT, "symbol_name").  In
+our case, dlsym returns the libattr_*xattr wrappers.  However, when our
+wrappers try calling glibc, they end up calling the libfakeroot /
+libasan wrappers instead because those override the original symbols =>
+recursion.
+
+The libattr_*xattr wrappers will only be used when symbols are looked up
+at runtime (dlopen / dlsym).  Programs linking against libattr will
+directly use the glibc provided symbols.  Therefore, the slightly worse
+performance of syscall() won't affect any of the "normal" users of
+libattr.
+---
+ libattr/syscalls.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/libattr/syscalls.c b/libattr/syscalls.c
+index 3013aa0..721ad7f 100644
+--- a/libattr/syscalls.c
++++ b/libattr/syscalls.c
+@@ -22,6 +22,8 @@
+ 
+ #include "config.h"
+ 
++#include <unistd.h>
++#include <sys/syscall.h>
+ #include <sys/xattr.h>
+ 
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE
+@@ -31,67 +33,67 @@
+ int libattr_setxattr(const char *path, const char *name,
+                    void *value, size_t size, int flags)
+ {
+-      return setxattr(path, name, value, size, flags);
++      return syscall(__NR_setxattr, path, name, value, size, flags);
+ }
+ 
+ int libattr_lsetxattr(const char *path, const char *name,
+                     void *value, size_t size, int flags)
+ {
+-      return lsetxattr(path, name, value, size, flags);
++      return syscall(__NR_lsetxattr, path, name, value, size, flags);
+ }
+ 
+ int libattr_fsetxattr(int filedes, const char *name,
+                     void *value, size_t size, int flags)
+ {
+-      return fsetxattr(filedes, name, value, size, flags);
++      return syscall(__NR_fsetxattr, filedes, name, value, size, flags);
+ }
+ 
+ ssize_t libattr_getxattr(const char *path, const char *name,
+                        void *value, size_t size)
+ {
+-      return getxattr(path, name, value, size);
++      return syscall(__NR_getxattr, path, name, value, size);
+ }
+ 
+ ssize_t libattr_lgetxattr(const char *path, const char *name,
+                         void *value, size_t size)
+ {
+-      return lgetxattr(path, name, value, size);
++      return syscall(__NR_lgetxattr, path, name, value, size);
+ }
+ 
+ ssize_t libattr_fgetxattr(int filedes, const char *name,
+                         void *value, size_t size)
+ {
+-      return fgetxattr(filedes, name, value, size);
++      return syscall(__NR_fgetxattr, filedes, name, value, size);
+ }
+ 
+ ssize_t libattr_listxattr(const char *path, char *list, size_t size)
+ {
+-      return listxattr(path, list, size);
++      return syscall(__NR_listxattr, path, list, size);
+ }
+ 
+ ssize_t libattr_llistxattr(const char *path, char *list, size_t size)
+ {
+-      return llistxattr(path, list, size);
++      return syscall(__NR_llistxattr, path, list, size);
+ }
+ 
+ ssize_t libattr_flistxattr(int filedes, char *list, size_t size)
+ {
+-      return flistxattr(filedes, list, size);
++      return syscall(__NR_flistxattr, filedes, list, size);
+ }
+ 
+ int libattr_removexattr(const char *path, const char *name)
+ {
+-      return removexattr(path, name);
++      return syscall(__NR_removexattr, path, name);
+ }
+ 
+ int libattr_lremovexattr(const char *path, const char *name)
+ {
+-      return lremovexattr(path, name);
++      return syscall(__NR_lremovexattr, path, name);
+ }
+ 
+ int libattr_fremovexattr(int filedes, const char *name)
+ {
+-      return fremovexattr(filedes, name);
++      return syscall(__NR_fremovexattr, filedes, name);
+ }
+ 
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE
+-- 
+cgit v1.0-41-gc330
+

Reply via email to