Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/files/, sys-apps/file/
Date: Mon, 07 Sep 2020 16:56:32
Message-Id: 1599497711.728f8c43b8b540f37871be3080ac63c05a9cf6a7.floppym@gentoo
1 commit: 728f8c43b8b540f37871be3080ac63c05a9cf6a7
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 7 16:55:11 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 7 16:55:11 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=728f8c43
7
8 sys-apps/file: backport a seccomp fix for musl
9
10 Closes: https://bugs.gentoo.org/728978
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 sys-apps/file/file-5.39-r1.ebuild | 140 ---------------------
14 .../{file-5.39-r2.ebuild => file-5.39-r3.ebuild} | 5 +-
15 sys-apps/file/file-5.39.ebuild | 140 ---------------------
16 .../file/files/file-5.39-add-missing-termios.patch | 35 +++---
17 ...ndbox.patch => file-5.39-portage-sandbox.patch} | 18 ++-
18 sys-apps/file/files/file-5.39-seccomp-musl.patch | 37 ++++++
19 .../file/files/file-5.39-seccomp_sandbox.patch | 13 --
20 7 files changed, 67 insertions(+), 321 deletions(-)
21
22 diff --git a/sys-apps/file/file-5.39-r1.ebuild b/sys-apps/file/file-5.39-r1.ebuild
23 deleted file mode 100644
24 index 8333fd922e2..00000000000
25 --- a/sys-apps/file/file-5.39-r1.ebuild
26 +++ /dev/null
27 @@ -1,140 +0,0 @@
28 -# Copyright 1999-2020 Gentoo Authors
29 -# Distributed under the terms of the GNU General Public License v2
30 -
31 -EAPI=7
32 -
33 -PYTHON_COMPAT=( python3_{6..9} )
34 -DISTUTILS_OPTIONAL=1
35 -
36 -inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
37 -
38 -if [[ ${PV} == "9999" ]] ; then
39 - EGIT_REPO_URI="https://github.com/glensc/file.git"
40 - inherit git-r3
41 -else
42 - SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
43 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
44 -fi
45 -
46 -DESCRIPTION="identify a file's format by scanning binary data for patterns"
47 -HOMEPAGE="https://www.darwinsys.com/file/"
48 -
49 -LICENSE="BSD-2"
50 -SLOT="0"
51 -IUSE="bzip2 lzma python seccomp static-libs zlib"
52 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
53 -
54 -DEPEND="
55 - bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
56 - lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
57 - python? (
58 - ${PYTHON_DEPS}
59 - dev-python/setuptools[${PYTHON_USEDEP}]
60 - )
61 - zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
62 -RDEPEND="${DEPEND}
63 - python? ( !dev-python/python-magic )
64 - seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
65 -
66 -PATCHES=(
67 - "${FILESDIR}/${PN}-5.39-portage_sandbox.patch" #713710 #728978
68 -)
69 -
70 -src_prepare() {
71 - default
72 - eautoreconf
73 - elibtoolize
74 -
75 - # don't let python README kill main README #60043
76 - mv python/README.md python/README.python.md || die
77 - sed 's@××××××.md@README.python.md@' -i python/setup.py || die #662090
78 -}
79 -
80 -multilib_src_configure() {
81 - local myeconfargs=(
82 - --enable-fsect-man5
83 - $(use_enable bzip2 bzlib)
84 - $(use_enable lzma xzlib)
85 - $(use_enable seccomp libseccomp)
86 - $(use_enable static-libs static)
87 - $(use_enable zlib)
88 - )
89 - econf "${myeconfargs[@]}"
90 -}
91 -
92 -build_src_configure() {
93 - local myeconfargs=(
94 - --disable-shared
95 - --disable-libseccomp
96 - --disable-bzlib
97 - --disable-xzlib
98 - --disable-zlib
99 - )
100 - tc-env_build econf "${myeconfargs[@]}"
101 -}
102 -
103 -need_build_file() {
104 - # when cross-compiling, we need to build up our own file
105 - # because people often don't keep matching host/target
106 - # file versions #362941
107 - tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
108 -}
109 -
110 -src_configure() {
111 - local ECONF_SOURCE=${S}
112 -
113 - if need_build_file; then
114 - mkdir -p "${WORKDIR}"/build || die
115 - cd "${WORKDIR}"/build || die
116 - build_src_configure
117 - fi
118 -
119 - multilib-minimal_src_configure
120 -}
121 -
122 -multilib_src_compile() {
123 - if multilib_is_native_abi ; then
124 - emake
125 - else
126 - cd src || die
127 - emake magic.h #586444
128 - emake libmagic.la
129 - fi
130 -}
131 -
132 -src_compile() {
133 - if need_build_file; then
134 - emake -C "${WORKDIR}"/build/src magic.h #586444
135 - emake -C "${WORKDIR}"/build/src file
136 - local -x PATH="${WORKDIR}/build/src:${PATH}"
137 - fi
138 - multilib-minimal_src_compile
139 -
140 - if use python ; then
141 - cd python || die
142 - distutils-r1_src_compile
143 - fi
144 -}
145 -
146 -multilib_src_install() {
147 - if multilib_is_native_abi ; then
148 - default
149 - else
150 - emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
151 - fi
152 -}
153 -
154 -multilib_src_install_all() {
155 - dodoc ChangeLog MAINT README
156 -
157 - # Required for `file -C`
158 - dodir /usr/share/misc/magic
159 - insinto /usr/share/misc/magic
160 - doins -r magic/Magdir/*
161 -
162 - if use python ; then
163 - cd python || die
164 - distutils-r1_src_install
165 - fi
166 - find "${ED}" -type f -name "*.la" -delete || die
167 -}
168
169 diff --git a/sys-apps/file/file-5.39-r2.ebuild b/sys-apps/file/file-5.39-r3.ebuild
170 similarity index 95%
171 rename from sys-apps/file/file-5.39-r2.ebuild
172 rename to sys-apps/file/file-5.39-r3.ebuild
173 index 645a8516962..c8425291ed7 100644
174 --- a/sys-apps/file/file-5.39-r2.ebuild
175 +++ b/sys-apps/file/file-5.39-r3.ebuild
176 @@ -37,8 +37,9 @@ RDEPEND="${DEPEND}
177 seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
178
179 PATCHES=(
180 - "${FILESDIR}/${PN}-5.39-portage_sandbox.patch" #713710 #728978
181 - "${FILESDIR}/${P}-add-missing-termios.patch" #728416
182 + "${FILESDIR}/file-5.39-add-missing-termios.patch" #728416
183 + "${FILESDIR}/file-5.39-seccomp-musl.patch"
184 + "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
185 )
186
187 src_prepare() {
188
189 diff --git a/sys-apps/file/file-5.39.ebuild b/sys-apps/file/file-5.39.ebuild
190 deleted file mode 100644
191 index 98499a3c73d..00000000000
192 --- a/sys-apps/file/file-5.39.ebuild
193 +++ /dev/null
194 @@ -1,140 +0,0 @@
195 -# Copyright 1999-2020 Gentoo Authors
196 -# Distributed under the terms of the GNU General Public License v2
197 -
198 -EAPI=7
199 -
200 -PYTHON_COMPAT=( python3_{6..9} )
201 -DISTUTILS_OPTIONAL=1
202 -
203 -inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
204 -
205 -if [[ ${PV} == "9999" ]] ; then
206 - EGIT_REPO_URI="https://github.com/glensc/file.git"
207 - inherit git-r3
208 -else
209 - SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
210 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
211 -fi
212 -
213 -DESCRIPTION="identify a file's format by scanning binary data for patterns"
214 -HOMEPAGE="https://www.darwinsys.com/file/"
215 -
216 -LICENSE="BSD-2"
217 -SLOT="0"
218 -IUSE="bzip2 lzma python seccomp static-libs zlib"
219 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
220 -
221 -DEPEND="
222 - bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
223 - lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
224 - python? (
225 - ${PYTHON_DEPS}
226 - dev-python/setuptools[${PYTHON_USEDEP}]
227 - )
228 - zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
229 -RDEPEND="${DEPEND}
230 - python? ( !dev-python/python-magic )
231 - seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
232 -
233 -PATCHES=(
234 - "${FILESDIR}/${PN}-5.39-seccomp_sandbox.patch" #713710
235 -)
236 -
237 -src_prepare() {
238 - default
239 - eautoreconf
240 - elibtoolize
241 -
242 - # don't let python README kill main README #60043
243 - mv python/README.md python/README.python.md || die
244 - sed 's@××××××.md@README.python.md@' -i python/setup.py || die #662090
245 -}
246 -
247 -multilib_src_configure() {
248 - local myeconfargs=(
249 - --enable-fsect-man5
250 - $(use_enable bzip2 bzlib)
251 - $(use_enable lzma xzlib)
252 - $(use_enable seccomp libseccomp)
253 - $(use_enable static-libs static)
254 - $(use_enable zlib)
255 - )
256 - econf "${myeconfargs[@]}"
257 -}
258 -
259 -build_src_configure() {
260 - local myeconfargs=(
261 - --disable-shared
262 - --disable-libseccomp
263 - --disable-bzlib
264 - --disable-xzlib
265 - --disable-zlib
266 - )
267 - tc-env_build econf "${myeconfargs[@]}"
268 -}
269 -
270 -need_build_file() {
271 - # when cross-compiling, we need to build up our own file
272 - # because people often don't keep matching host/target
273 - # file versions #362941
274 - tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
275 -}
276 -
277 -src_configure() {
278 - local ECONF_SOURCE=${S}
279 -
280 - if need_build_file; then
281 - mkdir -p "${WORKDIR}"/build || die
282 - cd "${WORKDIR}"/build || die
283 - build_src_configure
284 - fi
285 -
286 - multilib-minimal_src_configure
287 -}
288 -
289 -multilib_src_compile() {
290 - if multilib_is_native_abi ; then
291 - emake
292 - else
293 - cd src || die
294 - emake magic.h #586444
295 - emake libmagic.la
296 - fi
297 -}
298 -
299 -src_compile() {
300 - if need_build_file; then
301 - emake -C "${WORKDIR}"/build/src magic.h #586444
302 - emake -C "${WORKDIR}"/build/src file
303 - local -x PATH="${WORKDIR}/build/src:${PATH}"
304 - fi
305 - multilib-minimal_src_compile
306 -
307 - if use python ; then
308 - cd python || die
309 - distutils-r1_src_compile
310 - fi
311 -}
312 -
313 -multilib_src_install() {
314 - if multilib_is_native_abi ; then
315 - default
316 - else
317 - emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
318 - fi
319 -}
320 -
321 -multilib_src_install_all() {
322 - dodoc ChangeLog MAINT README
323 -
324 - # Required for `file -C`
325 - dodir /usr/share/misc/magic
326 - insinto /usr/share/misc/magic
327 - doins -r magic/Magdir/*
328 -
329 - if use python ; then
330 - cd python || die
331 - distutils-r1_src_install
332 - fi
333 - find "${ED}" -type f -name "*.la" -delete || die
334 -}
335
336 diff --git a/sys-apps/file/files/file-5.39-add-missing-termios.patch b/sys-apps/file/files/file-5.39-add-missing-termios.patch
337 index e6cba0d4c28..0614f52dd27 100644
338 --- a/sys-apps/file/files/file-5.39-add-missing-termios.patch
339 +++ b/sys-apps/file/files/file-5.39-add-missing-termios.patch
340 @@ -1,27 +1,30 @@
341 -From 769e9868c17a471323b81b12cab851c9fd22baf4 Mon Sep 17 00:00:00 2001
342 -From: Georgy Yakovlev <gyakovlev@g.o>
343 -Date: Mon, 15 Jun 2020 14:18:45 -0700
344 -Subject: [PATCH] add missing termios.h include
345 +From 471e2c6c61ecd30ba6e304ae0444d364cfd44254 Mon Sep 17 00:00:00 2001
346 +From: Christos Zoulas <christos@××××××.com>
347 +Date: Thu, 18 Jun 2020 16:25:12 +0000
348 +Subject: [PATCH] PR/168: gyakovlev: Include <termios.h>
349
350 -on ppc, TCGETS relies on struct termios being complete, on other
351 -architectures it does not.
352 -so termios.h should be included before ioctl.h
353 ---
354 - src/seccomp.c | 1 +
355 - 1 file changed, 1 insertion(+)
356 + src/seccomp.c | 3 ++-
357 + 1 file changed, 2 insertions(+), 1 deletion(-)
358
359 diff --git a/src/seccomp.c b/src/seccomp.c
360 -index e667adf..296f5b3 100644
361 +index e667adfe4..68c56485d 100644
362 --- a/src/seccomp.c
363 +++ b/src/seccomp.c
364 -@@ -33,6 +33,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
365 +@@ -27,7 +27,7 @@
366 + #include "file.h"
367 +
368 + #ifndef lint
369 +-FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
370 ++FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
371 + #endif /* lint */
372 +
373 #if HAVE_LIBSECCOMP
374 - #include <seccomp.h> /* libseccomp */
375 +@@ -35,6 +35,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
376 #include <sys/prctl.h> /* prctl */
377 -+#include <termios.h>
378 #include <sys/ioctl.h>
379 #include <sys/socket.h>
380 ++#include <termios.h>
381 #include <fcntl.h>
382 ---
383 -2.27.0
384 -
385 + #include <stdlib.h>
386 + #include <errno.h>
387
388 diff --git a/sys-apps/file/files/file-5.39-portage_sandbox.patch b/sys-apps/file/files/file-5.39-portage-sandbox.patch
389 similarity index 51%
390 rename from sys-apps/file/files/file-5.39-portage_sandbox.patch
391 rename to sys-apps/file/files/file-5.39-portage-sandbox.patch
392 index ff2caed413f..3ea26641671 100644
393 --- a/sys-apps/file/files/file-5.39-portage_sandbox.patch
394 +++ b/sys-apps/file/files/file-5.39-portage-sandbox.patch
395 @@ -1,28 +1,26 @@
396 -From 7e1d9d51329a0e0f3d9cd1dbc3f9509251950e81 Mon Sep 17 00:00:00 2001
397 +From 81765a2d4fcce23f42495d5ec03bbfecb2a3c381 Mon Sep 17 00:00:00 2001
398 From: tka <tka@×××××.org>
399 Date: Wed, 24 Jun 2020 11:18:45 +0200
400 Subject: [PATCH] Allow getcwd for Gentoo's portage sandbox
401
402 -Gentoo-bug: https://bugs.gentoo.org/728978
403 -Signed-off-by: Lars Wendler <polynomial-c@g.o>
404 +Bug: https://bugs.gentoo.org/728978
405 ---
406 - src/seccomp.c | 3 +++
407 - 1 file changed, 3 insertions(+)
408 + src/seccomp.c | 2 ++
409 + 1 file changed, 2 insertions(+)
410
411 diff --git a/src/seccomp.c b/src/seccomp.c
412 -index 68c56485..af55918e 100644
413 +index db9364ae..7f5d6f26 100644
414 --- a/src/seccomp.c
415 +++ b/src/seccomp.c
416 -@@ -227,6 +227,9 @@ enable_sandbox_full(void)
417 - ALLOW_RULE(unlink);
418 +@@ -229,6 +229,8 @@ enable_sandbox_full(void)
419 ALLOW_RULE(write);
420 + ALLOW_RULE(writev);
421
422 + // needed by Gentoo's portage sandbox
423 + ALLOW_RULE(getcwd);
424 -+
425
426 #if 0
427 // needed by valgrind
428 --
429 -2.27.0
430 +2.28.0
431
432
433 diff --git a/sys-apps/file/files/file-5.39-seccomp-musl.patch b/sys-apps/file/files/file-5.39-seccomp-musl.patch
434 new file mode 100644
435 index 00000000000..72836de67e5
436 --- /dev/null
437 +++ b/sys-apps/file/files/file-5.39-seccomp-musl.patch
438 @@ -0,0 +1,37 @@
439 +From 93c91e2ba8042d499fee168e27cbd526438454c6 Mon Sep 17 00:00:00 2001
440 +From: Christos Zoulas <christos@××××××.com>
441 +Date: Sat, 5 Sep 2020 17:20:32 +0000
442 +Subject: [PATCH] PR/194: puchuu: Handle muslc syscalls
443 +
444 +---
445 + src/seccomp.c | 4 +++-
446 + 1 file changed, 3 insertions(+), 1 deletion(-)
447 +
448 +diff --git a/src/seccomp.c b/src/seccomp.c
449 +index 68c56485d..db9364ae4 100644
450 +--- a/src/seccomp.c
451 ++++ b/src/seccomp.c
452 +@@ -27,7 +27,7 @@
453 + #include "file.h"
454 +
455 + #ifndef lint
456 +-FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
457 ++FILE_RCSID("@(#)$File: seccomp.c,v 1.17 2020/09/05 17:20:32 christos Exp $")
458 + #endif /* lint */
459 +
460 + #if HAVE_LIBSECCOMP
461 +@@ -220,12 +220,14 @@ enable_sandbox_full(void)
462 + ALLOW_RULE(rt_sigreturn);
463 + ALLOW_RULE(select);
464 + ALLOW_RULE(stat);
465 ++ ALLOW_RULE(statx);
466 + ALLOW_RULE(stat64);
467 + ALLOW_RULE(sysinfo);
468 + ALLOW_RULE(umask); // Used in file_pipe2file()
469 + ALLOW_RULE(getpid); // Used by glibc in file_pipe2file()
470 + ALLOW_RULE(unlink);
471 + ALLOW_RULE(write);
472 ++ ALLOW_RULE(writev);
473 +
474 +
475 + #if 0
476
477 diff --git a/sys-apps/file/files/file-5.39-seccomp_sandbox.patch b/sys-apps/file/files/file-5.39-seccomp_sandbox.patch
478 deleted file mode 100644
479 index da0a0ff1f28..00000000000
480 --- a/sys-apps/file/files/file-5.39-seccomp_sandbox.patch
481 +++ /dev/null
482 @@ -1,13 +0,0 @@
483 -Don't call file with seccomp in portage sandbox. This will fail:
484 -
485 - make[2]: *** [Makefile:834: magic.mgc] Bad system call
486 -
487 ---- file-5.39/magic/Makefile.am
488 -+++ file-5.39/magic/Makefile.am
489 -@@ -352,5 +352,5 @@
490 - exit 1; \
491 - fi; \
492 - fi)
493 -- $(FILE_COMPILE) -C -m magic
494 -+ $(FILE_COMPILE) -S -C -m magic
495 - @rm -fr magic