* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2016-04-21 20:30 Mike Frysinger
0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2016-04-21 20:30 UTC (permalink / raw
To: gentoo-commits
commit: c540f9ea27b6c6e14481b3364d6193862a3377b1
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 21 20:29:20 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 20:29:32 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c540f9ea
sys-apps/file: add a bunch of upstream fixes
.../file/{file-5.26.ebuild => file-5.26-r1.ebuild} | 11 +-
sys-apps/file/file-9999.ebuild | 10 +-
sys-apps/file/files/file-5.26-compress-1.patch | 53 +++++++++
sys-apps/file/files/file-5.26-compress-2.patch | 73 ++++++++++++
| 26 ++++
sys-apps/file/files/file-5.26-msoffice-magic.patch | 45 +++++++
sys-apps/file/files/file-5.26-nes-magic.patch | 27 +++++
sys-apps/file/files/file-5.26-php-magic.patch | 28 +++++
sys-apps/file/files/file-5.26-stdin-rpm.patch | 27 +++++
sys-apps/file/files/file-5.26-stdin-test.patch | 132 +++++++++++++++++++++
sys-apps/file/files/file-5.26-tests-fatal.patch | 27 +++++
11 files changed, 452 insertions(+), 7 deletions(-)
diff --git a/sys-apps/file/file-5.26.ebuild b/sys-apps/file/file-5.26-r1.ebuild
similarity index 86%
rename from sys-apps/file/file-5.26.ebuild
rename to sys-apps/file/file-5.26-r1.ebuild
index 594df4a..ff3216a 100644
--- a/sys-apps/file/file-5.26.ebuild
+++ b/sys-apps/file/file-5.26-r1.ebuild
@@ -1,8 +1,8 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
EAPI="5"
+
PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} pypy )
DISTUTILS_OPTIONAL=1
@@ -30,6 +30,15 @@ RDEPEND="${DEPEND}
python? ( !dev-python/python-magic )"
src_prepare() {
+ epatch "${FILESDIR}"/${P}-header-define.patch
+ epatch "${FILESDIR}"/${P}-nes-magic.patch
+ epatch "${FILESDIR}"/${P}-php-magic.patch
+ epatch "${FILESDIR}"/${P}-msoffice-magic.patch
+ epatch "${FILESDIR}"/${P}-stdin-rpm.patch
+ epatch "${FILESDIR}"/${P}-tests-fatal.patch
+ epatch "${FILESDIR}"/${P}-stdin-test.patch
+ epatch "${FILESDIR}"/${P}-compress-1.patch
+ epatch "${FILESDIR}"/${P}-compress-2.patch
[[ ${PV} == "9999" ]] && eautoreconf
elibtoolize
diff --git a/sys-apps/file/file-9999.ebuild b/sys-apps/file/file-9999.ebuild
index 88b9d2e..5aa9298 100644
--- a/sys-apps/file/file-9999.ebuild
+++ b/sys-apps/file/file-9999.ebuild
@@ -1,8 +1,8 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
EAPI="5"
+
PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} pypy )
DISTUTILS_OPTIONAL=1
@@ -25,9 +25,7 @@ SLOT="0"
IUSE="python static-libs zlib"
DEPEND="python? ( ${PYTHON_DEPS} )
- zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
- abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20131008-r21
- !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
RDEPEND="${DEPEND}
python? ( !dev-python/python-magic )"
@@ -80,7 +78,7 @@ multilib_src_compile() {
}
src_compile() {
- if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
+ if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
emake -C "${WORKDIR}"/build/src file
PATH="${WORKDIR}/build/src:${PATH}"
fi
diff --git a/sys-apps/file/files/file-5.26-compress-1.patch b/sys-apps/file/files/file-5.26-compress-1.patch
new file mode 100644
index 0000000..b10bfd2
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-compress-1.patch
@@ -0,0 +1,53 @@
+From 52ae939467583ec499f6c62cdb406e8f982c0310 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 19 Apr 2016 13:39:19 +0000
+Subject: [PATCH] Fix compression code (Werner Fink)
+
+---
+ src/compress.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/src/compress.c b/src/compress.c
+index f322445..0ebc837 100644
+--- a/src/compress.c
++++ b/src/compress.c
+@@ -231,9 +231,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
+ goto error;
+ DPRINTF("rv = %d\n", rv);
+ if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
+- goto out;
++ break;
+ if (mime != MAGIC_MIME && mime != 0)
+- goto out;
++ break;
+ if ((file_printf(ms,
+ mime ? " compressed-encoding=" : " (")) == -1)
+ goto error;
+@@ -250,16 +250,19 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
+ }
+ if (!mime && file_printf(ms, ")") == -1)
+ goto error;
+- goto out;
++ /*FALLTHROUGH*/
+ case NODATA:
+- goto out;
++ break;
+ default:
+ abort();
++ /*NOTREACHED*/
++ error:
++ rv = -1;
++ break;
+ }
+ }
+-out:
+- rv = 1;
+-error:
++ DPRINTF("rv = %d\n", rv);
++
+ #ifdef HAVE_SIGNAL_H
+ (void)signal(SIGPIPE, osigpipe);
+ #endif
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-compress-2.patch b/sys-apps/file/files/file-5.26-compress-2.patch
new file mode 100644
index 0000000..d27656f
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-compress-2.patch
@@ -0,0 +1,73 @@
+http://mx.gw.com/pipermail/file/2016/001978.html
+
+From 26879a2b5ec6880cb46b416880e520c628927abd Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 19 Apr 2016 23:36:36 +0000
+Subject: [PATCH] Restore part of previous logic, that breaks out of the
+ uncompress loop if there was a compression match error or not. Separate the
+ return values to avoid confusion.
+
+---
+ src/compress.c | 23 ++++++++++++-----------
+ 1 file changed, 12 insertions(+), 11 deletions(-)
+
+diff --git a/src/compress.c b/src/compress.c
+index 0ebc837..2a95f85 100644
+--- a/src/compress.c
++++ b/src/compress.c
+@@ -187,7 +187,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
+ size_t i, nsz;
+ char *rbuf;
+ file_pushbuf_t *pb;
+- int rv = 0;
++ int urv, prv, rv = 0;
+ int mime = ms->flags & MAGIC_MIME;
+ #ifdef HAVE_SIGNAL_H
+ sig_t osigpipe;
+@@ -214,26 +214,26 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
+ if (!zm)
+ continue;
+ nsz = nbytes;
+- rv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
++ urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
+ DPRINTF("uncompressbuf = %d, %s, %zu\n", rv, (char *)newbuf,
+ nsz);
+- switch (rv) {
++ switch (urv) {
+ case OKDATA:
+ case ERRDATA:
+
+ ms->flags &= ~MAGIC_COMPRESS;
+- if (rv == ERRDATA)
+- rv = file_printf(ms, "%s ERROR: %s",
++ if (urv == ERRDATA)
++ prv = file_printf(ms, "%s ERROR: %s",
+ methodname(i), newbuf);
+ else
+- rv = file_buffer(ms, -1, name, newbuf, nsz);
+- if (rv == -1)
++ prv = file_buffer(ms, -1, name, newbuf, nsz);
++ if (prv == -1)
+ goto error;
+- DPRINTF("rv = %d\n", rv);
++ rv = 1;
+ if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
+- break;
++ goto out;
+ if (mime != MAGIC_MIME && mime != 0)
+- break;
++ goto out;
+ if ((file_printf(ms,
+ mime ? " compressed-encoding=" : " (")) == -1)
+ goto error;
+@@ -261,6 +261,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
+ break;
+ }
+ }
++out:
+ DPRINTF("rv = %d\n", rv);
+
+ #ifdef HAVE_SIGNAL_H
+--
+2.7.4
+
--git a/sys-apps/file/files/file-5.26-header-define.patch b/sys-apps/file/files/file-5.26-header-define.patch
new file mode 100644
index 0000000..349614f
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-header-define.patch
@@ -0,0 +1,26 @@
+http://mx.gw.com/pipermail/file/2016/001955.html
+
+From c4b6ea9b998882d08692599e28f4245714eaf8bb Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Sun, 17 Apr 2016 13:56:03 +0000
+Subject: [PATCH] add missing define.
+
+---
+ src/magic.h.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/magic.h.in b/src/magic.h.in
+index 1e567cd..3d6954a 100644
+--- a/src/magic.h.in
++++ b/src/magic.h.in
+@@ -114,6 +114,7 @@ int magic_errno(magic_t);
+ #define MAGIC_PARAM_ELF_SHNUM_MAX 3
+ #define MAGIC_PARAM_ELF_NOTES_MAX 4
+ #define MAGIC_PARAM_REGEX_MAX 5
++#define MAGIC_PARAM_BYTES_MAX 6
+
+ int magic_setparam(magic_t, int, const void *);
+ int magic_getparam(magic_t, int, void *);
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-msoffice-magic.patch b/sys-apps/file/files/file-5.26-msoffice-magic.patch
new file mode 100644
index 0000000..a43d3f1
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-msoffice-magic.patch
@@ -0,0 +1,45 @@
+From 84609201fbbd9074f5426b991c5242a08ed78712 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 19 Apr 2016 18:14:19 +0000
+Subject: [PATCH] Strengthen the magic of relocatable microsoft objects to
+ avoid spurious matches (Joerg Jenderek)
+
+---
+ magic/Magdir/xenix | 23 +++++++++++++++++++++--
+ 1 file changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/magic/Magdir/xenix b/magic/Magdir/xenix
+index 38e1e3c..ca5eaae 100644
+--- a/magic/Magdir/xenix
++++ b/magic/Magdir/xenix
+@@ -12,7 +12,26 @@
+ # XXX - "x.out" collides with PDP-11 archives
+ #
+ 0 string core core file (Xenix)
+-0 byte 0x80 8086 relocatable (Microsoft)
++# URL: http://www.polarhome.com/service/man/?qf=86rel&tf=2&of=Xenix
++# Reference: http://www.azillionmonkeys.com/qed/Omfg.pdf
++# Update: Joerg Jenderek
++# recordtype~TranslatorHEADerRecord
++0 byte 0x80
++# GRR: line above is too general as it catches also Extensible storage engine DataBase
++# skip examples like GENA.SND Switch.Snd by looking for record length maximal 1024-3
++>1 uleshort <1022
++# skip examples like GAME.PICTURE Strange.Pic by looking for positiv record length
++>>1 uleshort >0
++# skip examples like Xtable.Data FRACTAL.GEN SHR.VIEW by looking for positiv string length
++>>>3 ubyte >0
++# skip examples like OMBRE.6 with "UUUUUU" by looking for filename like "hello.c"
++>>>>4 regex [a-zA-Z_/]{1,8}[.] 8086 relocatable (Microsoft)
++#!:mime application/octet-stream
++!:mime application/x-object
++!:ext o/a
++>>>>>3 pstring x \b, "%s"
++# checksum
++#>>>>>(3.b+4) ubyte x \b, checksum 0x%2.2x
+ 0 leshort 0xff65 x.out
+ >2 string __.SYMDEF randomized
+ >0 byte x archive
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-nes-magic.patch b/sys-apps/file/files/file-5.26-nes-magic.patch
new file mode 100644
index 0000000..0cc43b0
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-nes-magic.patch
@@ -0,0 +1,27 @@
+http://mx.gw.com/pipermail/file/2016/001969.html
+
+From 402b28ae533f5d013cd44e29eeaf64bcd4e5a925 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 18 Apr 2016 20:22:10 +0000
+Subject: [PATCH] Add missing continuation
+
+---
+ magic/Magdir/console | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/magic/Magdir/console b/magic/Magdir/console
+index ed69f43..9448223 100644
+--- a/magic/Magdir/console
++++ b/magic/Magdir/console
+@@ -53,7 +53,7 @@
+ # so most of the data isn't easily parseable.
+ #
+ 0 string UNIF
+-4 lelong <16 UNIF v%d format NES ROM image
++>4 lelong <16 UNIF v%d format NES ROM image
+
+ #------------------------------------------------------------------------------
+ # gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-php-magic.patch b/sys-apps/file/files/file-5.26-php-magic.patch
new file mode 100644
index 0000000..310af1b
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-php-magic.patch
@@ -0,0 +1,28 @@
+http://mx.gw.com/pipermail/file/2016/001947.html
+http://mx.gw.com/pipermail/file/2016/001949.html
+
+From a5995b6e56c1a476360ccc58598a389f6cd71948 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 19 Apr 2016 13:40:02 +0000
+Subject: [PATCH] Fix wrong level
+
+---
+ magic/Magdir/commands | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/magic/Magdir/commands b/magic/Magdir/commands
+index 95109f3..fddb764 100644
+--- a/magic/Magdir/commands
++++ b/magic/Magdir/commands
+@@ -101,7 +101,7 @@
+ 0 string =<?php
+ >5 regex [\ \n]
+ >>6 string /*\ Smarty\ version Smarty compiled template
+->24 regex [0-9.]+ \b, version %s
++>>>24 regex [0-9.]+ \b, version %s
+ !:mime text/x-php
+
+ 0 string Zend\x00 PHP script Zend Optimizer data
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-stdin-rpm.patch b/sys-apps/file/files/file-5.26-stdin-rpm.patch
new file mode 100644
index 0000000..7ba5072
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-stdin-rpm.patch
@@ -0,0 +1,27 @@
+http://mx.gw.com/pipermail/file/2016/001975.html
+
+From 11edb37a71851b5bcbd4e51ca6ad3dcbf57e9761 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 19 Apr 2016 20:51:54 +0000
+Subject: [PATCH] Revert: Don't close stdin...
+
+---
+ src/magic.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/magic.c b/src/magic.c
+index 46e4678..8cf6269 100644
+--- a/src/magic.c
++++ b/src/magic.c
+@@ -346,7 +346,7 @@ private void
+ close_and_restore(const struct magic_set *ms, const char *name, int fd,
+ const struct stat *sb)
+ {
+- if (name == NULL)
++ if (fd == STDIN_FILENO || name == NULL)
+ return;
+ (void) close(fd);
+
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-stdin-test.patch b/sys-apps/file/files/file-5.26-stdin-test.patch
new file mode 100644
index 0000000..85e59a5
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-stdin-test.patch
@@ -0,0 +1,132 @@
+http://mx.gw.com/pipermail/file/2016/001963.html
+
+From 20c59ad54afc7427ea680f84c8ee5a576ba54b08 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 18 Apr 2016 15:10:34 +0000
+Subject: [PATCH] Downgrade DER comparison and offset lookup failures to be
+ handled as match failures.
+
+---
+ src/softmagic.c | 60 ++++++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 40 insertions(+), 20 deletions(-)
+
+diff --git a/src/softmagic.c b/src/softmagic.c
+index 14a8bc5..5b5f0f9 100644
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -186,11 +186,11 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+ ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
+ (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
+ (m->flag & mode) != mode) {
++flush:
+ /* Skip sub-tests */
+- while (magindex + 1 < nmagic &&
+- magic[magindex + 1].cont_level != 0 &&
+- ++magindex)
+- continue;
++ while (magindex < nmagic - 1 &&
++ magic[magindex + 1].cont_level != 0)
++ magindex++;
+ continue; /* Skip to next top-level test*/
+ }
+
+@@ -227,10 +227,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+ * main entry didn't match,
+ * flush its continuations
+ */
+- while (magindex < nmagic - 1 &&
+- magic[magindex + 1].cont_level != 0)
+- magindex++;
+- continue;
++ goto flush;
+ }
+
+ if ((e = handle_annotation(ms, m)) != 0) {
+@@ -255,8 +252,14 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+ if (print && mprint(ms, m) == -1)
+ return -1;
+
+- if (moffset(ms, m, nbytes, &ms->c.li[cont_level].off) == -1)
++ switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) {
++ case -1:
+ return -1;
++ case 0:
++ goto flush;
++ default:
++ break;
++ }
+
+ /* and any continuations that match */
+ if (file_check_mem(ms, ++cont_level) == -1)
+@@ -362,9 +365,16 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+ if (print && mprint(ms, m) == -1)
+ return -1;
+
+- if (moffset(ms, m, nbytes,
+- &ms->c.li[cont_level].off) == -1)
++ switch (moffset(ms, m, nbytes,
++ &ms->c.li[cont_level].off)) {
++ case -1:
+ return -1;
++ case 0:
++ flush = 1;
++ break;
++ default:
++ break;
++ }
+
+ if (*m->desc)
+ *need_separator = 1;
+@@ -813,9 +823,13 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
+ case FILE_DER:
+ {
+ o = der_offs(ms, m, nbytes);
+- if (o == -1) {
+- file_error(ms, 0, "EOF computing DER offset");
+- return -1;
++ if (o == -1 || (size_t)o > nbytes) {
++ if ((ms->flags & MAGIC_DEBUG) != 0) {
++ (void)fprintf(stderr,
++ "Bad DER offset %d nbytes=%zu",
++ o, nbytes);
++ }
++ return 0;
+ }
+ break;
+ }
+@@ -825,12 +839,13 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
+ break;
+ }
+
+- if ((size_t)o >= nbytes) {
+- file_error(ms, 0, "Offset out of range");
++ if ((size_t)o > nbytes) {
++ file_error(ms, 0, "Offset out of range %zu > %zu",
++ (size_t)o, nbytes);
+ return -1;
+ }
+ *op = o;
+- return 0;
++ return 1;
+ }
+
+ private uint32_t
+@@ -2107,8 +2122,13 @@ magiccheck(struct magic_set *ms, struct magic *m)
+ return 1;
+ case FILE_DER:
+ matched = der_cmp(ms, m);
+- if (matched == -1)
+- file_error(ms, 0, "EOF comparing DER entries");
++ if (matched == -1) {
++ if ((ms->flags & MAGIC_DEBUG) != 0) {
++ (void) fprintf(stderr,
++ "EOF comparing DER entries");
++ }
++ return 0;
++ }
+ return matched;
+ default:
+ file_magerror(ms, "invalid type %d in magiccheck()", m->type);
+--
+2.7.4
+
diff --git a/sys-apps/file/files/file-5.26-tests-fatal.patch b/sys-apps/file/files/file-5.26-tests-fatal.patch
new file mode 100644
index 0000000..29c9338
--- /dev/null
+++ b/sys-apps/file/files/file-5.26-tests-fatal.patch
@@ -0,0 +1,27 @@
+http://mx.gw.com/pipermail/file/2016/001961.html
+
+From fe1b14d68fe47a0641606c142222d6b0fb9e05d9 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 18 Apr 2016 18:16:45 +0000
+Subject: [PATCH] exit on error.
+
+---
+ tests/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index c2cb5ee..e55cdf4 100644
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -13,7 +13,7 @@ issue311docx.testfile
+ T = $(top_srcdir)/tests
+ check-local:
+ MAGIC=$(top_builddir)/magic/magic ./test
+- for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
++ set -e; for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+--
+2.7.4
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2016-08-10 9:49 Mike Frysinger
0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2016-08-10 9:49 UTC (permalink / raw
To: gentoo-commits
commit: ba55f110bf9831afca12c51ea503e5f5293d28fe
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 10 09:33:42 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Aug 10 09:47:47 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba55f110
sys-apps/file: add upstream fix for mingw builds
sys-apps/file/file-5.28.ebuild | 2 ++
sys-apps/file/files/file-5.28-der-mmap.patch | 36 ++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/sys-apps/file/file-5.28.ebuild b/sys-apps/file/file-5.28.ebuild
index 298edaf..fefe087 100644
--- a/sys-apps/file/file-5.28.ebuild
+++ b/sys-apps/file/file-5.28.ebuild
@@ -37,6 +37,8 @@ src_prepare() {
[[ ${PV} == "9999" ]] && eautoreconf
elibtoolize
+ epatch "${FILESDIR}"/${P}-der-mmap.patch
+
# don't let python README kill main README #60043
mv python/README{,.python}
}
diff --git a/sys-apps/file/files/file-5.28-der-mmap.patch b/sys-apps/file/files/file-5.28-der-mmap.patch
new file mode 100644
index 0000000..50542a6
--- /dev/null
+++ b/sys-apps/file/files/file-5.28-der-mmap.patch
@@ -0,0 +1,36 @@
+fix from upstream for building on systems w/out mmap (e.g. mingw)
+
+From 6f1fbff8114ec2319dd874f3552105b378931eb9 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Fri, 15 Jul 2016 00:56:04 +0000
+Subject: [PATCH] we only need mman for testing.
+
+---
+ src/der.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/der.c b/src/der.c
+index fcdeb6c79814..fd093d29ee89 100644
+--- a/src/der.c
++++ b/src/der.c
+@@ -35,8 +35,6 @@
+ #endif
+
+ #include <sys/types.h>
+-#include <sys/stat.h>
+-#include <sys/mman.h>
+
+ #include <stdio.h>
+ #include <fcntl.h>
+@@ -53,6 +51,8 @@
+ #include "magic.h"
+ #include "der.h"
+ #else
++#include <sys/mman.h>
++#include <sys/stat.h>
+ #include <err.h>
+ #endif
+
+--
+2.9.0
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2016-10-25 20:27 Lars Wendler
0 siblings, 0 replies; 17+ messages in thread
From: Lars Wendler @ 2016-10-25 20:27 UTC (permalink / raw
To: gentoo-commits
commit: 4a1936aa0776f32b284ba848ad5a21baf0ae4601
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 20:03:20 2016 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 20:27:10 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a1936aa
sys-apps/file: Removed old.
Package-Manager: portage-2.3.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/file/Manifest | 2 -
sys-apps/file/file-5.26-r1.ebuild | 117 ------------------
sys-apps/file/file-5.27.ebuild | 108 -----------------
sys-apps/file/files/file-5.26-compress-1.patch | 53 ---------
sys-apps/file/files/file-5.26-compress-2.patch | 73 ------------
| 26 ----
sys-apps/file/files/file-5.26-msoffice-magic.patch | 45 -------
sys-apps/file/files/file-5.26-nes-magic.patch | 27 -----
sys-apps/file/files/file-5.26-php-magic.patch | 28 -----
sys-apps/file/files/file-5.26-stdin-rpm.patch | 27 -----
sys-apps/file/files/file-5.26-stdin-test.patch | 132 ---------------------
sys-apps/file/files/file-5.26-tests-fatal.patch | 27 -----
12 files changed, 665 deletions(-)
diff --git a/sys-apps/file/Manifest b/sys-apps/file/Manifest
index 4fcd0b3..58b3473 100644
--- a/sys-apps/file/Manifest
+++ b/sys-apps/file/Manifest
@@ -1,6 +1,4 @@
DIST file-5.22.tar.gz 732556 SHA256 c4e3a8e44cb888c5e4b476e738503e37fb9de3b25a38c143e214bfc12109fc0b SHA512 e9f1648c3b490bac642a2a9e01d31a8bd49c3e2a1feea1b25869aa1d5e37aa99bbf3fdc5d301618a8b97aec046f10e400a57f8a1d0dd61d3583830aaf3fcbda8 WHIRLPOOL de9ce9305fd824d85128617e196fe6b02ea470b63eb2a35d31e857f7cf91e09f85166aaa72695aaf4a7516413b3a146db85588e7da65f32b131a477b3dece176
DIST file-5.25.tar.gz 739485 SHA256 3735381563f69fb4239470b8c51b876a80425348b8285a7cded8b61d6b890eca SHA512 4a5176a7e80df2bb7e45916490433d22eb98a442d49d04146afcbdcf92ff619ea3e73e95c8991e6b6a0628efb9d127bfa4aafc1cae523f8261ca693bc5e13402 WHIRLPOOL 70c682ff05e58487a551cd98091e27272baa41e034157bec93ac4d69b2f3e93caed40f37d64ef698527124e86ba4a5cb5975abacfd9eb30e4d3583262e5f0b0b
-DIST file-5.26.tar.gz 773061 SHA256 2ef32b4ec936b0ff7b59a021dce56086a716663b6df1138c7ea597d396bf50cf SHA512 e3251dde54f200b6bcade5db97fda25e73efcb2629ff5c464601c82190e12290b89eb942d820d43aa67ef37be3c0f2db00e7e5c303c083e4a8d1c49499b907dd WHIRLPOOL f8922b8cbfe153347f793e34ba7be1c3e36e55800e22fcb675f971bcc2094781a0784d887ece32760e2586fe6c459f56ce605610225f6746dacd70a922ac9e10
-DIST file-5.27.tar.gz 774063 SHA256 c2e7d509b1167c4915901ecd257ee924d229a348bf988df6d1934ef0fa34a1a7 SHA512 fcf607d367d85b8a971a62793efc79f7e548e029dd7bb41f95bf992c271c514d70cd4bb5c2ca577e470e0ff1df9dca31beaaf19a5fd4e3f617b36061eff46195 WHIRLPOOL ea7483dce63a4b1f5fa7ee2571e918997bcffb46a7267a1fa45990dc33966e04a22f20d01105b268f6e6ca530a3a9c3f20f4f802a445847c60ee7f943cc5b570
DIST file-5.28.tar.gz 777859 SHA256 0ecb5e146b8655d1fa84159a847ee619fc102575205a0ff9c6cc60fc5ee2e012 SHA512 42136505e21b14396e3af4e0d3f349687176cf0771d2dc9fed3599a30c7bab59184459f1e51033bce2d6ee0e292eba034bdfda727decca1219c1b3419e6bbfdc WHIRLPOOL f12889fc2a692084989d7029d8b9c849344e4236df8afc9e46c6441712aace5e07fee3bb05267ef76da7d41fbcb6b21db4e3bf6e22af660d43b2edeb6ff1571c
DIST file-5.29.tar.gz 783919 SHA256 ea661277cd39bf8f063d3a83ee875432cc3680494169f952787e002bdd3884c0 SHA512 58db17a6bea5d71723f3f7d25300985b3aa78f27fdb1e8b9bb41e61dc325236acaca7c1475cc2725ed672151e1764892dff83d37c24313fe26f45ee3388d4462 WHIRLPOOL e80f117f3db08707c197db2f30aa81407c85b6a5ff0125b41a311c1d6f7dfbf3c0a315ebd1115bef3eecf05beed1fad3570a90d047ecbc7d3a29adcb8ea5c094
diff --git a/sys-apps/file/file-5.26-r1.ebuild b/sys-apps/file/file-5.26-r1.ebuild
deleted file mode 100644
index fb300b3..00000000
--- a/sys-apps/file/file-5.26-r1.ebuild
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} pypy )
-DISTUTILS_OPTIONAL=1
-
-inherit eutils distutils-r1 libtool toolchain-funcs multilib-minimal
-
-if [[ ${PV} == "9999" ]] ; then
- EGIT_REPO_URI="git://github.com/glensc/file.git"
- inherit autotools git-r3
-else
- SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz
- ftp://ftp.gw.com/mirrors/pub/unix/file/${P}.tar.gz"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
-fi
-
-DESCRIPTION="identify a file's format by scanning binary data for patterns"
-HOMEPAGE="http://www.darwinsys.com/file/"
-
-LICENSE="BSD-2"
-SLOT="0"
-IUSE="python static-libs zlib"
-
-DEPEND="python? ( ${PYTHON_DEPS}
- dev-python/setuptools )
- zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-RDEPEND="${DEPEND}
- python? ( !dev-python/python-magic )"
-
-PATCHES=(
- "${FILESDIR}"/${P}-header-define.patch
- "${FILESDIR}"/${P}-nes-magic.patch
- "${FILESDIR}"/${P}-php-magic.patch
- "${FILESDIR}"/${P}-msoffice-magic.patch
- "${FILESDIR}"/${P}-stdin-rpm.patch
- "${FILESDIR}"/${P}-tests-fatal.patch
- "${FILESDIR}"/${P}-stdin-test.patch
- "${FILESDIR}"/${P}-compress-1.patch
- "${FILESDIR}"/${P}-compress-2.patch
-)
-
-src_prepare() {
- epatch "${PATCHES[@]}"
- [[ ${PV} == "9999" ]] && eautoreconf
- elibtoolize
-
- # don't let python README kill main README #60043
- mv python/README{,.python}
-}
-
-multilib_src_configure() {
- ECONF_SOURCE=${S} \
- ac_cv_header_zlib_h=$(usex zlib) \
- ac_cv_lib_z_gzopen=$(usex zlib)
- econf \
- $(use_enable static-libs static)
-}
-
-src_configure() {
- # when cross-compiling, we need to build up our own file
- # because people often don't keep matching host/target
- # file versions #362941
- if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
- mkdir -p "${WORKDIR}"/build
- cd "${WORKDIR}"/build
- tc-export_build_env BUILD_C{C,XX}
- ECONF_SOURCE=${S} \
- ac_cv_header_zlib_h=no \
- ac_cv_lib_z_gzopen=no \
- CHOST=${CBUILD} \
- CFLAGS=${BUILD_CFLAGS} \
- CXXFLAGS=${BUILD_CXXFLAGS} \
- CPPFLAGS=${BUILD_CPPFLAGS} \
- LDFLAGS="${BUILD_LDFLAGS} -static" \
- CC=${BUILD_CC} \
- CXX=${BUILD_CXX} \
- econf --disable-shared
- fi
-
- multilib-minimal_src_configure
-}
-
-multilib_src_compile() {
- if multilib_is_native_abi ; then
- emake
- else
- emake -C src libmagic.la
- fi
-}
-
-src_compile() {
- if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
- emake -C "${WORKDIR}"/build/src file
- PATH="${WORKDIR}/build/src:${PATH}"
- fi
- multilib-minimal_src_compile
-
- use python && cd python && distutils-r1_src_compile
-}
-
-multilib_src_install() {
- if multilib_is_native_abi ; then
- default
- else
- emake -C src install-{includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
- fi
-}
-
-multilib_src_install_all() {
- dodoc ChangeLog MAINT README
-
- use python && cd python && distutils-r1_src_install
- prune_libtool_files
-}
diff --git a/sys-apps/file/file-5.27.ebuild b/sys-apps/file/file-5.27.ebuild
deleted file mode 100644
index 658a92f..00000000
--- a/sys-apps/file/file-5.27.ebuild
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} pypy )
-DISTUTILS_OPTIONAL=1
-
-inherit eutils distutils-r1 libtool toolchain-funcs multilib-minimal
-
-if [[ ${PV} == "9999" ]] ; then
- EGIT_REPO_URI="git://github.com/glensc/file.git"
- inherit autotools git-r3
-else
- SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz
- ftp://ftp.gw.com/mirrors/pub/unix/file/${P}.tar.gz"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
-fi
-
-DESCRIPTION="identify a file's format by scanning binary data for patterns"
-HOMEPAGE="http://www.darwinsys.com/file/ http://mx.gw.com/pipermail/file/"
-
-LICENSE="BSD-2"
-SLOT="0"
-IUSE="python static-libs zlib"
-
-DEPEND="
- python? (
- ${PYTHON_DEPS}
- dev-python/setuptools[${PYTHON_USEDEP}]
- )
- zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-RDEPEND="${DEPEND}
- python? ( !dev-python/python-magic )"
-
-src_prepare() {
- [[ ${PV} == "9999" ]] && eautoreconf
- elibtoolize
-
- # don't let python README kill main README #60043
- mv python/README{,.python}
-}
-
-multilib_src_configure() {
- ECONF_SOURCE=${S} \
- ac_cv_header_zlib_h=$(usex zlib) \
- ac_cv_lib_z_gzopen=$(usex zlib)
- econf \
- --enable-fsect-man5 \
- $(use_enable static-libs static)
-}
-
-src_configure() {
- # when cross-compiling, we need to build up our own file
- # because people often don't keep matching host/target
- # file versions #362941
- if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
- mkdir -p "${WORKDIR}"/build
- cd "${WORKDIR}"/build
- tc-export_build_env BUILD_C{C,XX}
- ECONF_SOURCE=${S} \
- ac_cv_header_zlib_h=no \
- ac_cv_lib_z_gzopen=no \
- CHOST=${CBUILD} \
- CFLAGS=${BUILD_CFLAGS} \
- CXXFLAGS=${BUILD_CXXFLAGS} \
- CPPFLAGS=${BUILD_CPPFLAGS} \
- LDFLAGS="${BUILD_LDFLAGS} -static" \
- CC=${BUILD_CC} \
- CXX=${BUILD_CXX} \
- econf --disable-shared
- fi
-
- multilib-minimal_src_configure
-}
-
-multilib_src_compile() {
- if multilib_is_native_abi ; then
- emake
- else
- emake -C src libmagic.la
- fi
-}
-
-src_compile() {
- if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
- emake -C "${WORKDIR}"/build/src file
- PATH="${WORKDIR}/build/src:${PATH}"
- fi
- multilib-minimal_src_compile
-
- use python && cd python && distutils-r1_src_compile
-}
-
-multilib_src_install() {
- if multilib_is_native_abi ; then
- default
- else
- emake -C src install-{includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
- fi
-}
-
-multilib_src_install_all() {
- dodoc ChangeLog MAINT README
-
- use python && cd python && distutils-r1_src_install
- prune_libtool_files
-}
diff --git a/sys-apps/file/files/file-5.26-compress-1.patch b/sys-apps/file/files/file-5.26-compress-1.patch
deleted file mode 100644
index b10bfd2..00000000
--- a/sys-apps/file/files/file-5.26-compress-1.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 52ae939467583ec499f6c62cdb406e8f982c0310 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 19 Apr 2016 13:39:19 +0000
-Subject: [PATCH] Fix compression code (Werner Fink)
-
----
- src/compress.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
-diff --git a/src/compress.c b/src/compress.c
-index f322445..0ebc837 100644
---- a/src/compress.c
-+++ b/src/compress.c
-@@ -231,9 +231,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
- goto error;
- DPRINTF("rv = %d\n", rv);
- if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
-- goto out;
-+ break;
- if (mime != MAGIC_MIME && mime != 0)
-- goto out;
-+ break;
- if ((file_printf(ms,
- mime ? " compressed-encoding=" : " (")) == -1)
- goto error;
-@@ -250,16 +250,19 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
- }
- if (!mime && file_printf(ms, ")") == -1)
- goto error;
-- goto out;
-+ /*FALLTHROUGH*/
- case NODATA:
-- goto out;
-+ break;
- default:
- abort();
-+ /*NOTREACHED*/
-+ error:
-+ rv = -1;
-+ break;
- }
- }
--out:
-- rv = 1;
--error:
-+ DPRINTF("rv = %d\n", rv);
-+
- #ifdef HAVE_SIGNAL_H
- (void)signal(SIGPIPE, osigpipe);
- #endif
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-compress-2.patch b/sys-apps/file/files/file-5.26-compress-2.patch
deleted file mode 100644
index d27656f..00000000
--- a/sys-apps/file/files/file-5.26-compress-2.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001978.html
-
-From 26879a2b5ec6880cb46b416880e520c628927abd Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 19 Apr 2016 23:36:36 +0000
-Subject: [PATCH] Restore part of previous logic, that breaks out of the
- uncompress loop if there was a compression match error or not. Separate the
- return values to avoid confusion.
-
----
- src/compress.c | 23 ++++++++++++-----------
- 1 file changed, 12 insertions(+), 11 deletions(-)
-
-diff --git a/src/compress.c b/src/compress.c
-index 0ebc837..2a95f85 100644
---- a/src/compress.c
-+++ b/src/compress.c
-@@ -187,7 +187,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
- size_t i, nsz;
- char *rbuf;
- file_pushbuf_t *pb;
-- int rv = 0;
-+ int urv, prv, rv = 0;
- int mime = ms->flags & MAGIC_MIME;
- #ifdef HAVE_SIGNAL_H
- sig_t osigpipe;
-@@ -214,26 +214,26 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
- if (!zm)
- continue;
- nsz = nbytes;
-- rv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
-+ urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
- DPRINTF("uncompressbuf = %d, %s, %zu\n", rv, (char *)newbuf,
- nsz);
-- switch (rv) {
-+ switch (urv) {
- case OKDATA:
- case ERRDATA:
-
- ms->flags &= ~MAGIC_COMPRESS;
-- if (rv == ERRDATA)
-- rv = file_printf(ms, "%s ERROR: %s",
-+ if (urv == ERRDATA)
-+ prv = file_printf(ms, "%s ERROR: %s",
- methodname(i), newbuf);
- else
-- rv = file_buffer(ms, -1, name, newbuf, nsz);
-- if (rv == -1)
-+ prv = file_buffer(ms, -1, name, newbuf, nsz);
-+ if (prv == -1)
- goto error;
-- DPRINTF("rv = %d\n", rv);
-+ rv = 1;
- if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
-- break;
-+ goto out;
- if (mime != MAGIC_MIME && mime != 0)
-- break;
-+ goto out;
- if ((file_printf(ms,
- mime ? " compressed-encoding=" : " (")) == -1)
- goto error;
-@@ -261,6 +261,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
- break;
- }
- }
-+out:
- DPRINTF("rv = %d\n", rv);
-
- #ifdef HAVE_SIGNAL_H
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-header-define.patch b/sys-apps/file/files/file-5.26-header-define.patch
deleted file mode 100644
index 349614f..00000000
--- a/sys-apps/file/files/file-5.26-header-define.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001955.html
-
-From c4b6ea9b998882d08692599e28f4245714eaf8bb Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Sun, 17 Apr 2016 13:56:03 +0000
-Subject: [PATCH] add missing define.
-
----
- src/magic.h.in | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/magic.h.in b/src/magic.h.in
-index 1e567cd..3d6954a 100644
---- a/src/magic.h.in
-+++ b/src/magic.h.in
-@@ -114,6 +114,7 @@ int magic_errno(magic_t);
- #define MAGIC_PARAM_ELF_SHNUM_MAX 3
- #define MAGIC_PARAM_ELF_NOTES_MAX 4
- #define MAGIC_PARAM_REGEX_MAX 5
-+#define MAGIC_PARAM_BYTES_MAX 6
-
- int magic_setparam(magic_t, int, const void *);
- int magic_getparam(magic_t, int, void *);
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-msoffice-magic.patch b/sys-apps/file/files/file-5.26-msoffice-magic.patch
deleted file mode 100644
index a43d3f1..00000000
--- a/sys-apps/file/files/file-5.26-msoffice-magic.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 84609201fbbd9074f5426b991c5242a08ed78712 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 19 Apr 2016 18:14:19 +0000
-Subject: [PATCH] Strengthen the magic of relocatable microsoft objects to
- avoid spurious matches (Joerg Jenderek)
-
----
- magic/Magdir/xenix | 23 +++++++++++++++++++++--
- 1 file changed, 21 insertions(+), 2 deletions(-)
-
-diff --git a/magic/Magdir/xenix b/magic/Magdir/xenix
-index 38e1e3c..ca5eaae 100644
---- a/magic/Magdir/xenix
-+++ b/magic/Magdir/xenix
-@@ -12,7 +12,26 @@
- # XXX - "x.out" collides with PDP-11 archives
- #
- 0 string core core file (Xenix)
--0 byte 0x80 8086 relocatable (Microsoft)
-+# URL: http://www.polarhome.com/service/man/?qf=86rel&tf=2&of=Xenix
-+# Reference: http://www.azillionmonkeys.com/qed/Omfg.pdf
-+# Update: Joerg Jenderek
-+# recordtype~TranslatorHEADerRecord
-+0 byte 0x80
-+# GRR: line above is too general as it catches also Extensible storage engine DataBase
-+# skip examples like GENA.SND Switch.Snd by looking for record length maximal 1024-3
-+>1 uleshort <1022
-+# skip examples like GAME.PICTURE Strange.Pic by looking for positiv record length
-+>>1 uleshort >0
-+# skip examples like Xtable.Data FRACTAL.GEN SHR.VIEW by looking for positiv string length
-+>>>3 ubyte >0
-+# skip examples like OMBRE.6 with "UUUUUU" by looking for filename like "hello.c"
-+>>>>4 regex [a-zA-Z_/]{1,8}[.] 8086 relocatable (Microsoft)
-+#!:mime application/octet-stream
-+!:mime application/x-object
-+!:ext o/a
-+>>>>>3 pstring x \b, "%s"
-+# checksum
-+#>>>>>(3.b+4) ubyte x \b, checksum 0x%2.2x
- 0 leshort 0xff65 x.out
- >2 string __.SYMDEF randomized
- >0 byte x archive
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-nes-magic.patch b/sys-apps/file/files/file-5.26-nes-magic.patch
deleted file mode 100644
index 0cc43b0..00000000
--- a/sys-apps/file/files/file-5.26-nes-magic.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001969.html
-
-From 402b28ae533f5d013cd44e29eeaf64bcd4e5a925 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 18 Apr 2016 20:22:10 +0000
-Subject: [PATCH] Add missing continuation
-
----
- magic/Magdir/console | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/magic/Magdir/console b/magic/Magdir/console
-index ed69f43..9448223 100644
---- a/magic/Magdir/console
-+++ b/magic/Magdir/console
-@@ -53,7 +53,7 @@
- # so most of the data isn't easily parseable.
- #
- 0 string UNIF
--4 lelong <16 UNIF v%d format NES ROM image
-+>4 lelong <16 UNIF v%d format NES ROM image
-
- #------------------------------------------------------------------------------
- # gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-php-magic.patch b/sys-apps/file/files/file-5.26-php-magic.patch
deleted file mode 100644
index 310af1b..00000000
--- a/sys-apps/file/files/file-5.26-php-magic.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001947.html
-http://mx.gw.com/pipermail/file/2016/001949.html
-
-From a5995b6e56c1a476360ccc58598a389f6cd71948 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 19 Apr 2016 13:40:02 +0000
-Subject: [PATCH] Fix wrong level
-
----
- magic/Magdir/commands | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/magic/Magdir/commands b/magic/Magdir/commands
-index 95109f3..fddb764 100644
---- a/magic/Magdir/commands
-+++ b/magic/Magdir/commands
-@@ -101,7 +101,7 @@
- 0 string =<?php
- >5 regex [\ \n]
- >>6 string /*\ Smarty\ version Smarty compiled template
-->24 regex [0-9.]+ \b, version %s
-+>>>24 regex [0-9.]+ \b, version %s
- !:mime text/x-php
-
- 0 string Zend\x00 PHP script Zend Optimizer data
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-stdin-rpm.patch b/sys-apps/file/files/file-5.26-stdin-rpm.patch
deleted file mode 100644
index 7ba5072..00000000
--- a/sys-apps/file/files/file-5.26-stdin-rpm.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001975.html
-
-From 11edb37a71851b5bcbd4e51ca6ad3dcbf57e9761 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 19 Apr 2016 20:51:54 +0000
-Subject: [PATCH] Revert: Don't close stdin...
-
----
- src/magic.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/magic.c b/src/magic.c
-index 46e4678..8cf6269 100644
---- a/src/magic.c
-+++ b/src/magic.c
-@@ -346,7 +346,7 @@ private void
- close_and_restore(const struct magic_set *ms, const char *name, int fd,
- const struct stat *sb)
- {
-- if (name == NULL)
-+ if (fd == STDIN_FILENO || name == NULL)
- return;
- (void) close(fd);
-
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-stdin-test.patch b/sys-apps/file/files/file-5.26-stdin-test.patch
deleted file mode 100644
index 85e59a5..00000000
--- a/sys-apps/file/files/file-5.26-stdin-test.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001963.html
-
-From 20c59ad54afc7427ea680f84c8ee5a576ba54b08 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 18 Apr 2016 15:10:34 +0000
-Subject: [PATCH] Downgrade DER comparison and offset lookup failures to be
- handled as match failures.
-
----
- src/softmagic.c | 60 ++++++++++++++++++++++++++++++++++++++-------------------
- 1 file changed, 40 insertions(+), 20 deletions(-)
-
-diff --git a/src/softmagic.c b/src/softmagic.c
-index 14a8bc5..5b5f0f9 100644
---- a/src/softmagic.c
-+++ b/src/softmagic.c
-@@ -186,11 +186,11 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
- ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
- (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
- (m->flag & mode) != mode) {
-+flush:
- /* Skip sub-tests */
-- while (magindex + 1 < nmagic &&
-- magic[magindex + 1].cont_level != 0 &&
-- ++magindex)
-- continue;
-+ while (magindex < nmagic - 1 &&
-+ magic[magindex + 1].cont_level != 0)
-+ magindex++;
- continue; /* Skip to next top-level test*/
- }
-
-@@ -227,10 +227,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
- * main entry didn't match,
- * flush its continuations
- */
-- while (magindex < nmagic - 1 &&
-- magic[magindex + 1].cont_level != 0)
-- magindex++;
-- continue;
-+ goto flush;
- }
-
- if ((e = handle_annotation(ms, m)) != 0) {
-@@ -255,8 +252,14 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
- if (print && mprint(ms, m) == -1)
- return -1;
-
-- if (moffset(ms, m, nbytes, &ms->c.li[cont_level].off) == -1)
-+ switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) {
-+ case -1:
- return -1;
-+ case 0:
-+ goto flush;
-+ default:
-+ break;
-+ }
-
- /* and any continuations that match */
- if (file_check_mem(ms, ++cont_level) == -1)
-@@ -362,9 +365,16 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
- if (print && mprint(ms, m) == -1)
- return -1;
-
-- if (moffset(ms, m, nbytes,
-- &ms->c.li[cont_level].off) == -1)
-+ switch (moffset(ms, m, nbytes,
-+ &ms->c.li[cont_level].off)) {
-+ case -1:
- return -1;
-+ case 0:
-+ flush = 1;
-+ break;
-+ default:
-+ break;
-+ }
-
- if (*m->desc)
- *need_separator = 1;
-@@ -813,9 +823,13 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
- case FILE_DER:
- {
- o = der_offs(ms, m, nbytes);
-- if (o == -1) {
-- file_error(ms, 0, "EOF computing DER offset");
-- return -1;
-+ if (o == -1 || (size_t)o > nbytes) {
-+ if ((ms->flags & MAGIC_DEBUG) != 0) {
-+ (void)fprintf(stderr,
-+ "Bad DER offset %d nbytes=%zu",
-+ o, nbytes);
-+ }
-+ return 0;
- }
- break;
- }
-@@ -825,12 +839,13 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
- break;
- }
-
-- if ((size_t)o >= nbytes) {
-- file_error(ms, 0, "Offset out of range");
-+ if ((size_t)o > nbytes) {
-+ file_error(ms, 0, "Offset out of range %zu > %zu",
-+ (size_t)o, nbytes);
- return -1;
- }
- *op = o;
-- return 0;
-+ return 1;
- }
-
- private uint32_t
-@@ -2107,8 +2122,13 @@ magiccheck(struct magic_set *ms, struct magic *m)
- return 1;
- case FILE_DER:
- matched = der_cmp(ms, m);
-- if (matched == -1)
-- file_error(ms, 0, "EOF comparing DER entries");
-+ if (matched == -1) {
-+ if ((ms->flags & MAGIC_DEBUG) != 0) {
-+ (void) fprintf(stderr,
-+ "EOF comparing DER entries");
-+ }
-+ return 0;
-+ }
- return matched;
- default:
- file_magerror(ms, "invalid type %d in magiccheck()", m->type);
---
-2.7.4
-
diff --git a/sys-apps/file/files/file-5.26-tests-fatal.patch b/sys-apps/file/files/file-5.26-tests-fatal.patch
deleted file mode 100644
index 29c9338..00000000
--- a/sys-apps/file/files/file-5.26-tests-fatal.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-http://mx.gw.com/pipermail/file/2016/001961.html
-
-From fe1b14d68fe47a0641606c142222d6b0fb9e05d9 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 18 Apr 2016 18:16:45 +0000
-Subject: [PATCH] exit on error.
-
----
- tests/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/Makefile.am b/tests/Makefile.am
-index c2cb5ee..e55cdf4 100644
---- a/tests/Makefile.in
-+++ b/tests/Makefile.in
-@@ -13,7 +13,7 @@ issue311docx.testfile
- T = $(top_srcdir)/tests
- check-local:
- MAGIC=$(top_builddir)/magic/magic ./test
-- for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
-+ set -e; for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
-
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
- # Otherwise a system limit (for SysV at least) may be exceeded.
---
-2.7.4
-
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2018-06-12 8:18 Thomas Deutschmann
0 siblings, 0 replies; 17+ messages in thread
From: Thomas Deutschmann @ 2018-06-12 8:18 UTC (permalink / raw
To: gentoo-commits
commit: 331976f64a3ac2e70aa62d6631db0e148f19d0fe
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 12 08:17:44 2018 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Jun 12 08:18:03 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=331976f6
sys-apps/file: Avoid reading past the end of buffer (CVE-2018-10360)
Bug: https://bugs.gentoo.org/657930
Package-Manager: Portage-2.3.40, Repoman-2.3.9
sys-apps/file/file-5.33-r2.ebuild | 127 +++++++++++++++++++++
sys-apps/file/files/file-5.33-CVE-2018-10360.patch | 18 +++
2 files changed, 145 insertions(+)
diff --git a/sys-apps/file/file-5.33-r2.ebuild b/sys-apps/file/file-5.33-r2.ebuild
new file mode 100644
index 00000000000..4537ffb58aa
--- /dev/null
+++ b/sys-apps/file/file-5.33-r2.ebuild
@@ -0,0 +1,127 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
+DISTUTILS_OPTIONAL=1
+
+inherit distutils-r1 libtool ltprune toolchain-funcs multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit autotools git-r3
+else
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="python static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )"
+
+PATCHES=( "${FILESDIR}"/${P}-CVE-2018-10360.patch )
+
+src_prepare() {
+ default
+
+ [[ ${PV} == "9999" ]] && eautoreconf
+ elibtoolize
+
+ # don't let python README kill main README #60043
+ mv python/README{,.python} || die
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --disable-libseccomp
+ --enable-fsect-man5
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+src_configure() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions #362941
+ if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ tc-export_build_env BUILD_C{C,XX}
+ ECONF_SOURCE=${S} \
+ ac_cv_header_zlib_h=no \
+ ac_cv_lib_z_gzopen=no \
+ CHOST=${CBUILD} \
+ CFLAGS=${BUILD_CFLAGS} \
+ CXXFLAGS=${BUILD_CXXFLAGS} \
+ CPPFLAGS=${BUILD_CPPFLAGS} \
+ LDFLAGS="${BUILD_LDFLAGS} -static" \
+ CC=${BUILD_CC} \
+ CXX=${BUILD_CXX} \
+ econf --disable-shared --disable-libseccomp
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ cd src || die
+ emake magic.h #586444
+ emake libmagic.la
+ fi
+}
+
+src_compile() {
+ if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
+ emake -C "${WORKDIR}"/build/src magic.h #586444
+ emake -C "${WORKDIR}"/build/src file
+ PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT README
+
+ # Required for `file -C`
+ dodir /usr/share/misc/magic
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+ prune_libtool_files
+}
diff --git a/sys-apps/file/files/file-5.33-CVE-2018-10360.patch b/sys-apps/file/files/file-5.33-CVE-2018-10360.patch
new file mode 100644
index 00000000000..a489846b10f
--- /dev/null
+++ b/sys-apps/file/files/file-5.33-CVE-2018-10360.patch
@@ -0,0 +1,18 @@
+Avoid reading past the end of buffer
+
+CVE-2018-10360
+
+https://github.com/file/file/commit/a642587a9c9e2dd7feacdf513c3643ce26ad3c22
+
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -842,7 +842,8 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
+
+ cname = (unsigned char *)
+ &nbuf[doff + prpsoffsets(i)];
+- for (cp = cname; *cp && isprint(*cp); cp++)
++ for (cp = cname; cp < nbuf + size && *cp
++ && isprint(*cp); cp++)
+ continue;
+ /*
+ * Linux apparently appends a space at the end
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2018-07-24 8:58 Lars Wendler
0 siblings, 0 replies; 17+ messages in thread
From: Lars Wendler @ 2018-07-24 8:58 UTC (permalink / raw
To: gentoo-commits
commit: 6d0b89f14127625f091fe9edbec9ca41ac1accd2
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 24 08:55:05 2018 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Jul 24 08:58:02 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d0b89f1
sys-apps/file: Revbump to fix berkdb file magic
Bumped straight to stable
Closes: https://bugs.gentoo.org/661922
Package-Manager: Portage-2.3.43, Repoman-2.3.10
.../{file-5.33-r3.ebuild => file-5.33-r4.ebuild} | 5 ++--
.../file/files/file-5.33-berkdb_bogus_magic.patch | 33 ++++++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/sys-apps/file/file-5.33-r3.ebuild b/sys-apps/file/file-5.33-r4.ebuild
similarity index 95%
rename from sys-apps/file/file-5.33-r3.ebuild
rename to sys-apps/file/file-5.33-r4.ebuild
index e9203f385ff..1221edeea29 100644
--- a/sys-apps/file/file-5.33-r3.ebuild
+++ b/sys-apps/file/file-5.33-r4.ebuild
@@ -6,7 +6,7 @@ EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy )
DISTUTILS_OPTIONAL=1
-inherit distutils-r1 libtool ltprune toolchain-funcs multilib-minimal
+inherit distutils-r1 libtool toolchain-funcs multilib-minimal
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/glensc/file.git"
@@ -36,6 +36,7 @@ RDEPEND="${DEPEND}
PATCHES=(
"${FILESDIR}"/${P}-CVE-2018-10360.patch
"${FILESDIR}"/${P}-gl_VISIBILITY-macro.patch
+ "${FILESDIR}"/${P}-berkdb_bogus_magic.patch #661922
)
src_prepare() {
@@ -129,5 +130,5 @@ multilib_src_install_all() {
cd python || die
distutils-r1_src_install
fi
- prune_libtool_files
+ find "${ED}" -name "*.la" -delete || die
}
diff --git a/sys-apps/file/files/file-5.33-berkdb_bogus_magic.patch b/sys-apps/file/files/file-5.33-berkdb_bogus_magic.patch
new file mode 100644
index 00000000000..7627bafc6ef
--- /dev/null
+++ b/sys-apps/file/files/file-5.33-berkdb_bogus_magic.patch
@@ -0,0 +1,33 @@
+From 4fb6a59df80d4974f8230bfce36e38e6de7d574f Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Thu, 24 May 2018 18:54:40 +0000
+Subject: [PATCH] fix bogus magic
+
+---
+ magic/Magdir/dbpf | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/magic/Magdir/dbpf b/magic/Magdir/dbpf
+index 65cab61e..8545720d 100644
+--- a/magic/Magdir/dbpf
++++ b/magic/Magdir/dbpf
+@@ -1,6 +1,6 @@
+
+ #------------------------------------------------------------------------------
+-# $File: dbpf,v 1.1 2017/10/13 20:47:14 christos Exp $
++# $File: dbpf,v 1.2 2018/05/24 18:54:40 christos Exp $
+ # dppf: Maxis Database Packed Files, the stored data file format used by all
+ # Maxis games after the Sims: http://wiki.niotso.org/DBPF
+ # http://www.wiki.sc4devotion.com/index.php?title=DBPF
+@@ -9,9 +9,7 @@
+ >4 ulelong x \b, version: %u.
+ >>8 ulelong x \b%u
+ >>>36 ulelong x \b, files: %u
++>>24 ledate !0 \b, created: %s
++>>28 ledate !0 \b, modified: %s
+ !:ext dbpf/package/dat/sc4
+ !:mime application/x-maxis-dbpf
+-4 ulelong 1
+->8 ulelong !1
+->>24 ledate !0 \b, created: %s
+->>>28 ledate !0 \b, modified: %s
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2020-04-12 23:28 Thomas Deutschmann
0 siblings, 0 replies; 17+ messages in thread
From: Thomas Deutschmann @ 2020-04-12 23:28 UTC (permalink / raw
To: gentoo-commits
commit: 5460a7f2977b8ef57e56c447c5b8350bbe505f9d
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 12 23:20:25 2020 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Apr 12 23:21:49 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5460a7f2
sys-apps/file: rev bump
- Revert https://github.com/file/file/commit/24c9c086cd7c55b7b0a003a145b32466468e2608
which fixes misdetection of shared libraries as statically linked as.
- Cherry-pick https://github.com/file/file/commit/d955cefc956ba537cfc0556023a65fe80bd2d82b
- Cherry-pick https://github.com/file/file/commit/483e7d8f1a5c3544bd42ead471813f8389fa7fc2
Bug: https://bugs.gentoo.org/717264
Package-Manager: Portage-2.3.98, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
sys-apps/file/file-5.38-r1.ebuild | 142 +++++++++++++++++++++
...3-iaeiaeiaeiae-Do-as-the-comment-says-and.patch | 40 ++++++
...ble-bit-is-only-set-when-DF_1_PIE-bit-is-.patch | 29 +++++
...le-5.38-td-is-for-ptrdiff_t-not-for-off_t.patch | 27 ++++
4 files changed, 238 insertions(+)
diff --git a/sys-apps/file/file-5.38-r1.ebuild b/sys-apps/file/file-5.38-r1.ebuild
new file mode 100644
index 00000000000..58bb745b6b5
--- /dev/null
+++ b/sys-apps/file/file-5.38-r1.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
+DISTUTILS_OPTIONAL=1
+
+inherit distutils-r1 libtool toolchain-funcs multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit autotools git-r3
+else
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ 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"
+fi
+
+DESCRIPTION="identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzma python static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-Revert-PR-93-iaeiaeiaeiae-Do-as-the-comment-says-and.patch
+ "${FILESDIR}"/${P}-td-is-for-ptrdiff_t-not-for-off_t.patch
+ "${FILESDIR}"/${P}-The-executable-bit-is-only-set-when-DF_1_PIE-bit-is-.patch
+)
+
+src_prepare() {
+ default
+
+ [[ ${PV} == "9999" ]] && eautoreconf
+ elibtoolize
+
+ # don't let python README kill main README #60043
+ mv python/README.md python/README.python.md || die
+ sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --disable-libseccomp
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE=${S}
+
+ if need_build_file; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ cd src || die
+ emake magic.h #586444
+ emake libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file; then
+ emake -C "${WORKDIR}"/build/src magic.h #586444
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT README
+
+ # Required for `file -C`
+ dodir /usr/share/misc/magic
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+ find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/sys-apps/file/files/file-5.38-Revert-PR-93-iaeiaeiaeiae-Do-as-the-comment-says-and.patch b/sys-apps/file/files/file-5.38-Revert-PR-93-iaeiaeiaeiae-Do-as-the-comment-says-and.patch
new file mode 100644
index 00000000000..240edc11f68
--- /dev/null
+++ b/sys-apps/file/files/file-5.38-Revert-PR-93-iaeiaeiaeiae-Do-as-the-comment-says-and.patch
@@ -0,0 +1,40 @@
+From c9d21a58bea2ecb2dc8876e09e471094d54a25e4 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@gentoo.org>
+Date: Mon, 13 Apr 2020 01:08:12 +0200
+Subject: [PATCH 1/3] Revert "PR/93: iaeiaeiaeiae: Do as the comment says, and
+ count as dynamically linked"
+
+This reverts commit 24c9c086cd7c55b7b0a003a145b32466468e2608.
+
+Fixes misdetection of shared libraries as statically linked as
+reported in bug 717264.
+
+Bug: https://bugs.gentoo.org/717264
+Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
+---
+ src/readelf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/readelf.c b/src/readelf.c
+index 40bcfab1..afec31d1 100644
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -1638,6 +1638,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
+ /* Things we can determine before we seek */
+ switch (xph_type) {
+ case PT_DYNAMIC:
++ linking_style = "dynamically";
+ doread = 1;
+ break;
+ case PT_NOTE:
+@@ -1653,7 +1654,6 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
+ }
+ /*FALLTHROUGH*/
+ case PT_INTERP:
+- linking_style = "dynamically";
+ doread = 1;
+ break;
+ default:
+--
+2.26.0
+
diff --git a/sys-apps/file/files/file-5.38-The-executable-bit-is-only-set-when-DF_1_PIE-bit-is-.patch b/sys-apps/file/files/file-5.38-The-executable-bit-is-only-set-when-DF_1_PIE-bit-is-.patch
new file mode 100644
index 00000000000..bb211f355f7
--- /dev/null
+++ b/sys-apps/file/files/file-5.38-The-executable-bit-is-only-set-when-DF_1_PIE-bit-is-.patch
@@ -0,0 +1,29 @@
+From ed971e5e3ae79bd28697d16c8b78b693052484e4 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Wed, 12 Feb 2020 22:17:33 +0000
+Subject: [PATCH 3/3] The executable bit is only set when DF_1_PIE bit is set
+ so it is fine.
+
+---
+ magic/Magdir/elf | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/magic/Magdir/elf b/magic/Magdir/elf
+index b5a2e00b..f5e1af9a 100644
+--- a/magic/Magdir/elf
++++ b/magic/Magdir/elf
+@@ -50,8 +50,9 @@
+ !:mime application/x-object
+ >16 leshort 2 executable,
+ !:mime application/x-executable
+->16 leshort 3 shared object,
+-!:mime application/x-sharedlib
++>16 leshort 3 ${x?pie executable:shared object},
++
++!:mime application/x-${x?pie-executable:sharedlib}
+ >16 leshort 4 core file,
+ !:mime application/x-coredump
+ # OS-specific
+--
+2.26.0
+
diff --git a/sys-apps/file/files/file-5.38-td-is-for-ptrdiff_t-not-for-off_t.patch b/sys-apps/file/files/file-5.38-td-is-for-ptrdiff_t-not-for-off_t.patch
new file mode 100644
index 00000000000..09fcaef151e
--- /dev/null
+++ b/sys-apps/file/files/file-5.38-td-is-for-ptrdiff_t-not-for-off_t.patch
@@ -0,0 +1,27 @@
+From c49dc91df427f89ebcf9cdec556b8fc88cdfc3c1 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 17 Dec 2019 15:27:27 +0000
+Subject: [PATCH 2/3] %td is for ptrdiff_t not for off_t.
+
+---
+ src/readelf.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/readelf.c b/src/readelf.c
+index afec31d1..8ac3b7d6 100644
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -1349,8 +1349,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
+ name_off = xsh_offset;
+
+ if (fsize != SIZE_UNKNOWN && fsize < name_off) {
+- if (file_printf(ms, ", too large section header offset %td",
+- name_off) == -1)
++ if (file_printf(ms, ", too large section header offset %jd",
++ (intmax_t)name_off) == -1)
+ return -1;
+ return 0;
+ }
+--
+2.26.0
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2020-06-15 8:09 Lars Wendler
0 siblings, 0 replies; 17+ messages in thread
From: Lars Wendler @ 2020-06-15 8:09 UTC (permalink / raw
To: gentoo-commits
commit: 6da8c8078434cfa0e3ec7334de28b27467a0a0b5
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 15 08:02:37 2020 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Jun 15 08:09:14 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6da8c807
sys-apps/file: Bump to version 5.39
Closes: https://bugs.gentoo.org/713710
Package-Manager: Portage-2.3.101, Repoman-2.3.22
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/file/Manifest | 1 +
sys-apps/file/file-5.39.ebuild | 140 +++++++++++++++++++++
.../file/files/file-5.39-seccomp_sandbox.patch | 13 ++
3 files changed, 154 insertions(+)
diff --git a/sys-apps/file/Manifest b/sys-apps/file/Manifest
index 998712fc785..42c17cea294 100644
--- a/sys-apps/file/Manifest
+++ b/sys-apps/file/Manifest
@@ -1,2 +1,3 @@
DIST file-5.37.tar.gz 887682 BLAKE2B c5635e5de879af31cbef1c988275ab8620133909d146769b27a2f8eefa90871fad5fa75e66b9e1d77a6261e5d6dec315fb5a8ad587d8c214eaa0bc2e5a929fe7 SHA512 bf153c15aebdd00329806231d20f295077b8b99efd0181d01279bcf3734a1718567df38cf75bc929eb8015ac98d29bb4bf1228d7ece8bfdfe14dd976391dd06d
DIST file-5.38.tar.gz 932528 BLAKE2B 08d8d56e2e1b6a0c9fb0caed89ca6145bf683ecc52a639c036ded01b913e7eea75d9235851a2fbd410cbc9b929c26579b06fe1d54fb73817c951bef3544bc345 SHA512 9eeeba69cbc9f0c00a0bdf9eaf60c73a4a709e797068f109d85c1ef2a19c8b0e012ecd73714f03cbb1770dfa717e8a661ad746b644cc030cafbfb1f7aac35a40
+DIST file-5.39.tar.gz 954266 BLAKE2B 4d6d9a6317961e0a2aa391f502b0be8bbb40ede57c3470230d91aaf9ce5d35bcaceb32d551ca5a391fc8c40b64517fdb996833a8b1ca47ced7e92e9e545d2682 SHA512 9cf1a7b769c56eb6f5b25c66ce85fa1300128396e445b2e53dbbd8951e5da973a7a07c4ef9f7ebd1fe945d47bdaf2cd9ef09bd2be6c217a0bcb907d9449835e6
diff --git a/sys-apps/file/file-5.39.ebuild b/sys-apps/file/file-5.39.ebuild
new file mode 100644
index 00000000000..98499a3c73d
--- /dev/null
+++ b/sys-apps/file/file-5.39.ebuild
@@ -0,0 +1,140 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+DISTUTILS_OPTIONAL=1
+
+inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit git-r3
+else
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ 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"
+fi
+
+DESCRIPTION="identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzma python seccomp static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )
+ seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-5.39-seccomp_sandbox.patch" #713710
+)
+
+src_prepare() {
+ default
+ eautoreconf
+ elibtoolize
+
+ # don't let python README kill main README #60043
+ mv python/README.md python/README.python.md || die
+ sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable seccomp libseccomp)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE=${S}
+
+ if need_build_file; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ cd src || die
+ emake magic.h #586444
+ emake libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file; then
+ emake -C "${WORKDIR}"/build/src magic.h #586444
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT README
+
+ # Required for `file -C`
+ dodir /usr/share/misc/magic
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+ find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/sys-apps/file/files/file-5.39-seccomp_sandbox.patch b/sys-apps/file/files/file-5.39-seccomp_sandbox.patch
new file mode 100644
index 00000000000..da0a0ff1f28
--- /dev/null
+++ b/sys-apps/file/files/file-5.39-seccomp_sandbox.patch
@@ -0,0 +1,13 @@
+Don't call file with seccomp in portage sandbox. This will fail:
+
+ make[2]: *** [Makefile:834: magic.mgc] Bad system call
+
+--- file-5.39/magic/Makefile.am
++++ file-5.39/magic/Makefile.am
+@@ -352,5 +352,5 @@
+ exit 1; \
+ fi; \
+ fi)
+- $(FILE_COMPILE) -C -m magic
++ $(FILE_COMPILE) -S -C -m magic
+ @rm -fr magic
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2020-06-28 2:10 Georgy Yakovlev
0 siblings, 0 replies; 17+ messages in thread
From: Georgy Yakovlev @ 2020-06-28 2:10 UTC (permalink / raw
To: gentoo-commits
commit: 3d32972fa6671b911726d7a2abd4128afd35a36b
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 28 02:07:30 2020 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sun Jun 28 02:08:13 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d32972f
sys-apps/file: revbump 5.39, add include termios.h patch
Closes: https://bugs.gentoo.org/728416
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Acked-by: Lars Wendler <polynomial-c <AT> gentoo.org>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-apps/file/file-5.39-r2.ebuild | 141 +++++++++++++++++++++
.../file/files/file-5.39-add-missing-termios.patch | 27 ++++
2 files changed, 168 insertions(+)
diff --git a/sys-apps/file/file-5.39-r2.ebuild b/sys-apps/file/file-5.39-r2.ebuild
new file mode 100644
index 00000000000..204826c0d4d
--- /dev/null
+++ b/sys-apps/file/file-5.39-r2.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+DISTUTILS_OPTIONAL=1
+
+inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit git-r3
+else
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ 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"
+fi
+
+DESCRIPTION="identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzma python seccomp static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )
+ seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-5.39-portage_sandbox.patch" #713710 #728978
+ "${FILESDIR}/${P}-add-missing-termios.patch" #728416
+)
+
+src_prepare() {
+ default
+ eautoreconf
+ elibtoolize
+
+ # don't let python README kill main README #60043
+ mv python/README.md python/README.python.md || die
+ sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable seccomp libseccomp)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE=${S}
+
+ if need_build_file; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ cd src || die
+ emake magic.h #586444
+ emake libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file; then
+ emake -C "${WORKDIR}"/build/src magic.h #586444
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT README
+
+ # Required for `file -C`
+ dodir /usr/share/misc/magic
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+ find "${ED}" -type f -name "*.la" -delete || die
+}
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
new file mode 100644
index 00000000000..e6cba0d4c28
--- /dev/null
+++ b/sys-apps/file/files/file-5.39-add-missing-termios.patch
@@ -0,0 +1,27 @@
+From 769e9868c17a471323b81b12cab851c9fd22baf4 Mon Sep 17 00:00:00 2001
+From: Georgy Yakovlev <gyakovlev@gentoo.org>
+Date: Mon, 15 Jun 2020 14:18:45 -0700
+Subject: [PATCH] add missing termios.h include
+
+on ppc, TCGETS relies on struct termios being complete, on other
+architectures it does not.
+so termios.h should be included before ioctl.h
+---
+ src/seccomp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/seccomp.c b/src/seccomp.c
+index e667adf..296f5b3 100644
+--- a/src/seccomp.c
++++ b/src/seccomp.c
+@@ -33,6 +33,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
+ #if HAVE_LIBSECCOMP
+ #include <seccomp.h> /* libseccomp */
+ #include <sys/prctl.h> /* prctl */
++#include <termios.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+ #include <fcntl.h>
+--
+2.27.0
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2021-04-21 9:42 Lars Wendler
0 siblings, 0 replies; 17+ messages in thread
From: Lars Wendler @ 2021-04-21 9:42 UTC (permalink / raw
To: gentoo-commits
commit: bb949123596216a8af1a18b1ba4f396919a2d976
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 21 09:41:58 2021 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Apr 21 09:42:48 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb949123
sys-apps/file: Revbump to fix xz magic
Thanks-to: Mike Auty <ikelos <AT> gentoo.org>
Closes: https://bugs.gentoo.org/784773
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
.../file/{file-5.40.ebuild => file-5.40-r1.ebuild} | 1 +
sys-apps/file/files/file-5.40-xz_magic.patch | 37 ++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/sys-apps/file/file-5.40.ebuild b/sys-apps/file/file-5.40-r1.ebuild
similarity index 98%
rename from sys-apps/file/file-5.40.ebuild
rename to sys-apps/file/file-5.40-r1.ebuild
index 67c33d9f485..a901c2a4003 100644
--- a/sys-apps/file/file-5.40.ebuild
+++ b/sys-apps/file/file-5.40-r1.ebuild
@@ -38,6 +38,7 @@ RDEPEND="${DEPEND}
PATCHES=(
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
+ "${FILESDIR}/file-5.40-xz_magic.patch" #784773
)
src_prepare() {
diff --git a/sys-apps/file/files/file-5.40-xz_magic.patch b/sys-apps/file/files/file-5.40-xz_magic.patch
new file mode 100644
index 00000000000..e4fed0421f7
--- /dev/null
+++ b/sys-apps/file/files/file-5.40-xz_magic.patch
@@ -0,0 +1,37 @@
+From 9b0459afab309a82aa4e46f73a4e50dd641f3d39 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 19 Apr 2021 17:01:45 +0000
+Subject: [PATCH] PR/257: cuihao: put attributes inside the xz magic.
+
+---
+ magic/Magdir/compress | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/magic/Magdir/compress b/magic/Magdir/compress
+index 64d11a736..41a65738f 100644
+--- a/magic/Magdir/compress
++++ b/magic/Magdir/compress
+@@ -1,5 +1,5 @@
+ #------------------------------------------------------------------------------
+-# $File: compress,v 1.80 2021/03/15 17:49:24 christos Exp $
++# $File: compress,v 1.81 2021/04/19 17:01:45 christos Exp $
+ # compress: file(1) magic for pure-compression formats (no archives)
+ #
+ # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
+@@ -265,14 +265,13 @@
+
+ # http://tukaani.org/xz/xz-file-format.txt
+ 0 ustring \xFD7zXZ\x00 XZ compressed data, checksum
++!:strength * 2
++!:mime application/x-xz
+ >7 byte&0xf 0x0 NONE
+ >7 byte&0xf 0x1 CRC32
+ >7 byte&0xf 0x4 CRC64
+ >7 byte&0xf 0xa SHA-256
+
+-!:strength * 2
+-!:mime application/x-xz
+-
+ # https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
+ 0 string LRZI LRZIP compressed data
+ >4 byte x - version %d
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2021-04-25 18:13 Mike Gilbert
0 siblings, 0 replies; 17+ messages in thread
From: Mike Gilbert @ 2021-04-25 18:13 UTC (permalink / raw
To: gentoo-commits
commit: 569ba84b15b51f0a0ee9bdff795a7455e67b4404
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 25 18:12:40 2021 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Apr 25 18:13:25 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=569ba84b
sys-apps/file: drop 5.39-r4
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
sys-apps/file/Manifest | 1 -
sys-apps/file/file-5.39-r4.ebuild | 146 ---------------------
.../file/files/file-5.39-add-missing-termios.patch | 30 -----
.../file/files/file-5.39-allow-futex-seccomp.patch | 18 ---
sys-apps/file/files/file-5.39-seccomp-musl.patch | 37 ------
5 files changed, 232 deletions(-)
diff --git a/sys-apps/file/Manifest b/sys-apps/file/Manifest
index 128c4b0fb4f..87042e9a832 100644
--- a/sys-apps/file/Manifest
+++ b/sys-apps/file/Manifest
@@ -1,2 +1 @@
-DIST file-5.39.tar.gz 954266 BLAKE2B 4d6d9a6317961e0a2aa391f502b0be8bbb40ede57c3470230d91aaf9ce5d35bcaceb32d551ca5a391fc8c40b64517fdb996833a8b1ca47ced7e92e9e545d2682 SHA512 9cf1a7b769c56eb6f5b25c66ce85fa1300128396e445b2e53dbbd8951e5da973a7a07c4ef9f7ebd1fe945d47bdaf2cd9ef09bd2be6c217a0bcb907d9449835e6
DIST file-5.40.tar.gz 1004214 BLAKE2B 4e15a1ca62fe7c03c90b0e509dc899b87f4474f758ad3d08172b3d838dc3f7c2954ba1074eeeeb3da8c04b8df84eff2b8cdf3177da334a926914429df67f60bf SHA512 3b70df75fa4c9050d55b1ffdc28e5f3c8b8ef7d4efd1a06bf53f113b676d81114a85aae56e0897d32b53716662d64ad18ab251ca8c92c6405c69eb758bb99afb
diff --git a/sys-apps/file/file-5.39-r4.ebuild b/sys-apps/file/file-5.39-r4.ebuild
deleted file mode 100644
index 9a001b6a073..00000000000
--- a/sys-apps/file/file-5.39-r4.ebuild
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..9} )
-DISTUTILS_OPTIONAL=1
-
-inherit distutils-r1 libtool toolchain-funcs multilib-minimal
-
-if [[ ${PV} == "9999" ]] ; then
- EGIT_REPO_URI="https://github.com/glensc/file.git"
- inherit autotools git-r3
-else
- SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
- KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-fi
-
-DESCRIPTION="identify a file's format by scanning binary data for patterns"
-HOMEPAGE="https://www.darwinsys.com/file/"
-
-LICENSE="BSD-2"
-SLOT="0"
-IUSE="bzip2 lzma python seccomp static-libs zlib"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
-
-DEPEND="
- bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
- lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
- python? (
- ${PYTHON_DEPS}
- dev-python/setuptools[${PYTHON_USEDEP}]
- )
- zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-RDEPEND="${DEPEND}
- python? ( !dev-python/python-magic )
- seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
-
-PATCHES=(
- "${FILESDIR}/file-5.39-add-missing-termios.patch" #728416
- "${FILESDIR}/file-5.39-seccomp-musl.patch"
- "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
- "${FILESDIR}/file-5.39-allow-futex-seccomp.patch" #771096
-)
-
-src_prepare() {
- default
-
- if [[ ${PV} == 9999 ]]; then
- eautoreconf
- fi
-
- elibtoolize
-
- # don't let python README kill main README #60043
- mv python/README.md python/README.python.md || die
- sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
-}
-
-multilib_src_configure() {
- local myeconfargs=(
- --enable-fsect-man5
- $(use_enable bzip2 bzlib)
- $(use_enable lzma xzlib)
- $(use_enable seccomp libseccomp)
- $(use_enable static-libs static)
- $(use_enable zlib)
- )
- econf "${myeconfargs[@]}"
-}
-
-build_src_configure() {
- local myeconfargs=(
- --disable-shared
- --disable-libseccomp
- --disable-bzlib
- --disable-xzlib
- --disable-zlib
- )
- tc-env_build econf "${myeconfargs[@]}"
-}
-
-need_build_file() {
- # when cross-compiling, we need to build up our own file
- # because people often don't keep matching host/target
- # file versions #362941
- tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
-}
-
-src_configure() {
- local ECONF_SOURCE=${S}
-
- if need_build_file; then
- mkdir -p "${WORKDIR}"/build || die
- cd "${WORKDIR}"/build || die
- build_src_configure
- fi
-
- multilib-minimal_src_configure
-}
-
-multilib_src_compile() {
- if multilib_is_native_abi ; then
- emake
- else
- cd src || die
- emake magic.h #586444
- emake libmagic.la
- fi
-}
-
-src_compile() {
- if need_build_file; then
- emake -C "${WORKDIR}"/build/src magic.h #586444
- emake -C "${WORKDIR}"/build/src file
- local -x PATH="${WORKDIR}/build/src:${PATH}"
- fi
- multilib-minimal_src_compile
-
- if use python ; then
- cd python || die
- distutils-r1_src_compile
- fi
-}
-
-multilib_src_install() {
- if multilib_is_native_abi ; then
- default
- else
- emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
- fi
-}
-
-multilib_src_install_all() {
- dodoc ChangeLog MAINT README
-
- # Required for `file -C`
- insinto /usr/share/misc/magic
- doins -r magic/Magdir/*
-
- if use python ; then
- cd python || die
- distutils-r1_src_install
- fi
- find "${ED}" -type f -name "*.la" -delete || die
-}
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
deleted file mode 100644
index 0614f52dd27..00000000000
--- a/sys-apps/file/files/file-5.39-add-missing-termios.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 471e2c6c61ecd30ba6e304ae0444d364cfd44254 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Thu, 18 Jun 2020 16:25:12 +0000
-Subject: [PATCH] PR/168: gyakovlev: Include <termios.h>
-
----
- src/seccomp.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/seccomp.c b/src/seccomp.c
-index e667adfe4..68c56485d 100644
---- a/src/seccomp.c
-+++ b/src/seccomp.c
-@@ -27,7 +27,7 @@
- #include "file.h"
-
- #ifndef lint
--FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
-+FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
- #endif /* lint */
-
- #if HAVE_LIBSECCOMP
-@@ -35,6 +35,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
- #include <sys/prctl.h> /* prctl */
- #include <sys/ioctl.h>
- #include <sys/socket.h>
-+#include <termios.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <errno.h>
diff --git a/sys-apps/file/files/file-5.39-allow-futex-seccomp.patch b/sys-apps/file/files/file-5.39-allow-futex-seccomp.patch
deleted file mode 100644
index 8d9e3d1eb66..00000000000
--- a/sys-apps/file/files/file-5.39-allow-futex-seccomp.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-In some situations, futex() is called even when lzma
-support is not compiled in. Let's enable it unconditionally
-for now.
-
-https://bugs.gentoo.org/771096
-https://bugs.astron.com/view.php?id=241
---- a/src/seccomp.c
-+++ b/src/seccomp.c
-@@ -175,9 +175,7 @@ enable_sandbox_full(void)
- ALLOW_RULE(fcntl64);
- ALLOW_RULE(fstat);
- ALLOW_RULE(fstat64);
--#ifdef XZLIBSUPPORT
- ALLOW_RULE(futex);
--#endif
- ALLOW_RULE(getdents);
- #ifdef __NR_getdents64
- ALLOW_RULE(getdents64);
diff --git a/sys-apps/file/files/file-5.39-seccomp-musl.patch b/sys-apps/file/files/file-5.39-seccomp-musl.patch
deleted file mode 100644
index 72836de67e5..00000000000
--- a/sys-apps/file/files/file-5.39-seccomp-musl.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 93c91e2ba8042d499fee168e27cbd526438454c6 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Sat, 5 Sep 2020 17:20:32 +0000
-Subject: [PATCH] PR/194: puchuu: Handle muslc syscalls
-
----
- src/seccomp.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/src/seccomp.c b/src/seccomp.c
-index 68c56485d..db9364ae4 100644
---- a/src/seccomp.c
-+++ b/src/seccomp.c
-@@ -27,7 +27,7 @@
- #include "file.h"
-
- #ifndef lint
--FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
-+FILE_RCSID("@(#)$File: seccomp.c,v 1.17 2020/09/05 17:20:32 christos Exp $")
- #endif /* lint */
-
- #if HAVE_LIBSECCOMP
-@@ -220,12 +220,14 @@ enable_sandbox_full(void)
- ALLOW_RULE(rt_sigreturn);
- ALLOW_RULE(select);
- ALLOW_RULE(stat);
-+ ALLOW_RULE(statx);
- ALLOW_RULE(stat64);
- ALLOW_RULE(sysinfo);
- ALLOW_RULE(umask); // Used in file_pipe2file()
- ALLOW_RULE(getpid); // Used by glibc in file_pipe2file()
- ALLOW_RULE(unlink);
- ALLOW_RULE(write);
-+ ALLOW_RULE(writev);
-
-
- #if 0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2021-06-29 8:29 Lars Wendler
0 siblings, 0 replies; 17+ messages in thread
From: Lars Wendler @ 2021-06-29 8:29 UTC (permalink / raw
To: gentoo-commits
commit: 68e24256a0449b2a27e44879f95171780f21526b
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 29 08:09:10 2021 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Jun 29 08:29:33 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68e24256
sys-apps/file: Fix character count heuristic
This restores behaviour of file-5.39, i.e. correctly identifies small
text files as text/plain rather than application/octet-stream again.
Patch taken from upstream and (trivially) backported to 5.40.
Closes: https://bugs.gentoo.org/799188
Bug: https://bugs.astron.com/view.php?id=261
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/file/file-5.40-r3.ebuild | 147 +++++++++++++++++++++
.../file/files/file-5.40-revert-char-count.patch | 49 +++++++
2 files changed, 196 insertions(+)
diff --git a/sys-apps/file/file-5.40-r3.ebuild b/sys-apps/file/file-5.40-r3.ebuild
new file mode 100644
index 00000000000..7fd5ac3b71b
--- /dev/null
+++ b/sys-apps/file/file-5.40-r3.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+DISTUTILS_OPTIONAL=1
+
+inherit distutils-r1 libtool toolchain-funcs multilib-minimal
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit autotools git-r3
+else
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+DESCRIPTION="identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzma python seccomp static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )
+ seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
+
+PATCHES=(
+ "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
+ "${FILESDIR}/file-5.40-xz_magic.patch" #784773
+ "${FILESDIR}/file-5.40-seccomp-faccessat.patch"
+ "${FILESDIR}/file-5.40-seccomp-fstatat64.patch" #784857
+ "${FILESDIR}/file-5.40-revert-char-count.patch" #799188
+)
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == 9999 ]] ; then
+ eautoreconf
+ fi
+
+ elibtoolize
+
+ # don't let python README kill main README #60043
+ mv python/README.md python/README.python.md || die
+ sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable seccomp libseccomp)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+ tc-env_build econf "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE="${S}"
+
+ if need_build_file ; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ cd src || die
+ emake magic.h #586444
+ emake libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file ; then
+ emake -C "${WORKDIR}"/build/src magic.h #586444
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT README
+
+ # Required for `file -C`
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+ find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/sys-apps/file/files/file-5.40-revert-char-count.patch b/sys-apps/file/files/file-5.40-revert-char-count.patch
new file mode 100644
index 00000000000..9d6f5be60fa
--- /dev/null
+++ b/sys-apps/file/files/file-5.40-revert-char-count.patch
@@ -0,0 +1,49 @@
+From c07e242e766242a44ff720c149b1bdd4924ec247 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 27 Apr 2021 19:37:14 +0000
+Subject: [PATCH] Revert the fix for PR/180. It lead to PR/261. Using character
+ count heuristics ends up with confusing behavior, the following should not be
+ producing different results: echo -n xx | ./file - echo -n xy |
+ ./file -
+
+---
+[patch backported to 5.40 release -- ulm]
+
+ src/encoding.c | 15 ++-------------
+ 1 file changed, 2 insertions(+), 13 deletions(-)
+
+diff --git a/src/encoding.c b/src/encoding.c
+index 31d4d125..3647a481 100644
+--- a/src/encoding.c
++++ b/src/encoding.c
+@@ -265,9 +265,7 @@ private int \
+ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
+ size_t *ulen) \
+ { \
+- size_t i, u; \
+- unsigned char dist[256]; \
+- memset(dist, 0, sizeof(dist)); \
++ size_t i; \
+ \
+ *ulen = 0; \
+ \
+@@ -278,16 +276,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
+ return 0; \
+ \
+ ubuf[(*ulen)++] = buf[i]; \
+- dist[buf[i]]++; \
+ } \
+- u = 0; \
+- for (i = 0; i < __arraycount(dist); i++) { \
+- if (dist[i]) \
+- u++; \
+- } \
+- if (u < 3) \
+- return 0; \
+-\
+ return 1; \
+ }
+
+--
+2.32.0
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2022-08-16 2:30 Sam James
0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2022-08-16 2:30 UTC (permalink / raw
To: gentoo-commits
commit: 253ca90f3f968a03ea6fff8f0011cf411764b22e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 16 02:28:55 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 16 02:29:57 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=253ca90f
sys-apps/file: backport unicode handling fixes to 5.42
Temporarily unkeyworded given I had a few issues before I threw
in a few extra patches. Want to give it a test run for a day
or so myself first before keywording.
Bug: https://bugs.gentoo.org/861089
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/file/file-5.42-r1.ebuild | 162 +++++++++
sys-apps/file/files/file-5.42-unicode-fixes.patch | 414 ++++++++++++++++++++++
2 files changed, 576 insertions(+)
diff --git a/sys-apps/file/file-5.42-r1.ebuild b/sys-apps/file/file-5.42-r1.ebuild
new file mode 100644
index 000000000000..e74d71b49e84
--- /dev/null
+++ b/sys-apps/file/file-5.42-r1.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit distutils-r1 libtool toolchain-funcs multilib-minimal
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit autotools git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
+ inherit verify-sig
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
+
+ #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
+fi
+
+DESCRIPTION="Identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzma python seccomp static-libs zlib"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+ python? ( !dev-python/python-magic )
+ seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
+BDEPEND+="
+ python? (
+ ${PYTHON_DEPS}
+ ${DISTUTILS_DEPS}
+ )"
+
+PATCHES=(
+ "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
+ "${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/${P}-unicode-fixes.patch" #861089
+)
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == 9999 ]] ; then
+ eautoreconf
+ else
+ elibtoolize
+ fi
+
+ # don't let python README kill main README, bug ##60043
+ mv python/README.md python/README.python.md || die
+ # bug #662090
+ sed 's@README.md@README.python.md@' -i python/setup.py || die
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable seccomp libseccomp)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+
+ econf_build "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # when cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions, bug #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE="${S}"
+
+ if need_build_file ; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ # bug #586444
+ emake -C src magic.h
+ emake -C src libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file ; then
+ # bug #586444
+ emake -C "${WORKDIR}"/build/src magic.h
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT # README
+
+ # Required for `file -C`
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+
+ find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/sys-apps/file/files/file-5.42-unicode-fixes.patch b/sys-apps/file/files/file-5.42-unicode-fixes.patch
new file mode 100644
index 000000000000..91c46a358120
--- /dev/null
+++ b/sys-apps/file/files/file-5.42-unicode-fixes.patch
@@ -0,0 +1,414 @@
+https://bugs.gentoo.org/861089
+https://github.com/file/file/commit/19bf47777d0002ee884467e45e6ace702e40a4c1
+https://github.com/file/file/commit/c80065fe6900be5e794941e29b32440e9969b1c3
+https://github.com/file/file/commit/7e59d34206d7c962e093d4239e5367a2cd8b7623
+https://github.com/file/file/commit/f042050f59bfc037677871c4d1037c33273f5213
+https://github.com/file/file/commit/d471022b2772071877895759f209f2c346757a4c
+https://github.com/file/file/commit/441ac2b15508909e82ad467960df4ac0adf9644c
+
+From 19bf47777d0002ee884467e45e6ace702e40a4c1 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 4 Jul 2022 17:00:51 +0000
+Subject: [PATCH] PR/358: Fix width for -f - (jpalus)
+
+---
+ src/file.c | 46 +++++++++++++++++++++++++++++-----------------
+ 2 files changed, 31 insertions(+), 18 deletions(-)
+
+diff --git a/src/file.c b/src/file.c
+index 5300e5af8..bb058ce1e 100644
+--- a/src/file.c
++++ b/src/file.c
+@@ -506,35 +506,47 @@ unwrap(struct magic_set *ms, const char *fn)
+ size_t llen = 0;
+ int wid = 0, cwid;
+ int e = 0;
++ size_t fi = 0, fimax = 100;
++ char **flist = malloc(sizeof(*flist) * fimax);
+
+- if (strcmp("-", fn) == 0) {
++ if (flist == NULL)
++out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
++
++ if (strcmp("-", fn) == 0)
+ f = stdin;
+- wid = 1;
+- } else {
++ else {
+ if ((f = fopen(fn, "r")) == NULL) {
+ file_warn("Cannot open `%s'", fn);
+ return 1;
+ }
+-
+- while ((len = getline(&line, &llen, f)) > 0) {
+- if (line[len - 1] == '\n')
+- line[len - 1] = '\0';
+- cwid = file_mbswidth(ms, line);
+- if (cwid > wid)
+- wid = cwid;
+- }
+-
+- rewind(f);
+ }
+
+ while ((len = getline(&line, &llen, f)) > 0) {
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+- e |= process(ms, line, wid);
++ if (fi >= fimax) {
++ fimax += 100;
++ char **nf = realloc(flist, fimax * sizeof(*flist));
++ if (nf == NULL)
++ goto out;
++ }
++ flist[fi++] = line;
++ cwid = file_mbswidth(ms, line);
++ if (cwid > wid)
++ wid = cwid;
++ line = NULL;
++ llen = 0;
++ }
++
++ fimax = fi;
++ for (fi = 0; fi < fimax; fi++) {
++ e |= process(ms, flist[fi], wid);
++ free(flist[fi]);
+ }
++ free(flist);
+
+- free(line);
+- (void)fclose(f);
++ if (f != stdin)
++ (void)fclose(f);
+ return e;
+ }
+
+
+From c80065fe6900be5e794941e29b32440e9969b1c3 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 4 Jul 2022 19:44:35 +0000
+Subject: [PATCH] PR/362: ro-ee: fix wide char printing
+
+--- a/src/file.c
++++ b/src/file.c
+@@ -60,6 +60,12 @@ FILE_RCSID("@(#)$File: file.c,v 1.196 2022/07/04 17:00:51 christos Exp $")
+ #ifdef HAVE_WCTYPE_H
+ #include <wctype.h>
+ #endif
++#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
++ defined(HAVE_WCTYPE_H)
++#define FILE_WIDE_SUPPORT
++#else
++#include <ctype.h>
++#endif
+
+ #if defined(HAVE_GETOPT_H) && defined(HAVE_STRUCT_OPTION)
+ # include <getopt.h>
+@@ -550,6 +556,55 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
+ return e;
+ }
+
++private void
++file_octal(unsigned char c)
++{
++ putc('\\', stdout);
++ putc(((c >> 6) & 7) + '0', stdout);
++ putc(((c >> 3) & 7) + '0', stdout);
++ putc(((c >> 0) & 7) + '0', stdout);
++}
++
++private void
++fname_print(const char *inname)
++{
++ size_t n = strlen(inname);
++#ifdef FILE_WIDE_SUPPORT
++ mbstate_t state;
++ wchar_t nextchar;
++ size_t bytesconsumed;
++
++
++ (void)mbrlen(NULL, 0, &state);
++ while (n > 0) {
++ bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
++ if (bytesconsumed == CAST(size_t, -1) ||
++ bytesconsumed == CAST(size_t, -2)) {
++ nextchar = *inname;
++ bytesconsumed = 1;
++ }
++ inname += bytesconsumed;
++ n -= bytesconsumed;
++ if (iswprint(nextchar)) {
++ putwc(nextchar, stdout);
++ continue;
++ }
++ /* XXX: What if it is > 255? */
++ file_octal(CAST(unsigned char, nextchar));
++ }
++#else
++ size_t i;
++ for (i = 0; i < n; i++) {
++ unsigned char c = CAST(unsigned char, inname[i]);
++ if (isprint(c)) {
++ putc(c);
++ continue;
++ }
++ file_octal(c);
++ }
++#endif
++}
++
+ /*
+ * Called for each input file on the command line (or in a list of files)
+ */
+@@ -559,15 +614,13 @@ process(struct magic_set *ms, const char *inname, int wid)
+ const char *type, c = nulsep > 1 ? '\0' : '\n';
+ int std_in = strcmp(inname, "-") == 0;
+ int haderror = 0;
+- size_t plen = 4 * wid + 1;
+- char *pbuf, *pname;
+-
+- if ((pbuf = CAST(char *, malloc(plen))) == NULL)
+- file_err(EXIT_FAILURE, "Can't allocate %zu bytes", plen);
+
+ if (wid > 0 && !bflag) {
+- pname = file_printable(ms, pbuf, plen, inname, wid);
+- (void)printf("%s", std_in ? "/dev/stdin" : pname);
++ const char *pname = std_in ? "/dev/stdin" : inname;
++ if ((ms->flags & MAGIC_RAW) == 0)
++ fname_print(pname);
++ else
++ (void)printf("%s", pname);
+ if (nulsep)
+ (void)putc('\0', stdout);
+ if (nulsep < 2) {
+@@ -586,7 +639,6 @@ process(struct magic_set *ms, const char *inname, int wid)
+ }
+ if (nobuffer)
+ haderror |= fflush(stdout) != 0;
+- free(pbuf);
+ return haderror || type == NULL;
+ }
+
+@@ -594,35 +646,33 @@ protected size_t
+ file_mbswidth(struct magic_set *ms, const char *s)
+ {
+ size_t width = 0;
+-#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
+- defined(HAVE_WCTYPE_H)
+- size_t bytesconsumed, old_n, n;
++#ifdef FILE_WIDE_SUPPORT
++ size_t bytesconsumed, n;
+ mbstate_t state;
+ wchar_t nextchar;
+- (void)memset(&state, 0, sizeof(mbstate_t));
+- old_n = n = strlen(s);
++
++ (void)mbrlen(NULL, 0, &state);
++ n = strlen(s);
+
+ while (n > 0) {
+ bytesconsumed = mbrtowc(&nextchar, s, n, &state);
+ if (bytesconsumed == CAST(size_t, -1) ||
+ bytesconsumed == CAST(size_t, -2)) {
+- /* Something went wrong, return something reasonable */
+- return old_n;
++ nextchar = *s;
++ bytesconsumed = 1;
+ }
+ width += ((ms->flags & MAGIC_RAW) != 0
+ || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
+
+ s += bytesconsumed, n -= bytesconsumed;
+ }
+- return width;
+ #else
+ while (*s) {
+ width += (ms->flags & MAGIC_RAW) != 0
+ || isprint(CAST(unsigned char, *s)) ? 1 : 4;
+ }
+-
+- return strlen(s);
+ #endif
++ return width;
+ }
+
+ private void
+--- a/src/file.h
++++ b/src/file.h
+@@ -575,7 +575,7 @@ protected size_t file_pstring_length_size(struct magic_set *,
+ const struct magic *);
+ protected size_t file_pstring_get_length(struct magic_set *,
+ const struct magic *, const char *);
+-public char * file_printable(struct magic_set *, char *, size_t,
++protected char * file_printable(struct magic_set *, char *, size_t,
+ const char *, size_t);
+ #ifdef __EMX__
+ protected int file_os2_apptype(struct magic_set *, const char *, const void *,
+--- a/src/funcs.c
++++ b/src/funcs.c
+@@ -763,7 +763,7 @@ file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb)
+ /*
+ * convert string to ascii printable format.
+ */
+-public char *
++protected char *
+ file_printable(struct magic_set *ms, char *buf, size_t bufsiz,
+ const char *str, size_t slen)
+ {
+
+From 7e59d34206d7c962e093d4239e5367a2cd8b7623 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 4 Jul 2022 20:16:29 +0000
+Subject: [PATCH] Handle invalid characters as octal (idea from PR/363 by
+ dimich)
+
+---
+ src/file.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/file.c b/src/file.c
+index 5e89137d7..af9be0f0c 100644
+--- a/src/file.c
++++ b/src/file.c
+@@ -580,8 +580,11 @@ fname_print(const char *inname)
+ bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
+ if (bytesconsumed == CAST(size_t, -1) ||
+ bytesconsumed == CAST(size_t, -2)) {
+- nextchar = *inname;
+- bytesconsumed = 1;
++ nextchar = *inname++;
++ n--;
++ (void)mbrlen(NULL, 0, &state);
++ file_octal(CAST(unsigned char, nextchar));
++ continue;
+ }
+ inname += bytesconsumed;
+ n -= bytesconsumed;
+@@ -660,9 +663,12 @@ file_mbswidth(struct magic_set *ms, const char *s)
+ bytesconsumed == CAST(size_t, -2)) {
+ nextchar = *s;
+ bytesconsumed = 1;
++ (void)mbrlen(NULL, 0, &state);
++ width += 4;
++ } else {
++ width += ((ms->flags & MAGIC_RAW) != 0
++ || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
+ }
+- width += ((ms->flags & MAGIC_RAW) != 0
+- || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
+
+ s += bytesconsumed, n -= bytesconsumed;
+ }
+
+
+From f042050f59bfc037677871c4d1037c33273f5213 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 4 Jul 2022 22:30:51 +0000
+Subject: [PATCH] mbrlen(NULL, is not portable; revert to using memset to
+ initialize the state.
+
+---
+ src/file.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/file.c b/src/file.c
+index af9be0f0c..8b4f14c2e 100644
+--- a/src/file.c
++++ b/src/file.c
+@@ -575,14 +575,14 @@ fname_print(const char *inname)
+ size_t bytesconsumed;
+
+
+- (void)mbrlen(NULL, 0, &state);
++ (void)memset(&state, 0, sizeof(state));
+ while (n > 0) {
+ bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
+ if (bytesconsumed == CAST(size_t, -1) ||
+ bytesconsumed == CAST(size_t, -2)) {
+ nextchar = *inname++;
+ n--;
+- (void)mbrlen(NULL, 0, &state);
++ (void)memset(&state, 0, sizeof(state));
+ file_octal(CAST(unsigned char, nextchar));
+ continue;
+ }
+@@ -654,7 +654,7 @@ file_mbswidth(struct magic_set *ms, const char *s)
+ mbstate_t state;
+ wchar_t nextchar;
+
+- (void)mbrlen(NULL, 0, &state);
++ (void)memset(&state, 0, sizeof(state));
+ n = strlen(s);
+
+ while (n > 0) {
+@@ -663,7 +663,7 @@ file_mbswidth(struct magic_set *ms, const char *s)
+ bytesconsumed == CAST(size_t, -2)) {
+ nextchar = *s;
+ bytesconsumed = 1;
+- (void)mbrlen(NULL, 0, &state);
++ (void)memset(&state, 0, sizeof(state));
+ width += 4;
+ } else {
+ width += ((ms->flags & MAGIC_RAW) != 0
+
+
+From d471022b2772071877895759f209f2c346757a4c Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 5 Jul 2022 19:53:42 +0000
+Subject: [PATCH] Use printf("%lc") instead of putwc(). Somehow mixing wide and
+ narrow stdio does not work on Linux?
+
+--- a/src/file.c
++++ b/src/file.c
+@@ -589,7 +589,7 @@ fname_print(const char *inname)
+ inname += bytesconsumed;
+ n -= bytesconsumed;
+ if (iswprint(nextchar)) {
+- putwc(nextchar, stdout);
++ printf("%lc", nextchar);
+ continue;
+ }
+ /* XXX: What if it is > 255? */
+
+From 441ac2b15508909e82ad467960df4ac0adf9644c Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 5 Jul 2022 20:05:23 +0000
+Subject: [PATCH] wcwidth is not supposed to return -1 if the character is
+ printable, but it does for 0xff... Prevent it from decreasing the width.
+
+--- a/src/file.c
++++ b/src/file.c
+@@ -666,8 +666,9 @@ file_mbswidth(struct magic_set *ms, const char *s)
+ (void)memset(&state, 0, sizeof(state));
+ width += 4;
+ } else {
++ int w = wcwidth(nextchar);
+ width += ((ms->flags & MAGIC_RAW) != 0
+- || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
++ || iswprint(nextchar)) ? (w > 0 ? w : 1) : 4;
+ }
+
+ s += bytesconsumed, n -= bytesconsumed;
+
+From be1ac8c0aa6d21921012f62582f51a9e546e4972 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Tue, 26 Jul 2022 15:10:05 +0000
+Subject: [PATCH] Fix bug with large flist (Florian Weimer)
+
+---
+ src/file.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/file.c b/src/file.c
+index e169c08fc..c0b8aa197 100644
+--- a/src/file.c
++++ b/src/file.c
+@@ -535,6 +535,7 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
+ char **nf = realloc(flist, fimax * sizeof(*flist));
+ if (nf == NULL)
+ goto out;
++ flist = nf;
+ }
+ flist[fi++] = line;
+ cwid = file_mbswidth(ms, line);
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2022-10-28 19:53 Sam James
0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2022-10-28 19:53 UTC (permalink / raw
To: gentoo-commits
commit: 839a63370d7565fd40cc66956ac86f412f607eee
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 28 19:44:21 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 28 19:50:07 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=839a6337
sys-apps/file: drop 5.42-r1
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/file/Manifest | 2 -
sys-apps/file/file-5.42-r1.ebuild | 162 ---------
sys-apps/file/files/file-5.42-unicode-fixes.patch | 390 ----------------------
3 files changed, 554 deletions(-)
diff --git a/sys-apps/file/Manifest b/sys-apps/file/Manifest
index 7ee7779ca582..ffc539bd9488 100644
--- a/sys-apps/file/Manifest
+++ b/sys-apps/file/Manifest
@@ -1,5 +1,3 @@
DIST file-5.41.tar.gz 1064097 BLAKE2B 56fe8a58d9497bb1bfe3ed6b3ce5df70dd27cc308eb0cfdac8e91ba81c733a96aa622c120ac59079986c6d84901c6f2d82fa24f698d481d7f77e6cfdd432d648 SHA512 bbf2d8e39450b31d0ba8d76d202790fea953775657f942f06e6dc9091798d4a395f7205e542388e4a25b6a4506d07f36c5c4da37cfce0734133e9203a3b00654
-DIST file-5.42.tar.gz 1105846 BLAKE2B c557facb066ae0599db832ddbbc3fed7db2e057faefe832cb4bed8f860b63456217bee39f0c82b17902c3b91426e522681216d2d3ed689501fa00d69a4a09832 SHA512 33c3c339a561c6cf787cc06a16444a971c62068b01827612c948207a9714107b617bed8148cd67e6280cb1c62ad4dfb1205fb8486ea9c042ce7e19b067d3bb05
-DIST file-5.42.tar.gz.asc 195 BLAKE2B 9b930bcd6b98878e60cd72d8d71b40201ebbf3ab1dda7d2b0e3228abdc0c1e21473a012b9799dcac8638ded1bdbe03865c5e41ed4086076a7df6bf6aadbfe29d SHA512 a7105c48f6c671638f5fb7f18f9b193d108456655b4c734208e00aca36fab54dd330ec2fdc3ff29fb78adbc16874af4fb0916c560e50228f82003a8cd258491a
DIST file-5.43.tar.gz 1162786 BLAKE2B aaaf32c5054fb83e912af6656e5e67947f45576ec3711c7cba5531ed780e142a448580e0db41a828c8a3c5d2f1bf0c8ed49bc9688499caaae4a08baa16b3610c SHA512 9d02f4e7a69d90468d6bd35df5ec240ddee8c2408b7df3e73427d7f18736baf77db0638a1fe8283f4e6abd1d5ad653890ed3a5a0d48bb52d4023ca4070ecdf06
DIST file-5.43.tar.gz.asc 195 BLAKE2B d7f83b3e21d1390467989f8870e36daa48ebb8c5ac7ab8dc6d667a65d10561126d32cfc5ef3d81a130990b3e46bcba9b5e03f0a7dd169782351b02cebec2471f SHA512 c565958840f2f5c62821cd08d4149ec97c574232913ec00400473364e160250cfaced8c715e109c4c617359e33d2470f7ca6af1891cbdf994329e890f90c8be3
diff --git a/sys-apps/file/file-5.42-r1.ebuild b/sys-apps/file/file-5.42-r1.ebuild
deleted file mode 100644
index bbde9949d397..000000000000
--- a/sys-apps/file/file-5.42-r1.ebuild
+++ /dev/null
@@ -1,162 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-DISTUTILS_OPTIONAL=1
-PYTHON_COMPAT=( python3_{8..11} )
-
-inherit distutils-r1 libtool toolchain-funcs multilib-minimal
-
-if [[ ${PV} == 9999 ]] ; then
- EGIT_REPO_URI="https://github.com/glensc/file.git"
- inherit autotools git-r3
-else
- VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
- inherit verify-sig
- SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
- SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
-
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
- BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
-fi
-
-DESCRIPTION="Identify a file's format by scanning binary data for patterns"
-HOMEPAGE="https://www.darwinsys.com/file/"
-
-LICENSE="BSD-2"
-SLOT="0"
-IUSE="bzip2 lzma python seccomp static-libs zlib"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
-
-DEPEND="
- bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
- lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
- python? (
- ${PYTHON_DEPS}
- dev-python/setuptools[${PYTHON_USEDEP}]
- )
- zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-RDEPEND="${DEPEND}
- python? ( !dev-python/python-magic )
- seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
-BDEPEND+="
- python? (
- ${PYTHON_DEPS}
- ${DISTUTILS_DEPS}
- )"
-
-PATCHES=(
- "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
- "${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
- "${FILESDIR}/${P}-unicode-fixes.patch" #861089
-)
-
-src_prepare() {
- default
-
- if [[ ${PV} == 9999 ]] ; then
- eautoreconf
- else
- elibtoolize
- fi
-
- # don't let python README kill main README, bug ##60043
- mv python/README.md python/README.python.md || die
- # bug #662090
- sed 's@README.md@README.python.md@' -i python/setup.py || die
-}
-
-multilib_src_configure() {
- local myeconfargs=(
- --enable-fsect-man5
- $(use_enable bzip2 bzlib)
- $(use_enable lzma xzlib)
- $(use_enable seccomp libseccomp)
- $(use_enable static-libs static)
- $(use_enable zlib)
- )
- econf "${myeconfargs[@]}"
-}
-
-build_src_configure() {
- local myeconfargs=(
- --disable-shared
- --disable-libseccomp
- --disable-bzlib
- --disable-xzlib
- --disable-zlib
- )
-
- econf_build "${myeconfargs[@]}"
-}
-
-need_build_file() {
- # when cross-compiling, we need to build up our own file
- # because people often don't keep matching host/target
- # file versions, bug #362941
- tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
-}
-
-src_configure() {
- local ECONF_SOURCE="${S}"
-
- if need_build_file ; then
- mkdir -p "${WORKDIR}"/build || die
- cd "${WORKDIR}"/build || die
- build_src_configure
- fi
-
- multilib-minimal_src_configure
-}
-
-multilib_src_compile() {
- if multilib_is_native_abi ; then
- emake
- else
- # bug #586444
- emake -C src magic.h
- emake -C src libmagic.la
- fi
-}
-
-src_compile() {
- if need_build_file ; then
- # bug #586444
- emake -C "${WORKDIR}"/build/src magic.h
- emake -C "${WORKDIR}"/build/src file
- local -x PATH="${WORKDIR}/build/src:${PATH}"
- fi
-
- multilib-minimal_src_compile
-
- if use python ; then
- cd python || die
- distutils-r1_src_compile
- fi
-}
-
-multilib_src_install() {
- if multilib_is_native_abi ; then
- default
- else
- emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
- fi
-}
-
-multilib_src_install_all() {
- dodoc ChangeLog MAINT # README
-
- # Required for `file -C`
- insinto /usr/share/misc/magic
- doins -r magic/Magdir/*
-
- if use python ; then
- cd python || die
- distutils-r1_src_install
- fi
-
- find "${ED}" -type f -name "*.la" -delete || die
-}
diff --git a/sys-apps/file/files/file-5.42-unicode-fixes.patch b/sys-apps/file/files/file-5.42-unicode-fixes.patch
deleted file mode 100644
index cc6ee7196b49..000000000000
--- a/sys-apps/file/files/file-5.42-unicode-fixes.patch
+++ /dev/null
@@ -1,390 +0,0 @@
-https://bugs.gentoo.org/861089
-https://github.com/file/file/commit/19bf47777d0002ee884467e45e6ace702e40a4c1
-https://github.com/file/file/commit/c80065fe6900be5e794941e29b32440e9969b1c3
-https://github.com/file/file/commit/7e59d34206d7c962e093d4239e5367a2cd8b7623
-https://github.com/file/file/commit/f042050f59bfc037677871c4d1037c33273f5213
-https://github.com/file/file/commit/d471022b2772071877895759f209f2c346757a4c
-https://github.com/file/file/commit/441ac2b15508909e82ad467960df4ac0adf9644c
-
-From 19bf47777d0002ee884467e45e6ace702e40a4c1 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 4 Jul 2022 17:00:51 +0000
-Subject: [PATCH] PR/358: Fix width for -f - (jpalus)
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -506,35 +506,47 @@ unwrap(struct magic_set *ms, const char *fn)
- size_t llen = 0;
- int wid = 0, cwid;
- int e = 0;
-+ size_t fi = 0, fimax = 100;
-+ char **flist = malloc(sizeof(*flist) * fimax);
-
-- if (strcmp("-", fn) == 0) {
-+ if (flist == NULL)
-+out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
-+
-+ if (strcmp("-", fn) == 0)
- f = stdin;
-- wid = 1;
-- } else {
-+ else {
- if ((f = fopen(fn, "r")) == NULL) {
- file_warn("Cannot open `%s'", fn);
- return 1;
- }
--
-- while ((len = getline(&line, &llen, f)) > 0) {
-- if (line[len - 1] == '\n')
-- line[len - 1] = '\0';
-- cwid = file_mbswidth(ms, line);
-- if (cwid > wid)
-- wid = cwid;
-- }
--
-- rewind(f);
- }
-
- while ((len = getline(&line, &llen, f)) > 0) {
- if (line[len - 1] == '\n')
- line[len - 1] = '\0';
-- e |= process(ms, line, wid);
-+ if (fi >= fimax) {
-+ fimax += 100;
-+ char **nf = realloc(flist, fimax * sizeof(*flist));
-+ if (nf == NULL)
-+ goto out;
-+ }
-+ flist[fi++] = line;
-+ cwid = file_mbswidth(ms, line);
-+ if (cwid > wid)
-+ wid = cwid;
-+ line = NULL;
-+ llen = 0;
-+ }
-+
-+ fimax = fi;
-+ for (fi = 0; fi < fimax; fi++) {
-+ e |= process(ms, flist[fi], wid);
-+ free(flist[fi]);
- }
-+ free(flist);
-
-- free(line);
-- (void)fclose(f);
-+ if (f != stdin)
-+ (void)fclose(f);
- return e;
- }
-
-
-From c80065fe6900be5e794941e29b32440e9969b1c3 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 4 Jul 2022 19:44:35 +0000
-Subject: [PATCH] PR/362: ro-ee: fix wide char printing
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -60,6 +60,12 @@ FILE_RCSID("@(#)$File: file.c,v 1.196 2022/07/04 17:00:51 christos Exp $")
- #ifdef HAVE_WCTYPE_H
- #include <wctype.h>
- #endif
-+#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
-+ defined(HAVE_WCTYPE_H)
-+#define FILE_WIDE_SUPPORT
-+#else
-+#include <ctype.h>
-+#endif
-
- #if defined(HAVE_GETOPT_H) && defined(HAVE_STRUCT_OPTION)
- # include <getopt.h>
-@@ -550,6 +556,55 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
- return e;
- }
-
-+private void
-+file_octal(unsigned char c)
-+{
-+ putc('\\', stdout);
-+ putc(((c >> 6) & 7) + '0', stdout);
-+ putc(((c >> 3) & 7) + '0', stdout);
-+ putc(((c >> 0) & 7) + '0', stdout);
-+}
-+
-+private void
-+fname_print(const char *inname)
-+{
-+ size_t n = strlen(inname);
-+#ifdef FILE_WIDE_SUPPORT
-+ mbstate_t state;
-+ wchar_t nextchar;
-+ size_t bytesconsumed;
-+
-+
-+ (void)mbrlen(NULL, 0, &state);
-+ while (n > 0) {
-+ bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
-+ if (bytesconsumed == CAST(size_t, -1) ||
-+ bytesconsumed == CAST(size_t, -2)) {
-+ nextchar = *inname;
-+ bytesconsumed = 1;
-+ }
-+ inname += bytesconsumed;
-+ n -= bytesconsumed;
-+ if (iswprint(nextchar)) {
-+ putwc(nextchar, stdout);
-+ continue;
-+ }
-+ /* XXX: What if it is > 255? */
-+ file_octal(CAST(unsigned char, nextchar));
-+ }
-+#else
-+ size_t i;
-+ for (i = 0; i < n; i++) {
-+ unsigned char c = CAST(unsigned char, inname[i]);
-+ if (isprint(c)) {
-+ putc(c);
-+ continue;
-+ }
-+ file_octal(c);
-+ }
-+#endif
-+}
-+
- /*
- * Called for each input file on the command line (or in a list of files)
- */
-@@ -559,15 +614,13 @@ process(struct magic_set *ms, const char *inname, int wid)
- const char *type, c = nulsep > 1 ? '\0' : '\n';
- int std_in = strcmp(inname, "-") == 0;
- int haderror = 0;
-- size_t plen = 4 * wid + 1;
-- char *pbuf, *pname;
--
-- if ((pbuf = CAST(char *, malloc(plen))) == NULL)
-- file_err(EXIT_FAILURE, "Can't allocate %zu bytes", plen);
-
- if (wid > 0 && !bflag) {
-- pname = file_printable(ms, pbuf, plen, inname, wid);
-- (void)printf("%s", std_in ? "/dev/stdin" : pname);
-+ const char *pname = std_in ? "/dev/stdin" : inname;
-+ if ((ms->flags & MAGIC_RAW) == 0)
-+ fname_print(pname);
-+ else
-+ (void)printf("%s", pname);
- if (nulsep)
- (void)putc('\0', stdout);
- if (nulsep < 2) {
-@@ -586,7 +639,6 @@ process(struct magic_set *ms, const char *inname, int wid)
- }
- if (nobuffer)
- haderror |= fflush(stdout) != 0;
-- free(pbuf);
- return haderror || type == NULL;
- }
-
-@@ -594,35 +646,33 @@ protected size_t
- file_mbswidth(struct magic_set *ms, const char *s)
- {
- size_t width = 0;
--#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH) && \
-- defined(HAVE_WCTYPE_H)
-- size_t bytesconsumed, old_n, n;
-+#ifdef FILE_WIDE_SUPPORT
-+ size_t bytesconsumed, n;
- mbstate_t state;
- wchar_t nextchar;
-- (void)memset(&state, 0, sizeof(mbstate_t));
-- old_n = n = strlen(s);
-+
-+ (void)mbrlen(NULL, 0, &state);
-+ n = strlen(s);
-
- while (n > 0) {
- bytesconsumed = mbrtowc(&nextchar, s, n, &state);
- if (bytesconsumed == CAST(size_t, -1) ||
- bytesconsumed == CAST(size_t, -2)) {
-- /* Something went wrong, return something reasonable */
-- return old_n;
-+ nextchar = *s;
-+ bytesconsumed = 1;
- }
- width += ((ms->flags & MAGIC_RAW) != 0
- || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
-
- s += bytesconsumed, n -= bytesconsumed;
- }
-- return width;
- #else
- while (*s) {
- width += (ms->flags & MAGIC_RAW) != 0
- || isprint(CAST(unsigned char, *s)) ? 1 : 4;
- }
--
-- return strlen(s);
- #endif
-+ return width;
- }
-
- private void
---- a/src/file.h
-+++ b/src/file.h
-@@ -575,7 +575,7 @@ protected size_t file_pstring_length_size(struct magic_set *,
- const struct magic *);
- protected size_t file_pstring_get_length(struct magic_set *,
- const struct magic *, const char *);
--public char * file_printable(struct magic_set *, char *, size_t,
-+protected char * file_printable(struct magic_set *, char *, size_t,
- const char *, size_t);
- #ifdef __EMX__
- protected int file_os2_apptype(struct magic_set *, const char *, const void *,
---- a/src/funcs.c
-+++ b/src/funcs.c
-@@ -763,7 +763,7 @@ file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb)
- /*
- * convert string to ascii printable format.
- */
--public char *
-+protected char *
- file_printable(struct magic_set *ms, char *buf, size_t bufsiz,
- const char *str, size_t slen)
- {
-
-From 7e59d34206d7c962e093d4239e5367a2cd8b7623 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 4 Jul 2022 20:16:29 +0000
-Subject: [PATCH] Handle invalid characters as octal (idea from PR/363 by
- dimich)
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -580,8 +580,11 @@ fname_print(const char *inname)
- bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
- if (bytesconsumed == CAST(size_t, -1) ||
- bytesconsumed == CAST(size_t, -2)) {
-- nextchar = *inname;
-- bytesconsumed = 1;
-+ nextchar = *inname++;
-+ n--;
-+ (void)mbrlen(NULL, 0, &state);
-+ file_octal(CAST(unsigned char, nextchar));
-+ continue;
- }
- inname += bytesconsumed;
- n -= bytesconsumed;
-@@ -660,9 +663,12 @@ file_mbswidth(struct magic_set *ms, const char *s)
- bytesconsumed == CAST(size_t, -2)) {
- nextchar = *s;
- bytesconsumed = 1;
-+ (void)mbrlen(NULL, 0, &state);
-+ width += 4;
-+ } else {
-+ width += ((ms->flags & MAGIC_RAW) != 0
-+ || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
- }
-- width += ((ms->flags & MAGIC_RAW) != 0
-- || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
-
- s += bytesconsumed, n -= bytesconsumed;
- }
-
-
-From f042050f59bfc037677871c4d1037c33273f5213 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Mon, 4 Jul 2022 22:30:51 +0000
-Subject: [PATCH] mbrlen(NULL, is not portable; revert to using memset to
- initialize the state.
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -575,14 +575,14 @@ fname_print(const char *inname)
- size_t bytesconsumed;
-
-
-- (void)mbrlen(NULL, 0, &state);
-+ (void)memset(&state, 0, sizeof(state));
- while (n > 0) {
- bytesconsumed = mbrtowc(&nextchar, inname, n, &state);
- if (bytesconsumed == CAST(size_t, -1) ||
- bytesconsumed == CAST(size_t, -2)) {
- nextchar = *inname++;
- n--;
-- (void)mbrlen(NULL, 0, &state);
-+ (void)memset(&state, 0, sizeof(state));
- file_octal(CAST(unsigned char, nextchar));
- continue;
- }
-@@ -654,7 +654,7 @@ file_mbswidth(struct magic_set *ms, const char *s)
- mbstate_t state;
- wchar_t nextchar;
-
-- (void)mbrlen(NULL, 0, &state);
-+ (void)memset(&state, 0, sizeof(state));
- n = strlen(s);
-
- while (n > 0) {
-@@ -663,7 +663,7 @@ file_mbswidth(struct magic_set *ms, const char *s)
- bytesconsumed == CAST(size_t, -2)) {
- nextchar = *s;
- bytesconsumed = 1;
-- (void)mbrlen(NULL, 0, &state);
-+ (void)memset(&state, 0, sizeof(state));
- width += 4;
- } else {
- width += ((ms->flags & MAGIC_RAW) != 0
-
-
-From d471022b2772071877895759f209f2c346757a4c Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 5 Jul 2022 19:53:42 +0000
-Subject: [PATCH] Use printf("%lc") instead of putwc(). Somehow mixing wide and
- narrow stdio does not work on Linux?
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -589,7 +589,7 @@ fname_print(const char *inname)
- inname += bytesconsumed;
- n -= bytesconsumed;
- if (iswprint(nextchar)) {
-- putwc(nextchar, stdout);
-+ printf("%lc", nextchar);
- continue;
- }
- /* XXX: What if it is > 255? */
-
-From 441ac2b15508909e82ad467960df4ac0adf9644c Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 5 Jul 2022 20:05:23 +0000
-Subject: [PATCH] wcwidth is not supposed to return -1 if the character is
- printable, but it does for 0xff... Prevent it from decreasing the width.
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -666,8 +666,9 @@ file_mbswidth(struct magic_set *ms, const char *s)
- (void)memset(&state, 0, sizeof(state));
- width += 4;
- } else {
-+ int w = wcwidth(nextchar);
- width += ((ms->flags & MAGIC_RAW) != 0
-- || iswprint(nextchar)) ? wcwidth(nextchar) : 4;
-+ || iswprint(nextchar)) ? (w > 0 ? w : 1) : 4;
- }
-
- s += bytesconsumed, n -= bytesconsumed;
-
-From be1ac8c0aa6d21921012f62582f51a9e546e4972 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Tue, 26 Jul 2022 15:10:05 +0000
-Subject: [PATCH] Fix bug with large flist (Florian Weimer)
-
---- a/src/file.c
-+++ b/src/file.c
-@@ -535,6 +535,7 @@ out: file_err(EXIT_FAILURE, "Cannot allocate memory for file list");
- char **nf = realloc(flist, fimax * sizeof(*flist));
- if (nf == NULL)
- goto out;
-+ flist = nf;
- }
- flist[fi++] = line;
- cwid = file_mbswidth(ms, line);
-
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2022-12-31 12:58 Sam James
0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2022-12-31 12:58 UTC (permalink / raw
To: gentoo-commits
commit: 0a43a1114f05d985cef96402cab1451580a6339b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 31 12:51:36 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 31 12:52:10 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a43a111
sys-apps/file: allow faccessat2 syscall in seccomp for sandbox-2.30
Closes: https://bugs.gentoo.org/889046
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../{file-5.43-r1.ebuild => file-5.43-r2.ebuild} | 4 ++--
.../file/{file-5.44.ebuild => file-5.44-r1.ebuild} | 5 ++--
sys-apps/file/file-9999.ebuild | 6 ++---
.../file/files/file-5.43-portage-sandbox.patch | 28 ++++++++++++++++++++++
.../files/file-5.43-seccomp-fstatat64-musl.patch | 22 +++++++++++++++++
sys-apps/file/files/file-5.44-seccomp-utimes.patch | 18 ++++++++++++++
6 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/sys-apps/file/file-5.43-r1.ebuild b/sys-apps/file/file-5.43-r2.ebuild
similarity index 96%
rename from sys-apps/file/file-5.43-r1.ebuild
rename to sys-apps/file/file-5.43-r2.ebuild
index 10bf50a18e4f..610753073aa6 100644
--- a/sys-apps/file/file-5.43-r1.ebuild
+++ b/sys-apps/file/file-5.43-r2.ebuild
@@ -49,8 +49,8 @@ BDEPEND+="
)"
PATCHES=(
- "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
- "${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-portage-sandbox.patch" #713710 #728978
+ "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/${P}-configure-clang16.patch"
)
diff --git a/sys-apps/file/file-5.44.ebuild b/sys-apps/file/file-5.44-r1.ebuild
similarity index 95%
rename from sys-apps/file/file-5.44.ebuild
rename to sys-apps/file/file-5.44-r1.ebuild
index 99d5b362b9c5..c29778951f51 100644
--- a/sys-apps/file/file-5.44.ebuild
+++ b/sys-apps/file/file-5.44-r1.ebuild
@@ -52,9 +52,10 @@ BDEPEND+="
)"
PATCHES=(
- "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
- "${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
"${FILESDIR}/file-5.44-limits-solaris.patch" # applied upstream
+ "${FILESDIR}/file-5.44-seccomp-utimes.patch" # upstream
)
src_prepare() {
diff --git a/sys-apps/file/file-9999.ebuild b/sys-apps/file/file-9999.ebuild
index 81f60050024c..c83ce4f71f81 100644
--- a/sys-apps/file/file-9999.ebuild
+++ b/sys-apps/file/file-9999.ebuild
@@ -18,7 +18,7 @@ else
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi
@@ -52,8 +52,8 @@ BDEPEND+="
)"
PATCHES=(
- "${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
- "${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
)
src_prepare() {
diff --git a/sys-apps/file/files/file-5.43-portage-sandbox.patch b/sys-apps/file/files/file-5.43-portage-sandbox.patch
new file mode 100644
index 000000000000..f9e715cc366f
--- /dev/null
+++ b/sys-apps/file/files/file-5.43-portage-sandbox.patch
@@ -0,0 +1,28 @@
+Allow syscalls for Gentoo's portage sandbox
+
+- Add getcwd (bug #728978)
+- Add faccessat2 (bug #889046)
+
+Bug: https://bugs.gentoo.org/728978
+Bug: https://bugs.gentoo.org/889046
+--- a/src/seccomp.c
++++ b/src/seccomp.c
+@@ -174,6 +174,9 @@ enable_sandbox_full(void)
+ ALLOW_RULE(exit_group);
+ #ifdef __NR_faccessat
+ ALLOW_RULE(faccessat);
++#endif
++#ifdef __NR_faccessat2
++ ALLOW_RULE(faccessat2);
+ #endif
+ ALLOW_RULE(fcntl);
+ ALLOW_RULE(fcntl64);
+@@ -237,6 +240,8 @@ enable_sandbox_full(void)
+ ALLOW_RULE(write);
+ ALLOW_RULE(writev);
+
++ // needed by Gentoo's portage sandbox
++ ALLOW_RULE(getcwd);
+
+ #if 0
+ // needed by valgrind
diff --git a/sys-apps/file/files/file-5.43-seccomp-fstatat64-musl.patch b/sys-apps/file/files/file-5.43-seccomp-fstatat64-musl.patch
new file mode 100644
index 000000000000..a039882ac8d7
--- /dev/null
+++ b/sys-apps/file/files/file-5.43-seccomp-fstatat64-musl.patch
@@ -0,0 +1,22 @@
+From 8c13923a8e17a02be0989649b2edc20124816729 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Tue, 15 Jun 2021 16:08:22 -0400
+Subject: [PATCH] seccomp: undef fstatat64 to avoid build failure on musl
+
+sys/stat.h in musl does this:
+
+ #define fstatat64 fstatat
+
+Counteract this with an #undef.
+
+Bug: https://bugs.gentoo.org/789336
+--- a/src/seccomp.c
++++ b/src/seccomp.c
+@@ -182,6 +182,7 @@ enable_sandbox_full(void)
+ #endif
+ ALLOW_RULE(fstat64);
+ #ifdef __NR_fstatat64
++#undef fstatat64
+ ALLOW_RULE(fstatat64);
+ #endif
+ ALLOW_RULE(futex);
diff --git a/sys-apps/file/files/file-5.44-seccomp-utimes.patch b/sys-apps/file/files/file-5.44-seccomp-utimes.patch
new file mode 100644
index 000000000000..49f1c2e4b739
--- /dev/null
+++ b/sys-apps/file/files/file-5.44-seccomp-utimes.patch
@@ -0,0 +1,18 @@
+https://github.com/file/file/commit/1590a653b520123d47070a47436abfba42d4c943
+
+From 1590a653b520123d47070a47436abfba42d4c943 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 26 Dec 2022 18:57:29 +0000
+Subject: [PATCH] PR/408: SpraxDev: Add utimes to the allow list for -p
+
+--- a/src/seccomp.c
++++ b/src/seccomp.c
+@@ -233,6 +233,7 @@ enable_sandbox_full(void)
+ ALLOW_RULE(umask); // Used in file_pipe2file()
+ ALLOW_RULE(getpid); // Used by glibc in file_pipe2file()
+ ALLOW_RULE(unlink);
++ ALLOW_RULE(utimes);
+ ALLOW_RULE(write);
+ ALLOW_RULE(writev);
+
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2023-08-01 15:42 Sam James
0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-08-01 15:42 UTC (permalink / raw
To: gentoo-commits
commit: 26eb5b45518d15e61fe83c7da08afb749be9f6e6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 1 15:41:21 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 1 15:42:16 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26eb5b45
sys-apps/file: backport 32-bit time_t fix, backport weak shell magic fix
Bug: https://bugs.gentoo.org/908401
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/file/file-5.45-r1.ebuild | 180 +++++++++++++++++++++
.../file/files/file-5.45-32-bit-time_t-deux.patch | 29 ++++
sys-apps/file/files/file-5.45-32-bit-time_t.patch | 34 ++++
.../file/files/file-5.45-weak-magic-shell.patch | 43 +++++
4 files changed, 286 insertions(+)
diff --git a/sys-apps/file/file-5.45-r1.ebuild b/sys-apps/file/file-5.45-r1.ebuild
new file mode 100644
index 000000000000..dfa655148963
--- /dev/null
+++ b/sys-apps/file/file-5.45-r1.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_{10..11} )
+
+inherit distutils-r1 toolchain-funcs multilib-minimal
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/glensc/file.git"
+ inherit autotools git-r3
+else
+ VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
+ inherit autotools verify-sig
+ SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
+ SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
+
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+
+ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
+fi
+
+DESCRIPTION="Identify a file's format by scanning binary data for patterns"
+HOMEPAGE="https://www.darwinsys.com/file/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="bzip2 lzip lzma python seccomp static-libs zlib zstd"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+ bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
+ lzip? ( app-arch/lzlib )
+ lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
+ python? (
+ ${PYTHON_DEPS}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+ seccomp? ( >=sys-libs/libseccomp-2.5.4[${MULTILIB_USEDEP}] )
+ zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
+ zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
+"
+RDEPEND="
+ ${DEPEND}
+ python? ( !dev-python/python-magic )
+ seccomp? ( >=sys-libs/libseccomp-2.5.4[${MULTILIB_USEDEP}] )
+"
+BDEPEND+="
+ python? (
+ ${PYTHON_DEPS}
+ ${DISTUTILS_DEPS}
+ )
+"
+
+# https://bugs.gentoo.org/898676
+QA_CONFIG_IMPL_DECL_SKIP=( makedev )
+
+PATCHES=(
+ "${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
+ "${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
+ "${FILESDIR}/${P}-32-bit-time_t.patch"
+ "${FILESDIR}/${P}-32-bit-time_t-deux.patch"
+ "${FILESDIR}/${P}-weak-magic-shell.patch" #908401
+)
+
+src_prepare() {
+ default
+
+ #if [[ ${PV} == 9999 ]] ; then
+ # eautoreconf
+ #else
+ # elibtoolize
+ #fi
+ # Just for file-5.45-32-bit-time_t-deux.patch, drop in 5.46
+ eautoreconf
+
+ # Don't let python README kill main README, bug #60043
+ mv python/README.md python/README.python.md || die
+
+ # bug #662090
+ sed -i 's@README.md@README.python.md@' python/setup.py || die
+}
+
+multilib_src_configure() {
+ local myeconfargs=(
+ --enable-fsect-man5
+ $(use_enable bzip2 bzlib)
+ $(multilib_native_use_enable lzip lzlib)
+ $(use_enable lzma xzlib)
+ $(use_enable seccomp libseccomp)
+ $(use_enable static-libs static)
+ $(use_enable zlib)
+ $(use_enable zstd zstdlib)
+ )
+
+ econf "${myeconfargs[@]}"
+}
+
+build_src_configure() {
+ local myeconfargs=(
+ --disable-shared
+ --disable-libseccomp
+ --disable-bzlib
+ --disable-xzlib
+ --disable-zlib
+ )
+
+ econf_build "${myeconfargs[@]}"
+}
+
+need_build_file() {
+ # When cross-compiling, we need to build up our own file
+ # because people often don't keep matching host/target
+ # file versions, bug #362941
+ tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
+}
+
+src_configure() {
+ local ECONF_SOURCE="${S}"
+
+ if need_build_file ; then
+ mkdir -p "${WORKDIR}"/build || die
+ cd "${WORKDIR}"/build || die
+ build_src_configure
+ fi
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi ; then
+ emake
+ else
+ # bug #586444
+ emake -C src magic.h
+ emake -C src libmagic.la
+ fi
+}
+
+src_compile() {
+ if need_build_file ; then
+ # bug #586444
+ emake -C "${WORKDIR}"/build/src magic.h
+ emake -C "${WORKDIR}"/build/src file
+ local -x PATH="${WORKDIR}/build/src:${PATH}"
+ fi
+
+ multilib-minimal_src_compile
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_compile
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi ; then
+ default
+ else
+ emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog MAINT # README
+
+ # Required for `file -C`
+ insinto /usr/share/misc/magic
+ doins -r magic/Magdir/*
+
+ if use python ; then
+ cd python || die
+ distutils-r1_src_install
+ fi
+
+ find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/sys-apps/file/files/file-5.45-32-bit-time_t-deux.patch b/sys-apps/file/files/file-5.45-32-bit-time_t-deux.patch
new file mode 100644
index 000000000000..8c1e0934145c
--- /dev/null
+++ b/sys-apps/file/files/file-5.45-32-bit-time_t-deux.patch
@@ -0,0 +1,29 @@
+https://github.com/file/file/commit/8dc5513908381a14981b16a85d59ba054bf4df52
+
+From 8dc5513908381a14981b16a85d59ba054bf4df52 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Mon, 31 Jul 2023 15:56:12 +0000
+Subject: [PATCH] Check if we support _TIME_BITS. (Werner Fink)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -152,6 +152,18 @@ AC_TYPE_UINT64_T
+ AC_TYPE_INT64_T
+ AC_TYPE_INTPTR_T
+ AC_TYPE_UINTPTR_T
++m4_ifdef([AC_SYS_YEAR2038], [AC_SYS_YEAR2038], [
++# GNU libc only allows setting _TIME_BITS when FILE_OFFSET_BITS is also set.
++# GNU libc defines __TIMESIZE on systems where _TIME_BITS can be set.
++AS_IF([test X"$ac_cv_sys_file_offset_bits" = X"64"], [
++ AC_CHECK_DECL(__TIMESIZE, [
++ AC_DEFINE([_TIME_BITS], [64], [Number of bits in a timestamp, on hosts where this is settable.])
++ ], [], [
++AC_INCLUDES_DEFAULT
++#include <time.h>
++ ])
++ ])
++])
+ AC_FUNC_MMAP
+ AC_FUNC_FORK
+ AC_FUNC_MBRTOWC
+
diff --git a/sys-apps/file/files/file-5.45-32-bit-time_t.patch b/sys-apps/file/files/file-5.45-32-bit-time_t.patch
new file mode 100644
index 000000000000..c86a46207e60
--- /dev/null
+++ b/sys-apps/file/files/file-5.45-32-bit-time_t.patch
@@ -0,0 +1,34 @@
+https://mailman.astron.com/pipermail/file/2023-July/001206.html
+https://github.com/file/file/commit/218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1
+
+From 218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Fri, 28 Jul 2023 14:38:25 +0000
+Subject: [PATCH] deal with 32 bit time_t
+
+--- a/src/file.h
++++ b/src/file.h
+@@ -27,7 +27,7 @@
+ */
+ /*
+ * file.h - definitions for file(1) program
+- * @(#)$File: file.h,v 1.247 2023/07/27 19:40:22 christos Exp $
++ * @(#)$File: file.h,v 1.248 2023/07/28 14:38:25 christos Exp $
+ */
+
+ #ifndef __file_h__
+@@ -159,9 +159,11 @@
+ /*
+ * Dec 31, 23:59:59 9999
+ * we need to make sure that we don't exceed 9999 because some libc
+- * implementations like muslc crash otherwise
++ * implementations like muslc crash otherwise. If you are unlucky
++ * to be running on a system with a 32 bit time_t, then it is even less.
+ */
+-#define MAX_CTIME CAST(time_t, 0x3afff487cfULL)
++#define MAX_CTIME \
++ CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
+
+ #define FILE_BADSIZE CAST(size_t, ~0ul)
+ #define MAXDESC 64 /* max len of text description/MIME type */
+
diff --git a/sys-apps/file/files/file-5.45-weak-magic-shell.patch b/sys-apps/file/files/file-5.45-weak-magic-shell.patch
new file mode 100644
index 000000000000..cdcab736b64e
--- /dev/null
+++ b/sys-apps/file/files/file-5.45-weak-magic-shell.patch
@@ -0,0 +1,43 @@
+https://bugs.gentoo.org/908401
+https://bugs.astron.com/view.php?id=457
+https://github.com/file/file/commit/1fc9175166fc5c5117838a1dcfb309b7c595eb56
+
+From 1fc9175166fc5c5117838a1dcfb309b7c595eb56 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Sun, 30 Jul 2023 16:31:47 +0000
+Subject: [PATCH] Comment out weak magic
+
+--- a/magic/Magdir/printer
++++ b/magic/Magdir/printer
+@@ -1,6 +1,6 @@
+
+ #------------------------------------------------------------------------------
+-# $File: printer,v 1.34 2023/06/16 19:27:12 christos Exp $
++# $File: printer,v 1.35 2023/07/30 16:31:47 christos Exp $
+ # printer: file(1) magic for printer-formatted files
+ #
+
+@@ -230,8 +230,9 @@
+ 0 string PS4
+ >0 use hpgl
+ # la.hp
+-0 string BP
+->0 use hpgl
++# Too weak
++#0 string BP
++#>0 use hpgl
+ # miter.hp
+ # Plot Absolute x,y{,x,y{...}}; x and y in range between -32767 and 32768 like: PA4000,3000;
+ 0 string PA
+@@ -241,8 +242,9 @@
+ #>2 regex \^([-]{0,1}[0-9]{1,5}) COORDINATE=%s
+ >>0 use hpgl
+ # pw.hpg number of pens x
+-0 string NP
+->0 use hpgl
++# Too weak
++#0 string NP
++#>0 use hpgl
+ # win_1.hp
+ #0 string \003INCA WHAT_IS_THAT
+ #>0 use hpgl
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2023-10-19 19:08 Mike Gilbert
0 siblings, 0 replies; 17+ messages in thread
From: Mike Gilbert @ 2023-10-19 19:08 UTC (permalink / raw
To: gentoo-commits
commit: 1a8e3a3717ff4d46c6c7b1d356ded751275c531d
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 19 19:05:58 2023 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Oct 19 19:05:58 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a8e3a37
sys-apps/file: seccomp: also allow geteuid and getegid
Bug: https://bugs.gentoo.org/915890
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
.../file/{file-5.45-r2.ebuild => file-5.45-r3.ebuild} | 0
sys-apps/file/files/file-5.45-seccomp-sandbox.patch | 18 +++++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/sys-apps/file/file-5.45-r2.ebuild b/sys-apps/file/file-5.45-r3.ebuild
similarity index 100%
rename from sys-apps/file/file-5.45-r2.ebuild
rename to sys-apps/file/file-5.45-r3.ebuild
diff --git a/sys-apps/file/files/file-5.45-seccomp-sandbox.patch b/sys-apps/file/files/file-5.45-seccomp-sandbox.patch
index 4ae62b5aa947..d5f499d395f5 100644
--- a/sys-apps/file/files/file-5.45-seccomp-sandbox.patch
+++ b/sys-apps/file/files/file-5.45-seccomp-sandbox.patch
@@ -1,4 +1,4 @@
-From 056d8aa6e0a743ff743c60a1fca67126f3dce0b6 Mon Sep 17 00:00:00 2001
+From b05f904dc5df267f90c6489817a379cb7f7f62ee Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Thu, 19 Oct 2023 13:58:20 -0400
Subject: [PATCH] seccomp: allow syscalls used by Gentoo's LD_PRELOAD sandbox
@@ -7,11 +7,11 @@ Bug: https://bugs.gentoo.org/728978
Bug: https://bugs.gentoo.org/889046
Bug: https://bugs.gentoo.org/915890
---
- src/seccomp.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
+ src/seccomp.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
-index 87d4c49e..31954ff4 100644
+index 87d4c49e..f1804660 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -174,6 +174,9 @@ enable_sandbox_full(void)
@@ -24,7 +24,7 @@ index 87d4c49e..31954ff4 100644
#endif
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
-@@ -185,9 +188,18 @@ enable_sandbox_full(void)
+@@ -185,9 +188,26 @@ enable_sandbox_full(void)
ALLOW_RULE(fstatat64);
#endif
ALLOW_RULE(futex);
@@ -33,6 +33,14 @@ index 87d4c49e..31954ff4 100644
#ifdef __NR_getdents64
ALLOW_RULE(getdents64);
+#endif
++ ALLOW_RULE(getegid);
++#ifdef __NR_getegid32
++ ALLOW_RULE(getegid32);
++#endif
++ ALLOW_RULE(geteuid);
++#ifdef __NR_geteuid32
++ ALLOW_RULE(geteuid32);
++#endif
+ ALLOW_RULE(getgid);
+#ifdef __NR_getgid32
+ ALLOW_RULE(getgid32);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
@ 2024-12-27 8:23 Sam James
0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2024-12-27 8:23 UTC (permalink / raw
To: gentoo-commits
commit: 399931f2b988d2c997b5ee974c0a649e53597aa8
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 08:23:18 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 08:23:18 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=399931f2
sys-apps/file: fix detecting zip files
Also, clean up eautoreconf use as a comment asked us to do with 5.46.
Closes: https://bugs.gentoo.org/946957
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../file/{file-9999.ebuild => file-5.46-r1.ebuild} | 20 +++-----
sys-apps/file/file-9999.ebuild | 19 +++-----
sys-apps/file/files/file-5.46-zip.patch | 57 ++++++++++++++++++++++
3 files changed, 72 insertions(+), 24 deletions(-)
diff --git a/sys-apps/file/file-9999.ebuild b/sys-apps/file/file-5.46-r1.ebuild
similarity index 88%
copy from sys-apps/file/file-9999.ebuild
copy to sys-apps/file/file-5.46-r1.ebuild
index 84ced37c5487..592b6a25c65f 100644
--- a/sys-apps/file/file-9999.ebuild
+++ b/sys-apps/file/file-5.46-r1.ebuild
@@ -14,11 +14,11 @@ if [[ ${PV} == 9999 ]] ; then
inherit autotools git-r3
else
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/file.asc
- inherit autotools verify-sig
+ inherit libtool verify-sig
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
- KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi
@@ -60,21 +60,17 @@ QA_CONFIG_IMPL_DECL_SKIP=( makedev )
PATCHES=(
"${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/file-5.45-seccomp-sandbox.patch"
- "${FILESDIR}/${P}-32-bit-time_t.patch"
- "${FILESDIR}/${P}-32-bit-time_t-deux.patch"
- "${FILESDIR}/${P}-weak-magic-shell.patch" #908401
+ "${FILESDIR}/file-5.46-zip.patch"
)
src_prepare() {
default
- #if [[ ${PV} == 9999 ]] ; then
- # eautoreconf
- #else
- # elibtoolize
- #fi
- # Just for file-5.45-32-bit-time_t-deux.patch, drop in 5.46
- eautoreconf
+ if [[ ${PV} == 9999 ]] ; then
+ eautoreconf
+ else
+ elibtoolize
+ fi
# Don't let python README kill main README, bug #60043
mv python/README.md python/README.python.md || die
diff --git a/sys-apps/file/file-9999.ebuild b/sys-apps/file/file-9999.ebuild
index 84ced37c5487..5372c6099bbb 100644
--- a/sys-apps/file/file-9999.ebuild
+++ b/sys-apps/file/file-9999.ebuild
@@ -14,11 +14,11 @@ if [[ ${PV} == 9999 ]] ; then
inherit autotools git-r3
else
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/file.asc
- inherit autotools verify-sig
+ inherit libtool verify-sig
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
- KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
fi
@@ -60,21 +60,16 @@ QA_CONFIG_IMPL_DECL_SKIP=( makedev )
PATCHES=(
"${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
"${FILESDIR}/file-5.45-seccomp-sandbox.patch"
- "${FILESDIR}/${P}-32-bit-time_t.patch"
- "${FILESDIR}/${P}-32-bit-time_t-deux.patch"
- "${FILESDIR}/${P}-weak-magic-shell.patch" #908401
)
src_prepare() {
default
- #if [[ ${PV} == 9999 ]] ; then
- # eautoreconf
- #else
- # elibtoolize
- #fi
- # Just for file-5.45-32-bit-time_t-deux.patch, drop in 5.46
- eautoreconf
+ if [[ ${PV} == 9999 ]] ; then
+ eautoreconf
+ else
+ elibtoolize
+ fi
# Don't let python README kill main README, bug #60043
mv python/README.md python/README.python.md || die
diff --git a/sys-apps/file/files/file-5.46-zip.patch b/sys-apps/file/files/file-5.46-zip.patch
new file mode 100644
index 000000000000..d15d49459165
--- /dev/null
+++ b/sys-apps/file/files/file-5.46-zip.patch
@@ -0,0 +1,57 @@
+https://bugs.gentoo.org/946957
+https://bugs.astron.com/view.php?id=571
+https://github.com/file/file/commit/60b2032b96fc185b37fb0f2152e834efb2edad6e
+
+From 60b2032b96fc185b37fb0f2152e834efb2edad6e Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Thu, 5 Dec 2024 19:41:12 +0000
+Subject: [PATCH] PR/571: jschleus: Some zip files are misclassified as data
+
+---
+ magic/Magdir/archive | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/magic/Magdir/archive b/magic/Magdir/archive
+index e6ff4570a..e560523cb 100644
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1795,6 +1795,17 @@
+ !:ext zip/cbz
+
+
++# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
++# Next line excludes specialized formats:
++0 name zipgeneric
++>4 beshort x Zip archive data, at least
++!:mime application/zip
++>4 use zipversion
++>4 beshort x to extract
++>8 beshort x \b, compression method=
++>8 use zipcompression
++>0x161 string WINZIP \b, WinZIP self-extracting
++
+ 0 string PK\003\004
+ !:strength +1
+ # IOS/IPadOS IPA file (Zip archive)
+@@ -2132,17 +2143,11 @@
+ >>>>>>(-6.l) search/9000 kmp.json Keyman Compiled Package File
+ !:mime application/vnd.keyman.kmp+zip
+ !:ext kmp
++>>>>>+4 default x
++>>>>>>0 use zipgeneric
+
+-# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+-# Next line excludes specialized formats:
+ >>>>+4 default x
+->>>>>4 beshort x Zip archive data, at least
+-!:mime application/zip
+->>>>>4 use zipversion
+->>>>>4 beshort x to extract
+->>>>>8 beshort x \b, compression method=
+->>>>>8 use zipcompression
+->>>>>0x161 string WINZIP \b, WinZIP self-extracting
++>>>>>0 use zipgeneric
+
+ # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+ 0 string PK\005\006 Zip archive data (empty)
+
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-12-27 8:24 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 2:30 [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-12-27 8:23 Sam James
2023-10-19 19:08 Mike Gilbert
2023-08-01 15:42 Sam James
2022-12-31 12:58 Sam James
2022-10-28 19:53 Sam James
2021-06-29 8:29 Lars Wendler
2021-04-25 18:13 Mike Gilbert
2021-04-21 9:42 Lars Wendler
2020-06-28 2:10 Georgy Yakovlev
2020-06-15 8:09 Lars Wendler
2020-04-12 23:28 Thomas Deutschmann
2018-07-24 8:58 Lars Wendler
2018-06-12 8:18 Thomas Deutschmann
2016-10-25 20:27 Lars Wendler
2016-08-10 9:49 Mike Frysinger
2016-04-21 20:30 Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox