diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-04-21 16:29:20 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-04-21 16:29:32 -0400 |
commit | c540f9ea27b6c6e14481b3364d6193862a3377b1 (patch) | |
tree | c82d8f86c49fbac157bfd4682235998b40dc076b /sys-apps | |
parent | dev-games/aseprite: Grant maintainership to proxy maintainer. (diff) | |
download | gentoo-c540f9ea27b6c6e14481b3364d6193862a3377b1.tar.gz gentoo-c540f9ea27b6c6e14481b3364d6193862a3377b1.tar.bz2 gentoo-c540f9ea27b6c6e14481b3364d6193862a3377b1.zip |
sys-apps/file: add a bunch of upstream fixes
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/file/file-5.26-r1.ebuild (renamed from sys-apps/file/file-5.26.ebuild) | 11 | ||||
-rw-r--r-- | sys-apps/file/file-9999.ebuild | 10 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-compress-1.patch | 53 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-compress-2.patch | 73 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-header-define.patch | 26 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-msoffice-magic.patch | 45 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-nes-magic.patch | 27 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-php-magic.patch | 28 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-stdin-rpm.patch | 27 | ||||
-rw-r--r-- | sys-apps/file/files/file-5.26-stdin-test.patch | 132 | ||||
-rw-r--r-- | 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 index 594df4a55a91..ff3216a00194 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 88b9d2e8c5d9..5aa9298bfd41 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 000000000000..b10bfd21a32b --- /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 000000000000..d27656f7fec8 --- /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 + diff --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 000000000000..349614f8c930 --- /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 000000000000..a43d3f16dd91 --- /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 000000000000..0cc43b0f3d61 --- /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 000000000000..310af1b6e05d --- /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 000000000000..7ba5072daf1a --- /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 000000000000..85e59a5dced8 --- /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 000000000000..29c9338e9b6b --- /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 + |