1 |
commit: 6ded56cd9ef0b4f86918d9b675bbb87ca143d344 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 1 22:28:38 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Sep 1 22:29:06 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ded56cd |
7 |
|
8 |
sys-apps/attr: switch back to syscall |
9 |
|
10 |
Link: https://lists.nongnu.org/archive/html/acl-devel/2018-08/msg00000.html |
11 |
Package-Manager: Portage-2.3.48, Repoman-2.3.10 |
12 |
|
13 |
sys-apps/attr/attr-2.4.48-r3.ebuild | 86 ++++++++++++++ |
14 |
.../files/attr-2.4.48-switch-back-to-syscall.patch | 123 +++++++++++++++++++++ |
15 |
2 files changed, 209 insertions(+) |
16 |
|
17 |
diff --git a/sys-apps/attr/attr-2.4.48-r3.ebuild b/sys-apps/attr/attr-2.4.48-r3.ebuild |
18 |
new file mode 100644 |
19 |
index 00000000000..2e011e44eea |
20 |
--- /dev/null |
21 |
+++ b/sys-apps/attr/attr-2.4.48-r3.ebuild |
22 |
@@ -0,0 +1,86 @@ |
23 |
+# Copyright 1999-2018 Gentoo Foundation |
24 |
+# Distributed under the terms of the GNU General Public License v2 |
25 |
+ |
26 |
+EAPI="6" |
27 |
+ |
28 |
+inherit libtool toolchain-funcs multilib-minimal |
29 |
+ |
30 |
+DESCRIPTION="Extended attributes tools" |
31 |
+HOMEPAGE="https://savannah.nongnu.org/projects/attr" |
32 |
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz" |
33 |
+ |
34 |
+LICENSE="LGPL-2.1" |
35 |
+SLOT="0" |
36 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" |
37 |
+IUSE="debug nls static-libs" |
38 |
+ |
39 |
+DEPEND="nls? ( sys-devel/gettext )" |
40 |
+ |
41 |
+PATCHES=( |
42 |
+ "${FILESDIR}/${P}-perl-5.26.patch" |
43 |
+ "${FILESDIR}/${P}-switch-back-to-syscall.patch" |
44 |
+) |
45 |
+ |
46 |
+src_prepare() { |
47 |
+ default |
48 |
+ elibtoolize #580792 |
49 |
+} |
50 |
+ |
51 |
+multilib_src_configure() { |
52 |
+ unset PLATFORM #184564 |
53 |
+ export OPTIMIZER=${CFLAGS} |
54 |
+ export DEBUG=-DNDEBUG |
55 |
+ |
56 |
+ tc-ld-disable-gold #644048 |
57 |
+ |
58 |
+ local myeconfargs=( |
59 |
+ --bindir="${EPREFIX%/}"/bin |
60 |
+ --enable-shared |
61 |
+ $(use_enable static-libs static) |
62 |
+ $(use_enable nls) |
63 |
+ --libexecdir="${EPREFIX%/}"/usr/$(get_libdir) |
64 |
+ $(use_enable debug) |
65 |
+ ) |
66 |
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" |
67 |
+} |
68 |
+ |
69 |
+multilib_src_install() { |
70 |
+ emake DESTDIR="${D%/}" install |
71 |
+ |
72 |
+ # Sanity check until we track down why this is happening. #644048 |
73 |
+ local lib="${ED%/}/usr/$(get_libdir)/libattr.so.1" |
74 |
+ if [[ -e ${lib} ]] ; then |
75 |
+ local versions=$(readelf -V "${lib}") |
76 |
+ local symbols=$(readelf -sW "${lib}") |
77 |
+ if [[ "${versions}" != *"ATTR_1.0"* || \ |
78 |
+ "${versions}" != *"ATTR_1.1"* || \ |
79 |
+ "${versions}" != *"ATTR_1.2"* || \ |
80 |
+ "${versions}" != *"ATTR_1.3"* || \ |
81 |
+ "${symbols}" != *"getxattr@ATTR_1.0"* ]] ; then |
82 |
+ echo "# readelf -V ${lib}" |
83 |
+ echo "${versions}" |
84 |
+ echo "# readelf -sW ${lib}" |
85 |
+ echo "${symbols}" |
86 |
+ die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048" |
87 |
+ else |
88 |
+ einfo "${lib} passed symbol checks" |
89 |
+ fi |
90 |
+ fi |
91 |
+ |
92 |
+ if multilib_is_native_abi; then |
93 |
+ # we install attr into /bin, so we need the shared lib with it |
94 |
+ gen_usr_ldscript -a attr |
95 |
+ fi |
96 |
+ |
97 |
+ # Add a wrapper until people upgrade. |
98 |
+ insinto /usr/include/attr |
99 |
+ newins "${FILESDIR}"/xattr-shim.h xattr.h |
100 |
+} |
101 |
+ |
102 |
+multilib_src_install_all() { |
103 |
+ if ! use static-libs; then |
104 |
+ find "${ED%/}" -name '*.la' -delete || die |
105 |
+ fi |
106 |
+ |
107 |
+ einstalldocs |
108 |
+} |
109 |
|
110 |
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 |
111 |
new file mode 100644 |
112 |
index 00000000000..5691b15420c |
113 |
--- /dev/null |
114 |
+++ b/sys-apps/attr/files/attr-2.4.48-switch-back-to-syscall.patch |
115 |
@@ -0,0 +1,123 @@ |
116 |
+From 14adc898a36948267bfe5c63b399996879e94c98 Mon Sep 17 00:00:00 2001 |
117 |
+From: Andreas Gruenbacher <agruenba@××××××.com> |
118 |
+Date: Fri, 17 Aug 2018 14:07:31 +0200 |
119 |
+Subject: Switch back to syscall() |
120 |
+ |
121 |
+Switch back to syscall() for the *xattr system calls. The current |
122 |
+mechanism of forwarding those calls to glibc breaks libraries like |
123 |
+libfakeroot (fakeroot) and libasan (the gcc address sanitizer; gcc |
124 |
+-fsanitize=address). |
125 |
+ |
126 |
+Those libraries provide wrappers for functions defined in other shared |
127 |
+libraries, usually glibc, do their own processing, and forward calls to |
128 |
+the original symbols looke dup via dlsym(RTLD_NEXT, "symbol_name"). In |
129 |
+our case, dlsym returns the libattr_*xattr wrappers. However, when our |
130 |
+wrappers try calling glibc, they end up calling the libfakeroot / |
131 |
+libasan wrappers instead because those override the original symbols => |
132 |
+recursion. |
133 |
+ |
134 |
+The libattr_*xattr wrappers will only be used when symbols are looked up |
135 |
+at runtime (dlopen / dlsym). Programs linking against libattr will |
136 |
+directly use the glibc provided symbols. Therefore, the slightly worse |
137 |
+performance of syscall() won't affect any of the "normal" users of |
138 |
+libattr. |
139 |
+--- |
140 |
+ libattr/syscalls.c | 26 ++++++++++++++------------ |
141 |
+ 1 file changed, 14 insertions(+), 12 deletions(-) |
142 |
+ |
143 |
+diff --git a/libattr/syscalls.c b/libattr/syscalls.c |
144 |
+index 3013aa0..721ad7f 100644 |
145 |
+--- a/libattr/syscalls.c |
146 |
++++ b/libattr/syscalls.c |
147 |
+@@ -22,6 +22,8 @@ |
148 |
+ |
149 |
+ #include "config.h" |
150 |
+ |
151 |
++#include <unistd.h> |
152 |
++#include <sys/syscall.h> |
153 |
+ #include <sys/xattr.h> |
154 |
+ |
155 |
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE |
156 |
+@@ -31,67 +33,67 @@ |
157 |
+ int libattr_setxattr(const char *path, const char *name, |
158 |
+ void *value, size_t size, int flags) |
159 |
+ { |
160 |
+- return setxattr(path, name, value, size, flags); |
161 |
++ return syscall(__NR_setxattr, path, name, value, size, flags); |
162 |
+ } |
163 |
+ |
164 |
+ int libattr_lsetxattr(const char *path, const char *name, |
165 |
+ void *value, size_t size, int flags) |
166 |
+ { |
167 |
+- return lsetxattr(path, name, value, size, flags); |
168 |
++ return syscall(__NR_lsetxattr, path, name, value, size, flags); |
169 |
+ } |
170 |
+ |
171 |
+ int libattr_fsetxattr(int filedes, const char *name, |
172 |
+ void *value, size_t size, int flags) |
173 |
+ { |
174 |
+- return fsetxattr(filedes, name, value, size, flags); |
175 |
++ return syscall(__NR_fsetxattr, filedes, name, value, size, flags); |
176 |
+ } |
177 |
+ |
178 |
+ ssize_t libattr_getxattr(const char *path, const char *name, |
179 |
+ void *value, size_t size) |
180 |
+ { |
181 |
+- return getxattr(path, name, value, size); |
182 |
++ return syscall(__NR_getxattr, path, name, value, size); |
183 |
+ } |
184 |
+ |
185 |
+ ssize_t libattr_lgetxattr(const char *path, const char *name, |
186 |
+ void *value, size_t size) |
187 |
+ { |
188 |
+- return lgetxattr(path, name, value, size); |
189 |
++ return syscall(__NR_lgetxattr, path, name, value, size); |
190 |
+ } |
191 |
+ |
192 |
+ ssize_t libattr_fgetxattr(int filedes, const char *name, |
193 |
+ void *value, size_t size) |
194 |
+ { |
195 |
+- return fgetxattr(filedes, name, value, size); |
196 |
++ return syscall(__NR_fgetxattr, filedes, name, value, size); |
197 |
+ } |
198 |
+ |
199 |
+ ssize_t libattr_listxattr(const char *path, char *list, size_t size) |
200 |
+ { |
201 |
+- return listxattr(path, list, size); |
202 |
++ return syscall(__NR_listxattr, path, list, size); |
203 |
+ } |
204 |
+ |
205 |
+ ssize_t libattr_llistxattr(const char *path, char *list, size_t size) |
206 |
+ { |
207 |
+- return llistxattr(path, list, size); |
208 |
++ return syscall(__NR_llistxattr, path, list, size); |
209 |
+ } |
210 |
+ |
211 |
+ ssize_t libattr_flistxattr(int filedes, char *list, size_t size) |
212 |
+ { |
213 |
+- return flistxattr(filedes, list, size); |
214 |
++ return syscall(__NR_flistxattr, filedes, list, size); |
215 |
+ } |
216 |
+ |
217 |
+ int libattr_removexattr(const char *path, const char *name) |
218 |
+ { |
219 |
+- return removexattr(path, name); |
220 |
++ return syscall(__NR_removexattr, path, name); |
221 |
+ } |
222 |
+ |
223 |
+ int libattr_lremovexattr(const char *path, const char *name) |
224 |
+ { |
225 |
+- return lremovexattr(path, name); |
226 |
++ return syscall(__NR_lremovexattr, path, name); |
227 |
+ } |
228 |
+ |
229 |
+ int libattr_fremovexattr(int filedes, const char *name) |
230 |
+ { |
231 |
+- return fremovexattr(filedes, name); |
232 |
++ return syscall(__NR_fremovexattr, filedes, name); |
233 |
+ } |
234 |
+ |
235 |
+ #ifdef HAVE_VISIBILITY_ATTRIBUTE |
236 |
+-- |
237 |
+cgit v1.0-41-gc330 |
238 |
+ |