From b4efe8613f1150a333c2c7078715c2ae0c29d87704cb3d0fcea267a4b57c0589 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Wed, 1 Jun 2016 10:23:07 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=139 --- file-5.17-option.dif | 14 ++-- file-5.26-console.diff | 11 --- file-5.26-downgrade_DER.patch | 130 ---------------------------------- file-5.26-version.patch | 55 -------------- file-5.26-zmagic.patch | 41 ----------- file-5.26.dif | 13 +--- file-5.26.tar.gz | 3 - file-5.27.tar.gz | 3 + file.changes | 21 ++++++ file.spec | 13 +--- python-magic.spec | 2 +- python3-magic.spec | 2 +- 12 files changed, 39 insertions(+), 269 deletions(-) delete mode 100644 file-5.26-console.diff delete mode 100644 file-5.26-downgrade_DER.patch delete mode 100644 file-5.26-version.patch delete mode 100644 file-5.26-zmagic.patch delete mode 100644 file-5.26.tar.gz create mode 100644 file-5.27.tar.gz diff --git a/file-5.17-option.dif b/file-5.17-option.dif index 7877830..7948c52 100644 --- a/file-5.17-option.dif +++ b/file-5.17-option.dif @@ -1,6 +1,10 @@ +--- + src/file.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + --- src/file.c -+++ src/file.c 2014-02-18 08:50:59.990452075 +0000 -@@ -198,6 +198,8 @@ main(int argc, char *argv[]) ++++ src/file.c 2016-06-01 10:13:21.169126906 +0000 +@@ -225,6 +225,8 @@ main(int argc, char *argv[]) flags |= MAGIC_ERROR; break; case 'e': @@ -9,7 +13,7 @@ for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++) if (strcmp(nv[i].name, optarg) == 0) break; -@@ -209,7 +211,7 @@ main(int argc, char *argv[]) +@@ -236,7 +238,7 @@ main(int argc, char *argv[]) break; case 'f': @@ -18,7 +22,7 @@ usage(); if (magic == NULL) if ((magic = load(magicfile, flags)) == NULL) -@@ -218,6 +220,8 @@ main(int argc, char *argv[]) +@@ -246,6 +248,8 @@ main(int argc, char *argv[]) ++didsomefiles; break; case 'F': @@ -27,7 +31,7 @@ separator = optarg; break; case 'i': -@@ -230,6 +234,8 @@ main(int argc, char *argv[]) +@@ -258,6 +262,8 @@ main(int argc, char *argv[]) action = FILE_LIST; break; case 'm': diff --git a/file-5.26-console.diff b/file-5.26-console.diff deleted file mode 100644 index 534d370..0000000 --- a/file-5.26-console.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- file-5.26/magic/Magdir/console.old 2016-03-23 16:29:20.000000000 +0100 -+++ file-5.26/magic/Magdir/console 2016-04-18 21:33:02.279350392 +0200 -@@ -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 diff --git a/file-5.26-downgrade_DER.patch b/file-5.26-downgrade_DER.patch deleted file mode 100644 index dfb459a..0000000 --- a/file-5.26-downgrade_DER.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 20c59ad54afc7427ea680f84c8ee5a576ba54b08 Mon Sep 17 00:00:00 2001 -From: Christos Zoulas -Date: Mon, 18 Apr 2016 15:10:34 +0000 -Subject: [PATCH] Downgrade DER comparison and offset lookup failures to be - handled as match failures. - ---- - softmagic.c | 58 +++++++++++++++++++++++++++++++++++++++------------------- - 1 file changed, 39 insertions(+), 19 deletions(-) - -diff --git src/softmagic.c src/softmagic.c -index 14a8bc5..5b5f0f9 100644 ---- src/softmagic.c -+++ 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.6.6 - diff --git a/file-5.26-version.patch b/file-5.26-version.patch deleted file mode 100644 index d156b7e..0000000 --- a/file-5.26-version.patch +++ /dev/null @@ -1,55 +0,0 @@ -On Apr 17, 12:37pm, Jens.Schleusener@t-online.de ("Schleusener, Jens") wrote: --- Subject: Re: file 5.26 is now available - -| Hi Christos, -| -| > File 5.26 is now available from: -| > -| > ftp://ftp.astron.com/pub/file/file-5.26.tar.gz -| -| I just compiled and installed the new version but found that "file" has at -| least now problems with PHP files. -| -| Calling "file" for e.g. for the file wordpress/wp-admin/about.php of -| the tarball wordpress-4.5.tar.gz I got the following results: -| -| file 5.26: , version . -| -| file 5.25: PHP script, ASCII text, with very long lines -| -| Checking other PHP files (also from other packages) I got mostly similar -| results. In very rare cases "file 5.26" issues correctly as before "PHP -| script, ASCII text", in some rare other cases incorrectly "C++ source, -| ASCII text" instead of the correct "PHP script, ASCII text". -| -| No idea if I did something wrong or it's a bug. -| -| Regards -| -| Jens -| -| P.S.: Just for info: The above mentioned "arbitrary" file is directly -| available for e.g. under -| -| http://fossies.org/linux/www/wordpress-4.5.tar.gz/wordpress/wp-admin/about.php?m=b - -Unfortunately some new magic is problematic; here's a patch. - -christo - -Index: commands -=================================================================== -RCS file: /p/file/cvsroot/file/magic/Magdir/commands,v -retrieving revision 1.53 -diff -u -u -r1.53 commands ---- file-5.26/magic/Magdir/commands 23 Feb 2016 12:35:20 -0000 1.53 -+++ file-5.26/magic/Magdir/commands 17 Apr 2016 13:51:29 -0000 -@@ -101,7 +101,7 @@ - 0 string =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 diff --git a/file-5.26-zmagic.patch b/file-5.26-zmagic.patch deleted file mode 100644 index f98e5fc..0000000 --- a/file-5.26-zmagic.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- - src/compress.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- file-5.26/src/compress.c -+++ file-5.26/src/compress.c 2016-04-19 11:44:03.297654887 +0200 -@@ -231,9 +231,9 @@ file_zmagic(struct magic_set *ms, int fd - 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,16 @@ file_zmagic(struct magic_set *ms, int fd - } - if (!mime && file_printf(ms, ")") == -1) - goto error; -- goto out; - case NODATA: -- goto out; -+ break; - default: -- abort(); -+ error: -+ rv = -1; -+ break; - } - } --out: -- rv = 1; --error: -+ DPRINTF("rv = %d\n", rv); -+ - #ifdef HAVE_SIGNAL_H - (void)signal(SIGPIPE, osigpipe); - #endif diff --git a/file-5.26.dif b/file-5.26.dif index 916ae20..d77ac57 100644 --- a/file-5.26.dif +++ b/file-5.26.dif @@ -7,8 +7,7 @@ magic/Makefile.in | 60 +++++++++------ src/Makefile.am | 2 src/dcore.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/magic.h.in | 1 - 9 files changed, 312 insertions(+), 66 deletions(-) + 8 files changed, 311 insertions(+), 66 deletions(-) --- magic/Magdir/elf +++ magic/Magdir/elf 2016-04-18 11:59:52.349157805 +0000 @@ -580,13 +579,3 @@ + exit(0); +} + ---- src/magic.h.in -+++ src/magic.h.in 2016-04-18 12:56:55.450019121 +0000 -@@ -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 *); diff --git a/file-5.26.tar.gz b/file-5.26.tar.gz deleted file mode 100644 index de7bc90..0000000 --- a/file-5.26.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2ef32b4ec936b0ff7b59a021dce56086a716663b6df1138c7ea597d396bf50cf -size 773061 diff --git a/file-5.27.tar.gz b/file-5.27.tar.gz new file mode 100644 index 0000000..6427022 --- /dev/null +++ b/file-5.27.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2e7d509b1167c4915901ecd257ee924d229a348bf988df6d1934ef0fa34a1a7 +size 774063 diff --git a/file.changes b/file.changes index 1c1ab2d..33fde55 100644 --- a/file.changes +++ b/file.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Wed Jun 1 10:17:08 UTC 2016 - werner@suse.de + +- Update to file version 5.27 + * Errors comparing DER entries or computing offsets + are just indications of malformed non-DER files. + Don't print them. + * Offset comparison was off-by-one. + * Fix compression code (Werner Fink) + * Put new bytes constant in the right file (not the generated one) +- Remove patches + file-5.26-version.patch + file-5.26-downgrade_DER.patch + file-5.26-console.diff + file-5.26-zmagic.patch + as now upstream +- Disable patch file-5.26-revert-close.patch for test +- Modify patches + file-5.17-option.dif + file-5.26.dif + ------------------------------------------------------------------- Wed Apr 20 07:14:15 UTC 2016 - werner@suse.de diff --git a/file.spec b/file.spec index 32cd9f2..21eb87b 100644 --- a/file.spec +++ b/file.spec @@ -32,7 +32,7 @@ Obsoletes: file-64bit %endif # # Set Version also in python-magic.spec -Version: 5.26 +Version: 5.27 Release: 0 Summary: A Tool to Determine File Types License: BSD-2-Clause @@ -63,10 +63,7 @@ Patch34: file-5.23-endian.patch Patch35: file-5.24-nitpick.dif Patch36: file-5.15-clear-invalid.patch Patch37: file-secure_getenv.patch -Patch38: file-5.26-version.patch -Patch39: file-5.26-downgrade_DER.patch -Patch40: file-5.26-console.diff -Patch41: file-5.26-zmagic.patch +## Currently disabled for 5.27 to test without Patch42: file-5.26-revert-close.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc @@ -132,11 +129,7 @@ to develop applications that require the magic "file" interface. %patch35 -p0 -b .nitpick %patch36 -p1 -b .clear %patch37 -p1 -b .getenv -%patch38 -p1 -b .php -%patch39 -p0 -b .DER -%patch40 -p1 -b .cons -%patch41 -p1 -b .zmag -%patch42 -p0 -b .stdin -R +##%patch42 -p0 -b .stdin -R %patch -b .0 test -s src/magic.h.in || cp -p src/magic.h src/magic.h.in rm -fv src/magic.h diff --git a/python-magic.spec b/python-magic.spec index 6fe1f4f..336a3e8 100644 --- a/python-magic.spec +++ b/python-magic.spec @@ -28,7 +28,7 @@ BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: zlib-devel Url: http://www.darwinsys.com/file/ -Version: 5.26 +Version: 5.27 Release: 0 Summary: Python module to use libmagic License: BSD-3-Clause and BSD-4-Clause diff --git a/python3-magic.spec b/python3-magic.spec index 678ea53..a553a6a 100644 --- a/python3-magic.spec +++ b/python3-magic.spec @@ -28,7 +28,7 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: zlib-devel Url: http://www.darwinsys.com/file/ -Version: 5.26 +Version: 5.27 Release: 0 Summary: Python module to use libmagic License: BSD-3-Clause and BSD-4-Clause