diff -Nru file-5.28/ChangeLog file-5.29/ChangeLog --- file-5.28/ChangeLog 2016-06-13 23:43:18.000000000 +0000 +++ file-5.29/ChangeLog 2016-10-25 14:39:43.000000000 +0000 @@ -1,3 +1,32 @@ +2016-10-25 10:40 Christos Zoulas + + * release 5.28 + +2016-10-24 11:20 Christos Zoulas + + * der getlength overflow (Jonas Wagner) + * multiple magic file load failure (Christoph Biedl) + +2016-10-17 11:26 Christos Zoulas + + * CDF parsing improvements (Guy Helmer) + +2016-07-20 7:26 Christos Zoulas + + * Add support for signed indirect offsets + +2016-07-18 7:41 Christos Zoulas + + * cat /dev/null | file - should print empty (Christoph Biedl) + +2016-07-05 15:20 Christos Zoulas + + * Bump string size from 64 to 96. + +2016-06-13 20:20 Christos Zoulas + + * PR/556: Fix separators on annotations. + 2016-06-13 19:40 Christos Zoulas * release 5.28 diff -Nru file-5.28/config.guess file-5.29/config.guess --- file-5.28/config.guess 2016-06-13 23:44:06.000000000 +0000 +++ file-5.29/config.guess 2016-10-25 14:40:27.000000000 +0000 @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2015-03-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,20 +168,27 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -182,6 +204,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -198,7 +227,11 @@ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` @@ -302,7 +335,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -560,8 +593,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -801,10 +835,13 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -852,21 +889,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -879,59 +916,57 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -950,54 +985,63 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1201,6 +1245,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,19 +1274,31 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1256,7 +1315,7 @@ NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,157 +1389,6 @@ exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. @@ -26,11 +20,12 @@ # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -73,9 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -156,7 +149,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,21 +252,24 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -287,23 +283,26 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -314,6 +313,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,7 +328,10 @@ c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -370,26 +373,28 @@ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -403,18 +408,22 @@ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -432,6 +441,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -508,6 +518,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -769,6 +782,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -788,11 +804,15 @@ basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -820,6 +840,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -828,7 +852,7 @@ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -1019,7 +1043,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,29 +1374,29 @@ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1492,9 +1520,6 @@ -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1543,6 +1568,12 @@ c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; tic54x-*) os=-coff ;; diff -Nru file-5.28/configure file-5.29/configure --- file-5.28/configure 2016-06-13 23:44:05.000000000 +0000 +++ file-5.29/configure 2016-10-25 14:40:26.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.28. +# Generated by GNU Autoconf 2.69 for file 5.29. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.28' -PACKAGE_STRING='file 5.28' +PACKAGE_VERSION='5.29' +PACKAGE_STRING='file 5.29' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1328,7 +1328,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.28 to adapt to many kinds of systems. +\`configure' configures file 5.29 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.28:";; + short | recursive ) echo "Configuration of file 5.29:";; esac cat <<\_ACEOF @@ -1509,7 +1509,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.28 +file configure 5.29 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2165,7 +2165,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.28, which was +It was created by file $as_me 5.29, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3031,7 +3031,7 @@ # Define the identity of the package. PACKAGE='file' - VERSION='5.28' + VERSION='5.29' cat >>confdefs.h <<_ACEOF @@ -15075,7 +15075,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.28, which was +This file was extended by file $as_me 5.29, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15141,7 +15141,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.28 +file config.status 5.29 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru file-5.28/configure.ac file-5.29/configure.ac --- file-5.28/configure.ac 2016-06-13 23:40:14.000000000 +0000 +++ file-5.29/configure.ac 2016-10-25 14:39:16.000000000 +0000 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.28],[christos@astron.com]) +AC_INIT([file],[5.29],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff -Nru file-5.28/debian/changelog file-5.29/debian/changelog --- file-5.28/debian/changelog 2016-07-15 13:35:30.000000000 +0000 +++ file-5.29/debian/changelog 2016-12-13 15:06:43.000000000 +0000 @@ -1,10 +1,50 @@ -file (1:5.28-2ubuntu1) yakkety; urgency=medium +file (1:5.29-2) unstable; urgency=medium - * Merge from Debian unstable. Remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. + * Include all upstream commits since the 5.29 release. Addresses: + - Detect compiled YARA rules. Closes: #833872 + - Detect old Word for Mac documents. Closes: #842117 + * Disable detection of Algol68 files, way too many false positives + + -- Christoph Biedl Tue, 13 Dec 2016 16:06:43 +0100 + +file (1:5.29-1) unstable; urgency=medium + + * New upstream version 5.29. Addresses (in order of appearance): + - "no read permission" if read from empty pipe. Closes: #508963 + - Mistakes hungarian text as dos executables. Closes: #641012 + - Does not recognize some GPG key public rings. Closes: #729286 + - Show more information for MySQL files. Closes: #751826 + - Linux kernel version string truncated. Closes: #756949 + - Document file's '-d' option. Closes: #764462 + - Detect JPEG-XR. Closes: #771303 + - Detect Material exchange container format (mxf). Closes: #782744 + - Strengthen detection of Embedded OpenType (EOT). Closes: #784572 + - Mistakes some text as bitmap. Closes: #799352 + - Dectect swp files from nano, vim, and kate. Closes: #803219 + - Mistakes some SVG files as HTML. Closes: #829199 + * Fix FTCBFS: Remove stage1 profile in favour of a proper arch/indep + split. Thanks Helmut Grohne. Closes: #841030 + + -- Christoph Biedl Tue, 25 Oct 2016 21:09:24 +0200 + +file (1:5.28-4) unstable; urgency=low + + * Ship the compiled magic file in a separate package so libmagic1 is + finally multi-arch compliant. Thanks Jakub Wilk for the final + impetus and suggestions. Closes: #670006 (take two) + * Declare compliance with Debian policy 3.9.8 + + -- Christoph Biedl Thu, 21 Jul 2016 21:42:43 +0200 + +file (1:5.28-3) unstable; urgency=low + + * Packaging cleanup, no code changes + - No longer ship file-dbg, use -dbgsym instead + - Remove cruft: lintian override, obsolete substvars, explicit + usage of xz + - Re-word package descriptions - -- Marc Deslauriers Fri, 15 Jul 2016 09:34:33 -0400 + -- Christoph Biedl Sun, 17 Jul 2016 14:03:33 +0200 file (1:5.28-2) unstable; urgency=high @@ -22,14 +62,6 @@ -- Christoph Biedl Mon, 27 Jun 2016 16:10:45 +0200 -file (1:5.25-2ubuntu1) xenial; urgency=medium - - * Merge from Debian unstable. Remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. - - -- Marc Deslauriers Fri, 20 Nov 2015 08:44:40 -0500 - file (1:5.25-2) unstable; urgency=medium * Fix --mime-encoding. Closes: #799690 @@ -65,19 +97,6 @@ -- Christoph Biedl Fri, 04 Sep 2015 18:56:25 +0200 -file (1:5.22+15-2ubuntu1) wily; urgency=medium - - * Merge from Debian unstable. Remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. - * Dropped patches included in new version: - - debian/patches/CVE-2014-3710.patch - - debian/patches/CVE-2014-8116.patch - - debian/patches/CVE-2014-8117.patch - - debian/patches/pr398-truncate-pascal-strings.patch - - -- Marc Deslauriers Thu, 21 May 2015 08:33:43 -0400 - file (1:5.22+15-2) unstable; urgency=medium * Restore detection of some jpeg files. Closes: #780095 @@ -120,39 +139,6 @@ -- Christoph Biedl Sun, 09 Nov 2014 14:46:05 +0100 -file (1:5.20-1ubuntu2) vivid; urgency=medium - - * SECURITY UPDATE: DoS via insufficient note headers - - debian/patches/CVE-2014-3710.patch: handle running out of not headers - in src/readelf.c. - - CVE-2014-3710 - * SECURITY UPDATE: DoS in ELF parser - - debian/patches/CVE-2014-8116.patch: limit number of headers and - capabilities in src/elfclass.h, src/readelf.c. - - CVE-2014-8116 - * SECURITY UPDATE: DoS via missing recursion limits - - debian/patches/CVE-2014-8117.patch: lower recursion level and allow - it to be set from the command line in src/apprentice.c, src/file.c, - src/file.h, src/file_opts.h, src/funcs.c, src/magic.c, - src/magic.h.in, src/softmagic.c, add new option to documentation in - doc/file.man, doc/libmagic.man. - - CVE-2014-8117 - * SECURITY UPDATE: DoS via long pascal strings - - debian/patches/pr398-truncate-pascal-strings.patch: correctly - calculate size in src/softmagic.c. - - No CVE number - * debian/libmagic1.symbols: added new symbols - - -- Marc Deslauriers Tue, 27 Jan 2015 08:28:35 -0500 - -file (1:5.20-1ubuntu1) vivid; urgency=low - - * Merge from Debian unstable. Remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. - - -- Michael Vogt Thu, 30 Oct 2014 15:02:08 +0100 - file (1:5.20-1) unstable; urgency=low * New upstream version 5.20. Addresses: @@ -169,24 +155,6 @@ -- Christoph Biedl Sun, 07 Sep 2014 19:01:36 +0200 -file (1:5.19-1ubuntu1.1) utopic-security; urgency=medium - - * SECURITY UPDATE: buffer underflow in CDF file identification - - debian/patches/CVE-2014-3587.patch: modify src/cdf.c to detect and - abort on buffer underflows. - - CVE-2014-3587 - - -- Seth Arnold Wed, 27 Aug 2014 23:29:53 -0700 - -file (1:5.19-1ubuntu1) utopic; urgency=medium - - * Merge with Debian; remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. - - Recognize python3.4 byte code. - - -- Marc Deslauriers Thu, 10 Jul 2014 10:58:30 -0400 - file (1:5.19-1) unstable; urgency=low * New upstream version 5.19. Addresses: @@ -196,18 +164,6 @@ -- Christoph Biedl Mon, 16 Jun 2014 15:27:40 +0000 -file (1:5.18-1ubuntu1) utopic; urgency=medium - - * Merge with Debian; remaining changes: - - Adjust python build dependencies for cross builds. - - Allow the package to cross-build. - - Recognize python3.4 byte code. - * Dropped upstreamed patches: - - debian/patches/CVE-2014-2270.patch - - debian/patches/CVE-2013-1943.patch - - -- Marc Deslauriers Wed, 14 May 2014 14:53:15 -0400 - file (1:5.18-1) unstable; urgency=low * Support profile build (without python). Closes: #709558, #720655 @@ -273,34 +229,6 @@ -- Christoph Biedl Fri, 14 Feb 2014 00:29:32 +0100 -file (1:5.14-2ubuntu3) trusty; urgency=medium - - * SECURITY UPDATE: denial of service via crafted offset in PE executable - - debian/patches/CVE-2014-2270.patch: check bounds in src/softmagic.c. - - CVE-2014-2270 - - -- Marc Deslauriers Thu, 03 Apr 2014 13:27:40 -0400 - -file (1:5.14-2ubuntu2) trusty; urgency=medium - - * SECURITY UPDATE: denial of service via crafted indirect offset value - - debian/patches/CVE-2013-1943.patch: properly handle recursion in - src/ascmagic.c, src/file.h, src/funcs.c, src/softmagic.c. - - CVE-2013-1943 - - -- Marc Deslauriers Mon, 24 Feb 2014 11:23:34 -0500 - -file (1:5.14-2ubuntu1) trusty; urgency=low - - * Merge with Debian; remaining changes: - - Adjust python build dependencies for cross builds. - - Make python-magic a binary indep package. - - Allow the package to cross-build. - * Recognize python3.4 byte code. - * Build using dh-autoreconf. - - -- Matthias Klose Fri, 06 Dec 2013 21:42:48 +0100 - file (1:5.14-2) unstable; urgency=high * Eliminate global variable to fix segfault (Closes: #708281). @@ -417,63 +345,6 @@ -- Judit Foglszinger Fri, 13 Jul 2012 20:37:33 +0000 -file (5.11-2ubuntu4) raring; urgency=low - - * debian/rules: Remove the override_dh_strip target. - - -- Matthias Klose Wed, 06 Mar 2013 21:26:02 +0800 - -file (5.11-2ubuntu3) raring; urgency=low - - * Adjust python build dependencies for cross builds. - * Make python-magic a binary indep package, stop building python-magic-dbg. - - -- Matthias Klose Wed, 06 Mar 2013 20:25:25 +0800 - -file (5.11-2ubuntu2) raring; urgency=low - - * Allow the package to cross-build. - * Configure with --disable-silent-rules. - - -- Matthias Klose Wed, 06 Mar 2013 18:05:17 +0800 - -file (5.11-2ubuntu1) raring; urgency=low - - * Build a python3-magic package. Closes: #695259. - * Recognize python3.3 byte code. Closes: #697110. - - -- Matthias Klose Sat, 12 Jan 2013 18:13:44 +0100 - -file (5.12-2) unstable; urgency=low - - * Removing all references to my old email address. - - -- Daniel Baumann Sun, 10 Mar 2013 20:23:00 +0100 - -file (5.12-1) unstable; urgency=low - - * Merging upstream version 5.12: - - adds magics for Access 2010 (Closes: #680021). - * Updating years in copyright file. - * Updating to standards version 3.9.4. - * Dropping compression levels. - * Adding dpkg-source local-options. - * Rediffing file-localmagic.patch. - * Dropping msaccess_jet5_magic.patch, included upstream. - * Manually adding building of static library via configure option. - - -- Daniel Baumann Sun, 10 Mar 2013 19:59:40 +0100 - -file (5.11-3) unstable; urgency=low - - [ Judit Foglszinger ] - * Adding new magic for Access 2010 files, thanks to Jean-Michel Vourgère - - [ Daniel Baumann ] - * Rediffing msaccess_jet5_magic.patch with common options. - - -- Judit Foglszinger Fri, 13 Jul 2012 20:37:33 +0000 - file (5.11-2) unstable; urgency=low * Removing leading slash in debhelper install files. @@ -2073,21 +1944,25 @@ -- Nicolás Lichtmaier Mon, 3 Feb 1997 20:11:00 -0300 file (3.19-5) + * Change of maintainer and updated for multi-architecture build (fixes Bug #3332) * Un-right-justified the description field * Move entry for debian packages to the correct spot and update it for debian 2.0 packages (fixes Bug #3411) * Add entry for TrueType fonts to Magdir/fonts + -- Darren Stalder , Mon Jul 8 23:07:21 1996 file (3.19-4) * added entry for Adobe Postscript PPD files in Magdir/ppd. + file (3.19-3) * added entry for linux kernal images to source file Magdir/linux + file (3.19-2) * add MAGIC=/etc/magic to make(1) invocation * change maintainer email address + file (3.19-1) * added debian.* files * modified Magdir/archive to add debian-split entry to ar archives * modified magdir/elf to add more entry for core file - diff -Nru file-5.28/debian/control file-5.29/debian/control --- file-5.28/debian/control 2016-07-15 13:36:25.000000000 +0000 +++ file-5.29/debian/control 2016-10-25 19:08:52.000000000 +0000 @@ -1,103 +1,97 @@ Source: file -Section: utils -Priority: standard -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Christoph Biedl +Maintainer: Christoph Biedl +Homepage: http://www.darwinsys.com/file/ +Standards-Version: 3.9.8 Build-Depends: debhelper (>= 9.20141010~), + dpkg-dev (>= 1.17.14~), +Build-Depends-Arch: dh-autoreconf, + zlib1g-dev, +Build-Depends-Indep: dh-python, - dpkg-dev (>= 1.17.14~), - libpython-all-dev, - libpython3-all-dev, - python-all-dev:any, - python3-all-dev:any, + python-all, python-setuptools, + python3-all, python3-setuptools, - zlib1g-dev, -Standards-Version: 3.9.5 -Homepage: http://www.darwinsys.com/file/ +Priority: standard +Section: utils Package: file Architecture: any -Multi-Arch: foreign Depends: ${misc:Depends}, ${shlibs:Depends}, libmagic1 (= ${binary:Version}), -Description: Determines file type using "magic" numbers - File tests each argument in an attempt to classify it. There are - three sets of tests, performed in this order: filesystem tests, - magic number tests, and language tests. The first test that - succeeds causes the file type to be printed. - -Package: file-dbg -Section: debug -Priority: extra -Architecture: any Multi-Arch: foreign -Depends: ${misc:Depends}, ${shlibs:Depends}, - libmagic1 (= ${binary:Version}), -Description: Determines file type using "magic" numbers (debug) - File tests each argument in an attempt to classify it. There are - three sets of tests, performed in this order: filesystem tests, - magic number tests, and language tests. The first test that - succeeds causes the file type to be printed. +Description: Recognize the type of data in a file using "magic" numbers + The file command is "a file type guesser", a command-line tool that + tells you in words what kind of data a file contains. . - This package contains the debugging symbols. + This package contains the file program itself. Package: libmagic1 -Section: libs Architecture: any -Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} +Pre-Depends: + ${misc:Pre-Depends}, Depends: ${misc:Depends}, ${shlibs:Depends}, -Suggests: file -Description: File type determination library using "magic" numbers - This library can be used to classify files according to magic - number tests. It implements the core functionality of the file - command. + libmagic-mgc (= ${binary:Version}), +Suggests: + file, +Section: libs +Multi-Arch: same +Description: Recognize the type of data in a file using "magic" numbers - library + This library can be used to classify files according to magic number + tests. It implements the core functionality of the file command. + +Package: libmagic-mgc +Architecture: any +Depends: ${misc:Depends}, +Breaks: + libmagic1 (<< 1:5.28-4~), +Replaces: + libmagic1 (<< 1:5.28-4~), +Section: libs +Multi-Arch: foreign +Description: File type determination library using "magic" numbers (compiled magic file) + This package provides the compiled magic file "magic.mgc". It has + been separated from libmagic1 in order to meet the multiarch + requirements without breaking applications that expect this file + at its absolute path. Package: libmagic-dev -Section: libdevel -Priority: optional Architecture: any -Multi-Arch: same Depends: ${misc:Depends}, libmagic1 (= ${binary:Version}), -Suggests: file -Description: File type determination library using "magic" numbers (development) - This library can be used to classify files according to magic - number tests. It implements the core functionality of the file - command. +Suggests: + file, +Section: libdevel +Priority: optional +Multi-Arch: same +Description: Recognize the type of data in a file using "magic" numbers - development + This library can be used to classify files according to magic number + tests. . This package contains the development files. Package: python-magic -Section: python -Priority: optional Architecture: all -Build-Profiles: -Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}, +Depends: ${misc:Depends}, + ${python:Depends}, libmagic1 (>= ${binary:Version}), libmagic1 (<< ${binary:Version}.1~), -Provides: ${python:Provides} -Description: File type determination library using "magic" numbers (Python bindings) - This library can be used to classify files according to magic - number tests. It implements the core functionality of the file - command. - . - This package contains the Python bindings. - -Package: python3-magic +Provides: + ${python:Provides}, Section: python Priority: optional +Description: Recognize the type of data in a file using "magic" numbers - Python bindings + This package contains the Python bindings for the libmagic file type + detection library. + +Package: python3-magic Architecture: all -Build-Profiles: Depends: ${misc:Depends}, ${python3:Depends}, libmagic1 (>= ${binary:Version}), libmagic1 (<< ${binary:Version}.1~), -Provides: ${python3:Provides} -Description: File type determination library using "magic" numbers (Python 3 bindings) - This library can be used to classify files according to magic - number tests. It implements the core functionality of the file - command. - . - This package contains the Python 3 bindings. +Section: python +Priority: optional +Description: Recognize the type of data in a file using "magic" numbers - Python 3 bindings + This package contains the Python 3 bindings for the libmagic file type + detection library. diff -Nru file-5.28/debian/libmagic1.dirs file-5.29/debian/libmagic1.dirs --- file-5.28/debian/libmagic1.dirs 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/libmagic1.dirs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/usr/share/file/magic diff -Nru file-5.28/debian/libmagic1.install file-5.29/debian/libmagic1.install --- file-5.28/debian/libmagic1.install 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/libmagic1.install 2016-07-18 21:04:10.000000000 +0000 @@ -1,4 +1,3 @@ etc usr/lib/*/*.so.* -usr/share/file usr/share/man/man5 diff -Nru file-5.28/debian/libmagic1.links file-5.29/debian/libmagic1.links --- file-5.28/debian/libmagic1.links 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/libmagic1.links 2016-07-18 21:04:10.000000000 +0000 @@ -1,2 +1,5 @@ -/usr/share/file/magic.mgc /usr/share/misc/magic.mgc -/usr/share/file/magic /usr/share/misc/magic + +# upstream and many applications expect the magic in /usr/share/misc/, +# other in /usr/share/file/. +# Provide symlinks in the hope everybody gets satisfied. +/usr/share/file/magic /usr/share/misc/magic diff -Nru file-5.28/debian/libmagic-mgc.dirs file-5.29/debian/libmagic-mgc.dirs --- file-5.28/debian/libmagic-mgc.dirs 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/libmagic-mgc.dirs 2016-07-18 21:04:10.000000000 +0000 @@ -0,0 +1 @@ +/usr/share/file/magic diff -Nru file-5.28/debian/libmagic-mgc.install file-5.29/debian/libmagic-mgc.install --- file-5.28/debian/libmagic-mgc.install 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/libmagic-mgc.install 2016-07-18 21:04:10.000000000 +0000 @@ -0,0 +1 @@ +usr/share/file/magic.mgc usr/lib/file/ diff -Nru file-5.28/debian/libmagic-mgc.links file-5.29/debian/libmagic-mgc.links --- file-5.28/debian/libmagic-mgc.links 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/libmagic-mgc.links 2016-07-18 21:04:10.000000000 +0000 @@ -0,0 +1,7 @@ + +# upstream and many applications expect the magic in /usr/share/misc/, +# other in /usr/share/file/. The compiled magic however is +# arch-dependent and must therefore be in /usr/lib/ +# Provide symlinks in the hope everybody gets satisfied. +/usr/lib/file/magic.mgc /usr/share/file/magic.mgc +/usr/lib/file/magic.mgc /usr/share/misc/magic.mgc diff -Nru file-5.28/debian/libmagic-mgc.README.Debian file-5.29/debian/libmagic-mgc.README.Debian --- file-5.28/debian/libmagic-mgc.README.Debian 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/libmagic-mgc.README.Debian 2016-07-18 21:04:10.000000000 +0000 @@ -0,0 +1,8 @@ + +Between architectures, the compiled magic at /usr/lib/file/magic.mgc +differs only in the endianness. The libmagic library can auto-detect +wrong endianness and handle that situation gracefully, at a significant +performance cost though. + +Therefore: If you run file/libmagic in a mixed-endianness multi-arch +setup, choose the architecture for libmagic-mgc wisely. diff -Nru file-5.28/debian/patches/cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch file-5.29/debian/patches/cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch --- file-5.28/debian/patches/cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch 2016-06-29 23:37:39.000000000 +0000 +++ file-5.29/debian/patches/cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -Subject: PR/562: Reiner Herrmann: Avoid double encoding with python3 -Origin: FILE5_28-10-g73e043d -Upstream-Author: Christos Zoulas -Date: Tue Jun 28 17:10:22 2016 +0000 -Bug: http://bugs.gw.com/view.php?id=562 -Bug-Debian: https://bugs.debian.org/828833 - ---- a/python/magic.py -+++ b/python/magic.py -@@ -134,7 +134,7 @@ - if isinstance(r, str): - return r - else: -- return str(r).encode('utf-8') -+ return str(r, 'utf-8') - - def descriptor(self, fd): - """ -@@ -152,7 +152,7 @@ - if isinstance(r, str): - return r - else: -- return str(r).encode('utf-8') -+ return str(r, 'utf-8') - - def error(self): - """ -@@ -163,7 +163,7 @@ - if isinstance(e, str): - return e - else: -- return str(e).encode('utf-8') -+ return str(e, 'utf-8') - - def setflags(self, flags): - """ diff -Nru file-5.28/debian/patches/cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch file-5.29/debian/patches/cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch --- file-5.28/debian/patches/cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch 2016-06-29 23:37:39.000000000 +0000 +++ file-5.29/debian/patches/cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Subject: Reduce the number of X's to appease linitian (Christoph Biedl) -Origin: FILE5_28-6-g0971151 -Upstream-Author: Christos Zoulas -Date: Mon Jun 27 19:07:20 2016 +0000 - ---- a/doc/file.man -+++ b/doc/file.man -@@ -312,7 +312,7 @@ - never read them. - .It Fl P , Fl Fl parameter Ar name=value - Set various parameter limits. --.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent -+.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent - .It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" - .It Li indir Ta 15 Ta recursion limit for indirect magic - .It Li name Ta 30 Ta use count limit for name/use magic diff -Nru file-5.28/debian/patches/cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch file-5.29/debian/patches/cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch --- file-5.28/debian/patches/cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch 2016-06-29 23:37:39.000000000 +0000 +++ file-5.29/debian/patches/cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Subject: Don't copy NULL (Igor Gnatenko) -Origin: FILE5_28-9-g1222ebc -Upstream-Author: Christos Zoulas -Date: Tue Jun 28 16:38:26 2016 +0000 - ---- a/src/compress.c -+++ b/src/compress.c -@@ -517,7 +517,7 @@ - - return OKDATA; - err: -- strlcpy((char *)*newch, z.msg, bytes_max); -+ strlcpy((char *)*newch, z.msg ? z.msg : zError(rc), bytes_max); - *n = strlen((char *)*newch); - return ERRDATA; - } diff -Nru file-5.28/debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch file-5.29/debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch --- file-5.28/debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch 2016-12-13 15:06:43.000000000 +0000 @@ -0,0 +1,732 @@ +Subject: Combined patch of all commits since the 5.29 release +Origin: FILE5_29..FILE5_29-23-gc8ef8f4 +Upstream-Author: Christos Zoulas +Date: Sat Dec 10 14:21:29 2016 +0000 + +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,6 +1,11 @@ ++2016-11-06 10:52 Christos Zoulas ++ ++ * Allow @@@ in extensions ++ * Add missing overflow check in der magic (Jonas Wagner) ++ + 2016-10-25 10:40 Christos Zoulas + +- * release 5.28 ++ * release 5.29 + + 2016-10-24 11:20 Christos Zoulas + +--- a/doc/magic.man ++++ b/doc/magic.man +@@ -7,7 +7,7 @@ + .Nm magic + .Nd file command's magic pattern file + .Sh DESCRIPTION +-This manual page documents the format of the magic file as ++This manual page documents the format of magic files as + used by the + .Xr file __CSECTION__ + command, version __VERSION__. +@@ -17,13 +17,19 @@ + among other tests, + a test for whether the file contains certain + .Dq "magic patterns" . +-The file +-.Pa __MAGIC__ +-specifies what patterns are to be tested for, what message or ++The database of these ++.Dq "magic patterns" ++is usually located in a binary file in ++.Pa __MAGIC__.mgc ++or a directory of source text magic pattern fragment files in ++.Pa __MAGIC__ . ++The database specifies what patterns are to be tested for, what message or + MIME type to print if a particular pattern is found, + and additional information to extract from the file. + .Pp +-Each line of the file specifies a test to be performed. ++The format of the source fragment files that are used to build this database ++is as follows: ++Each line of a fragment file specifies a test to be performed. + A test compares the data starting at a particular offset + in the file with a byte value, a string or a numeric value. + If the test succeeds, a message is printed. +--- a/magic/Magdir/audio ++++ b/magic/Magdir/audio +@@ -469,6 +469,8 @@ + >>20 byte&0xe 0xc \b, 7 channels + >>20 byte&0xe 0xe \b, 8 channels + # some common sample rates ++>>17 belong&0xfffff0 0x2ee000 \b, 192 kHz ++>>17 belong&0xfffff0 0x158880 \b, 88.2 kHz + >>17 belong&0xfffff0 0x0ac440 \b, 44.1 kHz + >>17 belong&0xfffff0 0x0bb800 \b, 48 kHz + >>17 belong&0xfffff0 0x07d000 \b, 32 kHz +--- a/magic/Magdir/console ++++ b/magic/Magdir/console +@@ -617,6 +617,52 @@ + >0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): + >>0x200 use nintendo-gcn-disc-common + ++# Type: Nintendo GameCube/Wii disc image (CISO format) ++# NOTE: This is NOT the same as Compact ISO or PSP CISO, ++# though it has the same magic number. ++0 string CISO ++# Other fields are used to determine what type of CISO this is: ++# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) ++# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) ++# - None of the above: Compact ISO. ++>4 lelong 0x200000 ++>>8 byte 1 ++>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): ++>>>>0x8000 use nintendo-gcn-disc-common ++>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): ++>>>>0x8000 use nintendo-gcn-disc-common ++ ++# Type: Nintendo GameCube/Wii disc image (GCZ format) ++# Due to zlib compression, we can't get the actual disc information. ++0 lelong 0xB10BC001 ++>4 lelong 0 Nintendo GameCube disc image (GCZ format) ++>4 lelong 1 Nintendo Wii disc image (GCZ format) ++>4 lelong >1 Nintendo GameCube/Wii disc image (GCZ format) ++ ++# Type: Nintendo GameCube/Wii disc image (WDF format) ++0 string WII\001DISC ++>8 belong 1 ++# WDFv1 ++>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): ++>>>0x38 use nintendo-gcn-disc-common ++>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): ++>>>0x38 use nintendo-gcn-disc-common ++>8 belong 2 ++# WDFv2 ++>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): ++>>>(12.L) use nintendo-gcn-disc-common ++>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): ++>>>(12.L) use nintendo-gcn-disc-common ++ ++# Type: Nintendo GameCube/Wii disc image (WIA format) ++0 string WIA\001 Nintendo ++>0x48 belong 0 GameCube/Wii ++>0x48 belong 1 GameCube ++>0x48 belong 2 Wii ++>0x48 belong >2 GameCube/Wii ++>0x48 belong x disc image (WIA format): ++>>0x58 use nintendo-gcn-disc-common ++ + #------------------------------------------------------------------------------ + # Nintendo 3DS file formats. + # +@@ -750,3 +796,17 @@ + # + 0 string g\ GCE Vectrex ROM image + >0x11 string >\0 \b: "%.16s" ++ ++#------------------------------------------------------------------------------ ++# amiibo: file(1) magic for Nintendo amiibo NFC dumps. ++# From: David Korth ++# Reference: https://www.3dbrew.org/wiki/Amiibo ++0x00 byte 0x04 ++>0x0A beshort 0x0FE0 ++>>0x0C belong 0xF110FFEE ++>>>0x208 beshort 0x0100 ++>>>>0x020A byte 0x0F ++>>>>>0x020C bequad 0x000000045F000000 ++>>>>>>0x5B byte 0x02 ++>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- ++>>>>>>>0x58 belong x \b%08X +--- a/magic/Magdir/filesystems ++++ b/magic/Magdir/filesystems +@@ -1949,7 +1949,19 @@ + >0 use cdrom + + # .cso files +-0 string CISO Compressed ISO CD image ++# Reference: http://pismotec.com/ciso/ciso.h ++# NOTE: There are two other formats with the same magic but ++# completely incompatible specifications: ++# - GameCube/Wii CISO: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DiscIO/CISOBlob.h ++# - PSP CISO: https://github.com/jamie/ciso/blob/master/ciso.h ++0 string CISO ++# Other fields are used to determine what type of CISO this is: ++# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) ++# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) ++# - None of the above: Compact ISO. ++>4 lelong !0 ++>>4 lelong !0x200000 ++>>>0x10 lelong !0x800 Compressed ISO CD image + + # cramfs filesystem - russell@coker.com.au + 0 lelong 0x28cd3d45 Linux Compressed ROM File System data, little endian +--- a/magic/Magdir/fonts ++++ b/magic/Magdir/fonts +@@ -100,9 +100,11 @@ + + # X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com) + # PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides) +-0 string \001fcp X11 Portable Compiled Font data +->12 byte 0x02 \b, LSB first +->12 byte 0x0a \b, MSB first ++0 string \001fcp X11 Portable Compiled Font data, ++>12 lelong ^0x08 bit: LSB, ++>12 lelong &0x08 bit: MSB, ++>12 lelong ^0x04 byte: LSB first ++>12 lelong &0x04 byte: MSB first + 0 string D1.0\015 X11 Speedo font data + + #------------------------------------------------------------------------------ +--- /dev/null ++++ b/magic/Magdir/gpu +@@ -0,0 +1,16 @@ ++ ++#------------------------------------------------------------------------------ ++# $File: images,v 1.118 2016/11/08 02:58:21 christos Exp $ ++# gpu: file(1) magic for GPU input files ++ ++# Standard Portable Intermediate Representation (SPIR) ++# Documentation: https://www.khronos.org/spir ++# Typical file extension: .spv ++ ++0 belong 0x07230203 Khronos SPIR-V binary, big-endian ++>4 belong x \b, version 0x%08x ++>8 belong x \b, generator 0x%08x ++ ++0 lelong 0x07230203 Khronos SPIR-V binary, little-endian ++>4 lelong x \b, version 0x%08x ++>8 lelong x \b, generator 0x%08x +--- a/magic/Magdir/icc ++++ b/magic/Magdir/icc +@@ -11,41 +11,204 @@ + # http://www.color.org/specification/ICC1v43_2010-12.pdf + # + # for Specification ICC.1:2010 (Profile version 4.3.0.0). ++# URL: http://fileformats.archiveteam.org/wiki/ICC_profile ++# Reference: http://www.color.org/iccmax/ICC.2-2016-7.pdf ++# Update: Joerg Jenderek + # + # Bytes 36 to 39 contain a generic profile file signature of "acsp"; + # bytes 40 to 43 "may be used to identify the primary platform/operating + # system framework for which the profile was created". + # +-# There are other fields that might be worth dumping as well. +-# ++# check and display ICC/ICM color profile ++0 name color-profile ++>36 string acsp ++# skip ASCII like Cognacspirit.txt by month <= 12 ++>>26 ubeshort <13 ++# platform/operating system. Only 5 mentioned + ++# + # This appears to be what's used for Apple ColorSync profiles. + # Instead of adding that, Apple just changed the generic "acsp" entry + # to be for "ColorSync ICC Color Profile" rather than "Kodak Color + # Management System, ICC Profile". + # Yes, it's "APPL", not "AAPL"; see the spec. +-36 string acspAPPL ColorSync ICC Profile +-!:mime application/vnd.iccprofile ++>>>40 string APPL ColorSync + + # Microsoft ICM color profile +-36 string acspMSFT Microsoft ICM Color Profile +-!:mime application/vnd.iccprofile ++>>>40 string MSFT Microsoft + + # Yes, that's a blank after "SGI". +-36 string acspSGI\ SGI ICC Profile +-!:mime application/vnd.iccprofile ++>>>40 string SGI\ SGI + + # XXX - is this what's used for the Sun KCMS or not? The standard file + # uses just "acsp" for that, but Apple's file uses it for "ColorSync", + # and there *is* an identified "primary platform" value of SUNW. +-36 string acspSUNW Sun KCMS ICC Profile ++>>>40 string SUNW Sun KCMS ++ ++# 5th platform ++>>>40 string TGNT Taligent ++ ++# remaing "l" "e" of "color profile" printed later to avoid error ++>>>40 string x color profi ++#>>>40 string x (%.4s) + !:mime application/vnd.iccprofile ++# for "ICM" extension only versions 2.x and for Kodak "CC" 2.0 is found ++>>>8 ubyte =2 ++# do not use empty message text to a avoid error like ++# icc, 82: Warning: Current entry does not yet have a description for adding a EXTENSION type ++# file.exe: could not find any valid magic files! ++>>>>9 ubyte !0 \ble ++!:ext icc/icm ++# minor version ++>>>>9 ubyte =0 \bl ++# Kodak colour management system ++>>>>>4 string =KCMS \be ++!:ext icc/icm/cc ++>>>>>4 string !KCMS \be ++!:ext icc/icm ++>>>8 ubyte !2 \ble ++!:ext icc ++# Profile version major.4bit-minor.sub1.sub2 like 4.3.0.0 (04300000h) ++>>>8 ubyte x %u ++>>>9 ubyte/16 x \b.%u ++# reserved and shall be null but 205.205 in umx1220u.icm ++>>>10 ubyte >0 \b.%u ++>>>>11 ubyte >0 \b.%u ++# preferred colour management module like appl CCMS KCMS Lino UCCM "Win " "FF " ++# skip space like in brmsl08f.icm and null like in brmsl09f.icm, brmsl07f.icm ++>>>4 string >\ \b, type %.2s ++>>>>6 string >\ \b%.1s ++>>>>>7 string >\ \b%.1s ++# colour space "XYZ " "Lab " "RGB " CMYK GRAY ... ++>>>16 string x \b, %.3s ++>>>19 string >\ \b%.1s ++# Profile Connection Space (PCS) field usually "XYZ " or "Lab " but sometimes ++# null or CMYK like in ISOcoated_v2_to_PSOcoated_v3_DeviceLink.icc ++>>>20 string >\0 \b/%.3s ++>>>>23 string >\ \b%.1s ++# eleven device classes ++>>>12 string x \b-%.4s device ++# skip 00001964h in hpf69000.icc or 0h in XRDC50Q.ICM or " ROT" in brmsl05f.icm ++>>>52 string >\ ++# skip "none" model like in "Trinitron Compatible 9300K G2.2.icm" ++>>>>52 ubelong !0x6e6f6e65 ++# device manufacturer field like "HP " "IBM " EPSO ++>>>>>48 string x \b, %.2s ++>>>>>50 string >\ \b%.1s ++>>>>>51 string >\ \b%.1s ++# model like "ADI " "A265" and skip 20000404h in IS330.icm for RICOH RUSSIAN-SC ++>>>>>52 string >\ \ \b/%.3s ++>>>>>>55 string >\ \b%.1s ++>>>>>52 string x model ++# creator (often same as manufacture) like HP SONY XROX or null like in A925A.icm ++>>>80 string >\0 by %.2s ++>>>>82 string >\ \b%.1s ++>>>>>83 string >\ \b%.1s ++# profile size ++>>>0 ubelong x \b, %u bytes ++# skip invalid date 0 like in linearSRGB.icc ++>>>24 ubequad !0 ++# datetime dd-mm-yyyy hh:mm:ss ++>>>>28 ubeshort x \b, %u ++# month <= 12 ++>>>>26 ubeshort x \b-%u ++# year ++>>>>24 ubeshort x \b-%u ++# do not display midnight time like in CNHP8308.ICC ++>>>>30 ubequad&0xFFffFFffFFff0000 !0 ++# hour <= 24 ++>>>>>30 ubeshort x %u ++# minutes <= 59 ++>>>>>32 ubeshort x \b:%.2u ++# seconds <= 59 ++>>>>>34 ubeshort x \b:%.2u ++# vendor specific flags like 2 in HPCLJ5.ICM ++>>>44 ubeshort >0 \b, 0x%x vendor flags ++# profile flags bits 0-2 of least 16 used by ICC ++#>>>44 ubelong >0 \b, 0x%x flags ++# icEmbeddedProfileTrue ++>>>44 ubelong &1 \b, embedded ++# icEmbeddedProfileFalse ++#>>>44 ubelong ^1 \b, not embedded ++# icUseWithEmbeddedDataOnly ++>>>44 ubelong &2 \b, dependently ++# icUseAnywhere ++#>>>44 ubelong ^2 \b, independently ++>>>44 ubelong &4 \b, MCS ++#>>>44 ubelong ^4 \b, no MCS ++# vendor specific device attributes 1~srgb.icc ++# E000D00h~CNB7QEDA.ICM C000A00h~CNB5FCAA.ICM 01040401h~CNB25PE3.ICM ++>>>56 ubelong >0 \b, 0x%x vendor attribute ++# ICC device attributes bits 0-7 used ++#>>>60 ubelong x \b, 0x%x attribute ++# http://www.color.org/icc34.h ++>>>60 ubelong &0x01 \b, transparent ++#>>>60 ubelong ^0x01 \b, reflective ++>>>60 ubelong &0x02 \b, matte ++#>>>60 ubelong ^0x02 \b, glossy ++>>>60 ubelong &0x04 \b, negative ++#>>>60 ubelong ^0x04 \b, positive ++>>>60 ubelong &0x08 \b, black&white ++#>>>60 ubelong ^0x08 \b, colour ++>>>60 ubelong &0x10 \b, non-paper ++#>>>60 ubelong ^0x10 \b, paper ++>>>60 ubelong &0x20 \b, non-textured ++#>>>60 ubelong ^0x20 \b, textured ++>>>60 ubelong &0x40 \b, non-isotropic ++#>>>60 ubelong ^0x40 \b, isotropic ++>>>60 ubelong &0x80 \b, self-luminous ++#>>>60 ubelong ^0x80 \b, non-self-luminous ++# rendering intent 0-3 but 7AEA5027h in EE051__1.ICM 6CB1BCh in EE061__1.ICM ++>>>64 ubelong >3 \b, 0x%x rendering intent ++#>>>64 ubelong =0 \b, perceptual ++>>>64 ubelong =1 \b, relative colorimetric ++>>>64 ubelong =2 \b, saturation ++>>>64 ubelong =3 \b, absolute colorimetric ++# PCS illuminant (3*s15Fixed16Numbers) often 0000f6d6 00010000 0000d32d ++>>>71 ubequad !0xd6000100000000d3 \b, PCS ++# usually X~0.9642*65536=63189.8112~63190=F6D5h ; but also found ++# often F6D6 in gt5000r.icm, F6B8 in kodakce.icm, F6CA in RSWOP.icm ++>>>>68 ubelong !0x0000f6d5 X=0x%x ++# usually Y=1.0~00010000h but Y=0 in brmsl07f.icm ++>>>>72 ubelong !0x00010000 Y=0x%x ++# usually Z~0.8249*65536=54060.6464~54061=D32Dh ; but also found ++# D2F7 in hp1200c.icm, often D32C in A925A.icm, D309 in RSWOP.icm , D2F8 in kodak_dc.icm ++>>>>76 ubelong !0x0000d32d Z=0x%x ++# Profile ID. MD5 fingerprinting method as defined in Internet RFC 1321. ++>>>84 ubequad >0 \b, 0x%llx MD5 ++# reserved in older versions should be zero but also found CDCDCDCDCDCDCDCD ++#>>100 ubequad x \b 0x%llx reserved ++# tag table ++# 6 <= tags count <= 43 ++#>>>128 ubelong >43 \b, %u tags ++>>>128 ubelong x ++# shall contain the profileDescriptionTag "desc" , copyrightTag "cprt" ++# search range = tags count * 12 -8=< maximal tag count * 12 -8= 43 * 12 -8= 508 ++>>>>132 search/508 cprt ++# but no copyright tag in linearSRGB.icc ++# beneath /System/Library/Frameworks/WebKit.framework/ ++# Versions/A/Frameworks/WebCore.framework/Versions/A/Resources ++>>>>132 default x \b, no copyright tag ++# 1st tag ++#>>>132 string x \b, 1st tag %.4s ++#>>>136 ubelong x 0x%x offset ++#>>>140 ubelong x 0x%x len ++# 2nd tag,... ++# look also for profileDescriptionTag "desc" ++>>>132 search/508 desc ++# look further for TextDescriptionType "desc" signature ++>>>>(&0.L) string =desc ++>>>>>&4 pstring/l x "%s" ++# look alternative for multiLocalizedUnicodeType "mluc" signature like in VideoPAL.icc ++>>>>(&0.L) string =mluc ++>>>>>&(&8.L) ubequad x ++>>>>>>&4 bestring16 x '%s' + + # Any other profile. + # XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles, + # and use "acsp" for everything else and dump the "primary platform" + # string in those cases? +-36 string acsp ICC Profile +-!:mime application/vnd.iccprofile ++36 string acsp ++>0 use color-profile + + +--- a/magic/Magdir/images ++++ b/magic/Magdir/images +@@ -41,7 +41,11 @@ + >>>>>>3 uleshort 0 + >>>>>>>0 use tga-image + # Color Map +->>>>>1 ubyte >0 ++>>>>>1 belong&0xfff7ffff 0x01010000 ++>>>>>>0 use tga-image ++>>>>>1 belong&0xfff7ffff 0x00020000 ++>>>>>>0 use tga-image ++>>>>>1 belong&0xfff7ffff 0x00030000 + >>>>>>0 use tga-image + # display tga bitmap image information + 0 name tga-image +@@ -418,6 +422,7 @@ + # + 0 string \x89PNG\x0d\x0a\x1a\x0a PNG image data + !:mime image/png ++!:strength +10 + >16 belong x \b, %d x + >20 belong x %d, + >24 byte x %d-bit +@@ -1451,3 +1456,12 @@ + >0x10 string GVRT Sega GVR image: + >>0x10 use sega-gvr-image-header + >>0x08 belong x \b, global index = %u ++ ++# Light Field Picture ++# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx ++# Typical file extensions: .lfp .lfr .lfx ++ ++0 belong 0x894C4650 ++>4 belong 0x0D0A1A0A ++>12 belong 0x00000000 Lytro Light Field Picture ++>8 belong x \b, version %d +--- a/magic/Magdir/make ++++ b/magic/Magdir/make +@@ -2,6 +2,7 @@ + # $File: make,v 1.2 2015/08/25 07:34:06 christos Exp $ + # make: file(1) magic for makefiles + # ++# URL: https://en.wikipedia.org/wiki/Make_(software) + 0 regex/100l \^CFLAGS makefile script text + !:mime text/x-makefile + 0 regex/100l \^VPATH makefile script text +@@ -10,12 +11,19 @@ + !:mime text/x-makefile + 0 regex/100l \^all: makefile script text + !:mime text/x-makefile +-0 regex/100l \^\.PRECIOUS makefile script text ++0 regex/100l \^\\.PRECIOUS makefile script text + !:mime text/x-makefile +-0 regex/100l \^\.BEGIN BSD makefile script text ++# Update: Joerg Jenderek ++# Reference: https://www.freebsd.org/cgi/man.cgi?make(1) ++# exclude grub-core\lib\libgcrypt\mpi\Makefile.am with "#BEGIN_ASM_LIST" ++# by additional escaping point character ++0 regex/100l \^\\.BEGIN BSD makefile script text with "%s" ++!:mime text/x-makefile ++!:ext /mk ++# exclude MS Windows help file CoNtenT with ":include FOOBAR.CNT" ++# and NSIS script with "!include" by additional escaping point character ++0 regex/100l \^\\.include BSD makefile script text with "%s" + !:mime text/x-makefile +-0 regex/100l \^\.include BSD makefile script text +-!:mime text/x-makefile +- ++!:ext /mk + 0 regex/100l \^SUBDIRS automake makefile script text + !:mime text/x-makefile +--- a/magic/Magdir/msdos ++++ b/magic/Magdir/msdos +@@ -565,10 +565,23 @@ + 0 string/b PO^Q` Microsoft Word 6.0 Document + !:mime application/msword + # +-0 string/b \376\067\0\043 Microsoft Office Document ++4 long 0 ++>0 belong 0xfe320000 Microsoft Word for Macintosh 1.0 + !:mime application/msword +-0 string/b \333\245-\0\0\0 Microsoft Office Document ++!:ext mcw ++>0 belong 0xfe340000 Microsoft Word for Macintosh 3.0 + !:mime application/msword ++!:ext mcw ++>0 belong 0xfe37001c Microsoft Word for Macintosh 4.0 ++!:mime application/msword ++!:ext mcw ++>0 belong 0xfe370023 Microsoft Word for Macintosh 5.0 ++!:mime application/msword ++!:ext mcw ++ ++0 string/b \333\245-\0\0\0 Microsoft Word 2.0 Document ++!:mime application/msword ++!:ext doc + 512 string/b \354\245\301 Microsoft Word Document + !:mime application/msword + +@@ -1106,3 +1119,40 @@ + 0 string MIOPEN Mallard BASIC Jetsam data + 0 string Jetsam0 Mallard BASIC Jetsam index data + ++# DOS backup 2.0 to 3.2 ++ ++# backupid.@@@ ++ ++# plausibility check for date ++0x3 ushort >1979 ++>0x5 ubyte-1 <31 ++>>0x6 ubyte-1 <12 ++# actually 121 nul bytes ++>>>0x7 string \0\0\0\0\0\0\0\0 ++>>>>0x1 ubyte x DOS 2.0 backup id file, sequence %d ++!:ext @@@ ++>>>>0x0 ubyte 0xff \b, last disk ++ ++# backed up file ++ ++# plausibility check for file name length ++0x53 ubyte-1 <80 ++# actually 54 nul bytes ++>0x54 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 ++>>0x5 string x DOS 2.0 backed up file %s, ++>>0 ubyte 0xff complete file ++>>0 ubyte !0xff ++>>>1 ushort x split file, sequence %d ++ ++ ++# DOS backup 3.3 to 5.x ++ ++# CONTROL.nnn files ++0 string \x8bBACKUP\x20 ++# actually 128 nul bytes ++>0xa string \0\0\0\0\0\0\0\0 ++>>0x9 ubyte x DOS 3.3 backup control file, sequence %d ++>>0x8a ubyte 0xff \b, last disk ++ ++# NB: The BACKUP.nnn files consist of the files backed up, ++# concatenated. +--- a/magic/Magdir/msx ++++ b/magic/Magdir/msx +@@ -245,18 +245,18 @@ + 0x4000 string/b AB + >0x4002 uleshort >0x400F + >>0x400A string \0\0\0\0\0\0 MSX ROM with nonstandard page order +->>0x4002 uleshort x \b, init=0x%04x +->>0x4004 uleshort >0 \b, stahdl=0x%04x +->>0x4006 uleshort >0 \b, devhdl=0x%04x +->>0x4008 uleshort >0 \b, bas=0x%04x ++>>>0x4002 uleshort x \b, init=0x%04x ++>>>0x4004 uleshort >0 \b, stahdl=0x%04x ++>>>0x4006 uleshort >0 \b, devhdl=0x%04x ++>>>0x4008 uleshort >0 \b, bas=0x%04x + + 0x8000 string/b AB + >0x8002 uleshort >0x400F + >>0x800A string \0\0\0\0\0\0 MSX ROM with nonstandard page order +->>0x8002 uleshort x \b, init=0x%04x +->>0x8004 uleshort >0 \b, stahdl=0x%04x +->>0x8006 uleshort >0 \b, devhdl=0x%04x +->>0x8008 uleshort >0 \b, bas=0x%04x ++>>>0x8002 uleshort x \b, init=0x%04x ++>>>0x8004 uleshort >0 \b, stahdl=0x%04x ++>>>0x8006 uleshort >0 \b, devhdl=0x%04x ++>>>0x8008 uleshort >0 \b, bas=0x%04x + + + 0x3C000 string/b AB +--- a/magic/Magdir/sgml ++++ b/magic/Magdir/sgml +@@ -46,6 +46,12 @@ + !:mime text/html + !:strength + 5 + ++# SVG document ++# https://www.w3.org/TR/SVG/single-page.html ++0 search/4096/cWbt \ HTML document text + !:mime text/html + !:strength + 5 +--- /dev/null ++++ b/magic/Magdir/yara +@@ -0,0 +1,17 @@ ++ ++ ++#------------------------------------------------------------------------------ ++# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $ ++# yara: file(1) magic for http://virustotal.github.io/yara/ ++# ++ ++0 string YARA ++>4 lelong >2047 ++>8 byte <20 YARA 3.x compiled rule set ++# version ++>>8 clear ++>>8 byte 6 created with version 3.3.0 ++>>8 byte 8 created with version 3.4.0 ++>>8 byte 11 created with version 3.5.0 ++>>8 default x ++>>>8 byte x development version 0x%02x +--- a/magic/Makefile.am ++++ b/magic/Makefile.am +@@ -104,6 +104,7 @@ + $(MAGIC_FRAGMENT_DIR)/gnu \ + $(MAGIC_FRAGMENT_DIR)/gnumeric \ + $(MAGIC_FRAGMENT_DIR)/gpt \ ++$(MAGIC_FRAGMENT_DIR)/gpu \ + $(MAGIC_FRAGMENT_DIR)/grace \ + $(MAGIC_FRAGMENT_DIR)/graphviz \ + $(MAGIC_FRAGMENT_DIR)/gringotts \ +@@ -285,6 +286,7 @@ + $(MAGIC_FRAGMENT_DIR)/xilinx \ + $(MAGIC_FRAGMENT_DIR)/xo65 \ + $(MAGIC_FRAGMENT_DIR)/xwindows \ ++$(MAGIC_FRAGMENT_DIR)/yara \ + $(MAGIC_FRAGMENT_DIR)/zfs \ + $(MAGIC_FRAGMENT_DIR)/zilog \ + $(MAGIC_FRAGMENT_DIR)/zyxel +--- a/src/apprentice.c ++++ b/src/apprentice.c +@@ -2291,7 +2291,7 @@ + + return parse_extra(ms, me, line, + CAST(off_t, offsetof(struct magic, ext)), +- sizeof(m->ext), "EXTENSION", ",!+-/", 0); ++ sizeof(m->ext), "EXTENSION", ",!+-/@", 0); + } + + /* +--- a/src/cdf.c ++++ b/src/cdf.c +@@ -530,6 +530,9 @@ + scn->sst_dirlen = len; + scn->sst_ss = ss; + ++ if (sid == CDF_SECID_END_OF_CHAIN || len == 0) ++ return cdf_zero_stream(scn); ++ + if (scn->sst_len == (size_t)-1) + goto out; + +--- a/src/der.c ++++ b/src/der.c +@@ -159,31 +159,49 @@ + return tag; + } + ++/* ++ * Read the length of a DER tag from the input. ++ * ++ * `c` is the input, `p` is an output parameter that specifies how much of the ++ * input we consumed, and `l` is the maximum input length. ++ * ++ * Returns the length, or DER_BAD if the end of the input is reached or the ++ * length exceeds the remaining input. ++ */ + static uint32_t + getlength(const uint8_t *c, size_t *p, size_t l) + { + uint8_t digits, i; + size_t len; ++ int is_onebyte_result; + + if (*p >= l) + return DER_BAD; + +- digits = c[(*p)++]; ++ /* ++ * Digits can either be 0b0 followed by the result, or 0b1 ++ * followed by the number of digits of the result. In either case, ++ * we verify that we can read so many bytes from the input. ++ */ ++ is_onebyte_result = (c[*p] & 0x80) == 0; ++ digits = c[(*p)++] & 0x7f; ++ if (*p + digits >= l) ++ return DER_BAD; + +- if ((digits & 0x80) == 0) ++ if (is_onebyte_result) + return digits; + +- digits &= 0x7f; ++ /* ++ * Decode len. We've already verified that we're allowed to read ++ * `digits` bytes. ++ */ + len = 0; +- +- if (*p + digits >= l) +- return DER_BAD; +- + for (i = 0; i < digits; i++) + len = (len << 8) | c[(*p)++]; ++ + if (*p + len >= l) + return DER_BAD; +- return len; ++ return len; + } + + static const char * +--- a/src/funcs.c ++++ b/src/funcs.c +@@ -76,7 +76,7 @@ + ms->o.buf = buf; + return 0; + out: +- file_error(ms, errno, "vasprintf failed"); ++ fprintf(stderr, "vasprintf failed (%s)", strerror(errno)); + return -1; + } + diff -Nru file-5.28/debian/patches/local.disable-algol68-detection.patch file-5.29/debian/patches/local.disable-algol68-detection.patch --- file-5.28/debian/patches/local.disable-algol68-detection.patch 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/patches/local.disable-algol68-detection.patch 2016-12-13 15:06:43.000000000 +0000 @@ -0,0 +1,34 @@ +Subject: Disable detection of Algol68 files +Author: Christoph Biedl +Date: 2016-12-13 +Forwarded: http://mx.gw.com/pipermail/file/2016/002174.html + +--- a/magic/Magdir/algol68 ++++ b/magic/Magdir/algol68 +@@ -3,16 +3,16 @@ + # $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ + # algol68: file(1) magic for Algol 68 source + # +-0 search/8192 (input, Algol 68 source text +-!:mime text/x-Algol68 +-0 regex \^PROC Algol 68 source text +-!:mime text/x-Algol68 +-0 regex MODE[\t\ ] Algol 68 source text +-!:mime text/x-Algol68 +-0 regex REF[\t\ ] Algol 68 source text +-!:mime text/x-Algol68 +-0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +-!:mime text/x-Algol68 ++#0 search/8192 (input, Algol 68 source text ++#!:mime text/x-Algol68 ++#0 regex \^PROC Algol 68 source text ++#!:mime text/x-Algol68 ++#0 regex MODE[\t\ ] Algol 68 source text ++#!:mime text/x-Algol68 ++#0 regex REF[\t\ ] Algol 68 source text ++#!:mime text/x-Algol68 ++#0 regex FLEX[\t\ ]\*\\[ Algol 68 source text ++#!:mime text/x-Algol68 + #0 regex [\t\ ]OD Algol 68 source text + #!:mime text/x-Algol68 + #0 regex [\t\ ]FI Algol 68 source text diff -Nru file-5.28/debian/patches/local.support-local-definitions-in-etc-magic.patch file-5.29/debian/patches/local.support-local-definitions-in-etc-magic.patch --- file-5.28/debian/patches/local.support-local-definitions-in-etc-magic.patch 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/patches/local.support-local-definitions-in-etc-magic.patch 2016-10-25 16:30:51.000000000 +0000 @@ -25,37 +25,15 @@ + --- a/src/apprentice.c +++ b/src/apprentice.c -@@ -452,7 +452,7 @@ - #ifndef COMPILE_ONLY - map = apprentice_map(ms, fn); +@@ -454,7 +454,7 @@ + if (map == (struct magic_map *)-1) + return -1; if (map == NULL) { - if (ms->flags & MAGIC_CHECK) + if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0) file_magwarn(ms, "using regular magic file `%s'", fn); map = apprentice_load(ms, fn, action); if (map == NULL) ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -4,7 +4,7 @@ - - bin_PROGRAMS = file - --AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"' -+AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"' - AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@ - - libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ ---- a/src/Makefile.in -+++ b/src/Makefile.in -@@ -340,7 +340,7 @@ - MAGIC = $(pkgdatadir)/magic - lib_LTLIBRARIES = libmagic.la - nodist_include_HEADERS = magic.h --AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"' -+AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"' - AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@ - libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \ - encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \ --- a/doc/file.man +++ b/doc/file.man @@ -57,7 +57,7 @@ @@ -77,7 +55,7 @@ magic file .Pa __MAGIC__.mgc , or the files in the directory -@@ -469,12 +470,6 @@ +@@ -472,12 +473,6 @@ The order of entries in the magic file is significant. Depending on what system you are using, the order that they are put together may be incorrect. diff -Nru file-5.28/debian/patches/series file-5.29/debian/patches/series --- file-5.28/debian/patches/series 2016-06-29 23:37:39.000000000 +0000 +++ file-5.29/debian/patches/series 2016-12-13 15:06:43.000000000 +0000 @@ -1,7 +1,5 @@ -# cherry-picked commits. Keep in chronlogical order -cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch -cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch -cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch +# cherry-picked commits. Keep in upstream's chronological order +cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch # local modifications local.support-local-definitions-in-etc-magic.patch @@ -9,3 +7,4 @@ local.mention-posixly-correct-dependent-behaviour-in-usage-message.patch local.report-gz-as-application-gzip.patch local.disable-detection-of-vax-coff-executables.patch +local.disable-algol68-detection.patch diff -Nru file-5.28/debian/python3-magic.install file-5.29/debian/python3-magic.install --- file-5.28/debian/python3-magic.install 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/python3-magic.install 2016-10-25 19:08:52.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/python3* diff -Nru file-5.28/debian/python-magic.install file-5.29/debian/python-magic.install --- file-5.28/debian/python-magic.install 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/debian/python-magic.install 2016-10-25 19:08:52.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/python2* diff -Nru file-5.28/debian/rules file-5.29/debian/rules --- file-5.28/debian/rules 2016-07-15 13:34:56.000000000 +0000 +++ file-5.29/debian/rules 2016-10-25 19:08:52.000000000 +0000 @@ -4,18 +4,12 @@ SHELL := sh -e -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) --include /usr/share/python/python.mk -endif - DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS= --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc LD=$(DEB_HOST_GNU_TYPE)-ld - SET_CROSS_ENV = PYTHONPATH=/usr/lib/python$$pv/plat-$(DEB_HOST_MULTIARCH) - SET_CROSS_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU) else CROSS= --build=$(DEB_BUILD_GNU_TYPE) endif @@ -23,17 +17,11 @@ # HOWMANY is the number of bytes looked at by file CFLAGS += -DHOWMANY=0x18000 -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) -PYTHON_VERSIONS=$(shell pyversions -r debian/control) -PYTHON3_VERSIONS=$(shell py3versions -r debian/control) -endif - %: -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - dh ${@} --with autoreconf,python2,python3 -else - dh ${@} --with autoreconf -endif + dh $@ $(DH_ADDONS) +binary-arch build-arch install-arch: DH_ADDONS=--with autoreconf +binary-indep build-indep install-indep: DH_ADDONS=--with python2,python3 +binary build install: DH_ADDONS=--with autoreconf,python2,python3 override_dh_auto_clean: dh_auto_clean @@ -42,27 +30,18 @@ rm -rf python/__pycache__ rm -f python/*.pyc -override_dh_auto_build: - dh_auto_build - -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - for python in $(PYTHON_VERSIONS); \ - do \ - (cd python && $(SET_CROSS_ENV) $$python setup.py build_ext \ - -L$(CURDIR)/src/.libs); \ - done - - for python in $(PYTHON3_VERSIONS); \ - do \ - (cd python && $(SET_CROSS_ENV) $$python setup.py build_ext \ - -L$(CURDIR)/src/.libs); \ - done -endif +override_dh_auto_configure-indep: + dh_auto_configure --buildsystem=pybuild --sourcedirectory=python +override_dh_auto_build-indep: + dh_auto_build --buildsystem=pybuild --sourcedirectory=python +override_dh_auto_test-indep: +override_dh_auto_install-indep: + dh_auto_install --buildsystem=pybuild --sourcedirectory=python -override_dh_auto_configure: +override_dh_auto_configure-arch: dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 --enable-static --disable-silent-rules CFLAGS="$(CFLAGS)" -override_dh_auto_install: +override_dh_auto_install-arch: dh_auto_install mv debian/tmp/usr/share/misc debian/tmp/usr/share/file @@ -70,51 +49,23 @@ install -D -m 0644 magic/magic.local debian/tmp/etc/magic install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime -ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) - for python in $(PYTHON_VERSIONS); \ - do \ - (cd python && $(SET_CROSS_ENV) $$python setup.py install --no-compile \ - --root=$(CURDIR)/debian/python-magic $(py_setup_install_args)); \ - done - - for python in $(PYTHON3_VERSIONS); \ - do \ - (cd python && $(SET_CROSS_ENV) $$python setup.py install --no-compile \ - --root=$(CURDIR)/debian/python3-magic $(py_setup_install_args)); \ - done -endif - - # Installing additional headers + # Install additional headers mkdir -p debian/libmagic-dev/usr/include/file cp src/file.h debian/libmagic-dev/usr/include/file - # Removing useless files + # Remove useless files rm -f debian/tmp/usr/lib/*/*.la -override_dh_builddeb: - dh_builddeb -- -Zxz - override_dh_install: dh_install --fail-missing override_dh_shlibdeps: ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) - # use just built file in dh_shlibdeps + # use the just built file in dh_shlibdeps PATH=$(CURDIR)/debian/file/usr/bin:$$PATH \ LD_LIBRARY_PATH=$(CURDIR)/debian/libmagic1/usr/lib/$(DEB_HOST_MULTIARCH)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}} \ - MAGIC=$(CURDIR)/debian/libmagic1/usr/share/file/magic.mgc \ + MAGIC=$(CURDIR)/debian/libmagic-mgc/usr/share/file/magic.mgc \ dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib else dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib endif - -override_dh_strip: -ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) - # use just built file in dh_strip - PATH=$(CURDIR)/debian/file/usr/bin:$$PATH \ - LD_LIBRARY_PATH=$(CURDIR)/debian/libmagic1/usr/lib/$(DEB_HOST_MULTIARCH)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}} \ - MAGIC=$(CURDIR)/debian/libmagic1/usr/share/file/magic.mgc \ - dh_strip --dbg-package=file-dbg -else - dh_strip --dbg-package=file-dbg -endif diff -Nru file-5.28/debian/source/options file-5.29/debian/source/options --- file-5.28/debian/source/options 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/source/options 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -compression = xz diff -Nru file-5.28/debian/source.lintian-overrides file-5.29/debian/source.lintian-overrides --- file-5.28/debian/source.lintian-overrides 2016-06-29 13:36:48.000000000 +0000 +++ file-5.29/debian/source.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - -# Bug#797951 -file source: restriction-formula-without-versioned-dpkg-dev-dependency -file source: restriction-formula-with-debhelper-without-debhelper-version diff -Nru file-5.28/doc/file.man file-5.29/doc/file.man --- file-5.28/doc/file.man 2016-06-13 19:03:27.000000000 +0000 +++ file-5.29/doc/file.man 2016-10-19 20:52:45.000000000 +0000 @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.121 2016/06/07 22:09:20 rrt Exp $ -.Dd March 13, 2016 +.\" $File: file.man,v 1.124 2016/10/19 20:52:45 christos Exp $ +.Dd October 19, 2016 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -8,7 +8,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl bcEhiklLNnprsvzZ0 +.Op Fl bcdEhiklLNnprsvzZ0 .Op Fl Fl apple .Op Fl Fl extension .Op Fl Fl mime-encoding @@ -181,6 +181,8 @@ This is usually used in conjunction with the .Fl m flag to debug a new magic file before installing it. +.It Fl d +Prints internal debugging information to stderr. .It Fl E On filesystem errors (file not found etc), instead of handling the error as regular output as POSIX mandates and keep going, issue an error message @@ -208,7 +210,8 @@ .It compress Checks for, and looks inside, compressed files. .It elf -Prints ELF file details. +Prints ELF file details, provided soft magic tests are enabled and the +elf magic is found. .It soft Consults magic files. .It tar @@ -312,7 +315,7 @@ never read them. .It Fl P , Fl Fl parameter Ar name=value Set various parameter limits. -.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent +.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent .It Sy "Name" Ta Sy "Default" Ta Sy "Explanation" .It Li indir Ta 15 Ta recursion limit for indirect magic .It Li name Ta 30 Ta use count limit for name/use magic diff -Nru file-5.28/doc/magic.man file-5.29/doc/magic.man --- file-5.28/doc/magic.man 2015-09-08 13:48:44.000000000 +0000 +++ file-5.29/doc/magic.man 2016-09-16 12:06:13.000000000 +0000 @@ -1,5 +1,5 @@ -.\" $File: magic.man,v 1.86 2015/09/08 13:48:44 christos Exp $ -.Dd January 1, 2015 +.\" $File: magic.man,v 1.88 2016/07/27 09:42:49 rrt Exp $ +.Dd July 20, 2016 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -535,13 +535,18 @@ The value at that offset is read, and is used again as an offset in the file. Indirect offsets are of the form: -.Em (( x [.[bislBISL]][+\-][ y ]) . +.Em (( x [[.,][bislBISL]][+\-][ y ]) . The value of .Em x is used as an offset in the file. A byte, id3 length, short or long is read at that offset depending on the .Em [bislBISLm] type specifier. +The value is treated as signed if +.Dq , +is specified or unsigned if +.Dq . +is specified. The capitalized types interpret the number as a big endian value, whereas the small letter versions interpret the number as a little endian value; @@ -564,9 +569,9 @@ \*[Gt]\*[Gt](0x3c.l) string LX\e0\e0 LX executable (OS/2) .Ed .Pp -This strategy of examining has a drawback: You must make sure that -you eventually print something, or users may get empty output (like, when -there is neither PE\e0\e0 nor LE\e0\e0 in the above example) +This strategy of examining has a drawback: you must make sure that you +eventually print something, or users may get empty output (such as when +there is neither PE\e0\e0 nor LE\e0\e0 in the above example). .Pp If this indirect offset cannot be used directly, simple calculations are possible: appending diff -Nru file-5.28/ltmain.sh file-5.29/ltmain.sh --- file-5.28/ltmain.sh 2016-06-13 23:44:02.000000000 +0000 +++ file-5.29/ltmain.sh 2016-10-25 14:40:23.000000000 +0000 @@ -9432,7 +9432,8 @@ # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test "$installed" = no && test "$need_relink" = yes && \ + test -n "$relink_command"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi diff -Nru file-5.28/magic/Magdir/algol68 file-5.29/magic/Magdir/algol68 --- file-5.28/magic/Magdir/algol68 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/magic/Magdir/algol68 2016-10-17 14:17:48.000000000 +0000 @@ -0,0 +1,19 @@ + +#------------------------------------------------------------------------------ +# $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ +# algol68: file(1) magic for Algol 68 source +# +0 search/8192 (input, Algol 68 source text +!:mime text/x-Algol68 +0 regex \^PROC Algol 68 source text +!:mime text/x-Algol68 +0 regex MODE[\t\ ] Algol 68 source text +!:mime text/x-Algol68 +0 regex REF[\t\ ] Algol 68 source text +!:mime text/x-Algol68 +0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +!:mime text/x-Algol68 +#0 regex [\t\ ]OD Algol 68 source text +#!:mime text/x-Algol68 +#0 regex [\t\ ]FI Algol 68 source text +#!:mime text/x-Algol68 diff -Nru file-5.28/magic/Magdir/animation file-5.29/magic/Magdir/animation --- file-5.28/magic/Magdir/animation 2015-11-29 22:11:07.000000000 +0000 +++ file-5.29/magic/Magdir/animation 2016-07-03 14:13:11.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: animation,v 1.57 2015/11/29 22:11:07 christos Exp $ +# $File: animation,v 1.58 2016/07/03 14:13:11 christos Exp $ # animation: file(1) magic for animation/movie formats # # animation formats @@ -1008,3 +1008,11 @@ >4 lelong x %d x >8 lelong x %d, >12 lelong x %d frames + +# Material Exchange Format +# More information: +# https://en.wikipedia.org/wiki/Material_Exchange_Format +# http://www.freemxf.org/ +0 string \x06\x0e\x2b\x34\x02\x05\x01\x01\x0d\x01\x02\x01\x01\x02 Material exchange container format +!:ext mxf +!:mime application/mxf diff -Nru file-5.28/magic/Magdir/apple file-5.29/magic/Magdir/apple --- file-5.28/magic/Magdir/apple 2015-12-04 20:40:10.000000000 +0000 +++ file-5.29/magic/Magdir/apple 2016-08-17 09:45:13.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: apple,v 1.32 2015/12/04 20:40:10 christos Exp $ +# $File: apple,v 1.35 2016/08/17 09:45:13 christos Exp $ # apple: file(1) magic for Apple file formats # 0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text @@ -285,49 +285,118 @@ # .vdi 4 string innotek\ VirtualBox\ Disk\ Image %s -# Apple disk partition stuff, strengthen the magic using byte 4 +# Apple disk partition stuff +# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map +# Reference: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/bootblock.h +# Update: Joerg Jenderek +# "ER" is APPLE_DRVR_MAP_MAGIC signature 0 beshort 0x4552 ->4 byte 0 Apple Driver Map +# display Apple Driver Map (strength=50) after Syslinux bootloader (71) +#!:strength +0 +# strengthen the magic by looking for used blocksizes 512 2048 +>2 ubeshort&0xf1FF 0 Apple Driver Map +# last 6 bytes for padding found are 0 or end with 55AAh marker for MBR hybrid +#>>504 ubequad&0x0000FFffFFff0000 0 +!:mime application/x-apple-diskimage +!:apple ????devr +# https://en.wikipedia.org/wiki/Apple_Disk_Image +!:ext dmg/iso +# sbBlkSize for driver descriptor map 512 2048 >>2 beshort x \b, blocksize %d ->>4 belong x \b, blockcount %d ->>10 beshort x \b, devtype %d ->>12 beshort x \b, devid %d ->>20 beshort x \b, descriptors %d -# Assume 8 partitions each at a multiple of the sector size. -# We could glean this from the partition descriptors, but they are empty!?!? ->>(2.S*1) indirect x \b, contains[@0x%x]: ->>(2.S*2) indirect x \b, contains[@0x%x]: ->>(2.S*3) indirect x \b, contains[@0x%x]: ->>(2.S*4) indirect x \b, contains[@0x%x]: ->>(2.S*5) indirect x \b, contains[@0x%x]: ->>(2.S*6) indirect x \b, contains[@0x%x]: ->>(2.S*7) indirect x \b, contains[@0x%x]: ->>(2.S*8) indirect x \b, contains[@0x%x]: +# sbBlkCount sometimes garbish like +# 0xb0200000 for unzlibed install_flash_player_19.0.0.245_osx.dmg +# 0xf2720100 for bunziped Firefox 48.0-2.dmg +# 0xeb02ffff for super_grub2_disk_hybrid_2.02s3.iso +# 0x00009090 by syslinux-6.03/utils/isohybrid.c +>>4 ubelong x \b, blockcount %u +# following device/driver information not very useful +# device type 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso) +>>8 ubeshort x \b, devtype %u +# device id 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso) +>>10 ubeshort x \b, devid %u +# driver data 0 (2425393296 garbage for super_grub2_disk_hybrid_2.02s3.iso) +>>12 ubelong >0 +>>>12 ubelong x \b, driver data %u +# number of driver descriptors sbDrvrCount <= 61 +# (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso) +>>16 ubeshort x \b, driver count %u +# 61 * apple_drvr_descriptor[8]. information not very useful or same as in partition map +# >>18 use apple-driver-map +# >>26 use apple-driver-map +# # ... +# >>500 use apple-driver-map +# number of partitions is always same in every partition (map block count) +#>>0x0204 ubelong x \b, %u partitions +>>0x0204 ubelong >0 \b, contains[@0x200]: +>>>0x0200 use apple-apm +>>0x0204 ubelong >1 \b, contains[@0x400]: +>>>0x0400 use apple-apm +>>0x0204 ubelong >2 \b, contains[@0x600]: +>>>0x0600 use apple-apm +>>0x0204 ubelong >3 \b, contains[@0x800]: +>>>0x0800 use apple-apm +>>0x0204 ubelong >4 \b, contains[@0xA00]: +>>>0x0A00 use apple-apm +>>0x0204 ubelong >5 \b, contains[@0xC00]: +>>>0x0C00 use apple-apm +>>0x0204 ubelong >6 \b, contains[@0xE00]: +>>>0x0E00 use apple-apm +>>0x0204 ubelong >7 \b, contains[@0x1000]: +>>>0x1000 use apple-apm +# display apple driver descriptor map (start-block, # blocks in sbBlkSize sizes, type) +0 name apple-driver-map +>0 ubequad !0 +# descBlock first block of driver +>>0 ubelong x \b, driver start block %u +# descSize driver size in blocks +>>4 ubeshort x \b, size %u +# descType driver system type 1 701h F8FFh FFFFh +>>6 ubeshort x \b, type 0x%x -# Yes, the 3rd and 4th bytes are reserved, but we use them to make the +# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map +# Reference: http://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h +# Update: Joerg Jenderek +# Yes, the 3rd and 4th bytes pmSigPad are reserved, but we use them to make the # magic stronger. -0 belong 0x504d0000 Apple Partition Map ->4 belong x \b, map block count %d ->8 belong x \b, start block %d ->12 belong x \b, block count %d ->16 string >0 \b, name %s ->48 string >0 \b, type %s ->124 string >0 \b, processor %s ->140 string >0 \b, boot arguments %s ->92 belong & 1 \b, valid ->92 belong & 2 \b, allocated ->92 belong & 4 \b, in use ->92 belong & 8 \b, has boot info ->92 belong & 16 \b, readable ->92 belong & 32 \b, writable ->92 belong & 64 \b, pic boot code ->92 belong & 128 \b, chain compatible driver ->92 belong & 256 \b, real driver ->92 belong & 512 \b, chain driver ->92 belong & 1024 \b, mount at startup ->92 belong & 2048 \b, is the startup partition +# for apple partition map stored as a single file +0 belong 0x504d0000 +# to display Apple Partition Map (strength=70) after Syslinux bootloader (71) +#!:strength +0 +>0 use apple-apm +# magic/Magdir/apple14.test, 365: Warning: Current entry does not yet have a description for adding a EXTENSION type +# file: could not find any valid magic files! +#!:ext bin +# display apple partition map. Normally called after Apple driver map +0 name apple-apm +>0 belong 0x504d0000 Apple Partition Map +# number of partitions +>>4 ubelong x \b, map block count %u +# logical block (512 bytes) start of partition +>>8 ubelong x \b, start block %u +>>12 ubelong x \b, block count %u +>>16 string >0 \b, name %s +>>48 string >0 \b, type %s +# processor type dpme_process_id[16] e.g. "68000" "68020" +>>120 string >0 \b, processor %s +# A/UX boot arguments BootArgs[128] +>>136 string >0 \b, boot arguments %s +# status of partition dpme_flags +>>88 belong & 1 \b, valid +>>88 belong & 2 \b, allocated +>>88 belong & 4 \b, in use +>>88 belong & 8 \b, has boot info +>>88 belong & 16 \b, readable +>>88 belong & 32 \b, writable +>>88 belong & 64 \b, pic boot code +>>88 belong & 128 \b, chain compatible driver +>>88 belong & 256 \b, real driver +>>88 belong & 512 \b, chain driver +# mount automatically at startup APPLE_PS_AUTO_MOUNT +>>88 ubelong &0x40000000 \b, mount at startup +# is the startup partition APPLE_PS_STARTUP +>>88 ubelong &0x80000000 \b, is the startup partition -#http://wiki.mozilla.org/DS_Store_File_Format` +#http://wiki.mozilla.org/DS_Store_File_Format #http://en.wikipedia.org/wiki/.DS_Store 0 string \0\0\0\1Bud1\0 Apple Desktop Services Store @@ -337,5 +406,28 @@ # extensions rsr/rsrc 0 string \000\000\001\000 >4 leshort 0 ->>16 lelong 0 Apple HFS/HFS+ resource fork +>>16 lelong 0 Apple HFS/HFS+ resource fork + +#https://en.wikipedia.org/wiki/AppleScript +0 string FasdUAS AppleScript compiled +# AppleWorks/ClarisWorks +# https://github.com/joshenders/appleworks_format +# http://fileformats.archiveteam.org/wiki/AppleWorks +0 name appleworks +>0 belong&0x00ffffff 0x07e100 AppleWorks CWK Document +>0 belong&0x00ffffff 0x008803 ClarisWorks CWK Document +>0 default x +>>0 belong x AppleWorks/ClarisWorks CWK Document +>0 byte x \b, version %d +>30 beshort x \b, %d +>32 beshort x \bx%d +!:ext cwk + +4 string BOBO +>0 byte >4 +>>12 belong 0 +>>>26 belong 0 +>>>>0 use appleworks +>0 belong 0x0481ad00 +>>0 use appleworks diff -Nru file-5.28/magic/Magdir/application file-5.29/magic/Magdir/application --- file-5.28/magic/Magdir/application 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/magic/Magdir/application 2016-10-17 12:13:01.000000000 +0000 @@ -0,0 +1,7 @@ + +#------------------------------------------------------------------------------ +# $File: application,v 1.1 2016/10/17 12:13:01 christos Exp $ +# application: file(1) magic for applications on small devices +# +# Pebble Application +0 string PBLAPP\000\000 Pebble application diff -Nru file-5.28/magic/Magdir/apt file-5.29/magic/Magdir/apt --- file-5.28/magic/Magdir/apt 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/magic/Magdir/apt 2016-10-17 19:51:57.000000000 +0000 @@ -0,0 +1,52 @@ + +#------------------------------------------------------------------------------ +# $File: apt,v 1.1 2016/10/17 19:51:57 christos Exp $ +# apt: file(1) magic for APT Cache files +# +# + +# before version 10 ("old format"), data was in arch-specific long/short + +# old format 64 bit +0 name apt-cache-64bit-be +>12 beshort 1 \b, dirty +>40 bequad x \b, %llu packages +>48 bequad x \b, %llu versions + +# old format 32 bit +0 name apt-cache-32bit-be +>8 beshort 1 \b, dirty +>40 belong x \b, %u packages +>44 belong x \b, %u versions + +# new format +0 name apt-cache-be +>6 byte 1 \b, dirty +>24 belong x \b, %u packages +>28 belong x \b, %u versions + +0 bequad 0x98FE76DC +>8 ubeshort <10 APT cache data, version %u +>>10 beshort x \b.%u, 64 bit big-endian +>>0 use apt-cache-64bit-be + +0 lequad 0x98FE76DC +>8 uleshort <10 APT cache data, version %u +>>10 leshort x \b.%u, 64 bit little-endian +>>0 use \^apt-cache-64bit-be + +0 belong 0x98FE76DC +>4 ubeshort <10 APT cache data, version %u +>>6 ubeshort x \b.%u, 32 bit big-endian +>>0 use apt-cache-32bit-be +>4 ubyte >9 APT cache data, version %u +>>5 ubyte x \b.%u, big-endian +>>0 use apt-cache-be + +0 lelong 0x98FE76DC +>4 uleshort <10 APT cache data, version %u +>>6 uleshort x \b.%u, 32 bit little-endian +>>0 use \^apt-cache-32bit-be +>4 ubyte >9 APT cache data, version %u +>>5 ubyte x \b.%u, little-endian +>>0 use \^apt-cache-be diff -Nru file-5.28/magic/Magdir/bioinformatics file-5.29/magic/Magdir/bioinformatics --- file-5.28/magic/Magdir/bioinformatics 2016-02-14 15:53:53.000000000 +0000 +++ file-5.29/magic/Magdir/bioinformatics 2016-06-20 16:13:46.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: bioinformatics,v 1.2 2016/02/14 15:53:53 christos Exp $ +# $File: bioinformatics,v 1.4 2016/06/20 16:13:46 christos Exp $ # bioinfomatics: file(1) magic for Bioinfomatics file formats ############################################################################### @@ -16,32 +16,32 @@ ############################################################################### -# Tabix index file +# Tabix index file # used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml) ############################################################################### 0 string TBI\1 SAMtools TBI (Tabix index format) >0x04 lelong =1 \b, with %d reference sequence >0x04 lelong >1 \b, with %d reference sequences >0x08 lelong &0x10000 \b, using half-closed-half-open coordinates (BED style) ->0x08 lelong ^0x10000 +>0x08 lelong ^0x10000 >>0x08 lelong =0 \b, using closed and one based coordinates (GFF style) >>0x08 lelong =1 \b, using SAM format >>0x08 lelong =2 \b, using VCF format >0x0c lelong x \b, sequence name column: %d >0x10 lelong x \b, region start column: %d ->0x08 lelong =0 +>0x08 lelong =0 >>0x14 lelong x \b, region end column: %d >0x18 byte x \b, comment character: %c >0x1c lelong x \b, skip line count: %d ############################################################################### -# BAM (Binary Sequence Alignment/Map format) -# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) +# BAM (Binary Sequence Alignment/Map format) +# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) # data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it ############################################################################### 0 string BAM\1 SAMtools BAM (Binary Sequence Alignment/Map) ->0x04 lelong >0 +>0x04 lelong >0 >>&0x00 regex =^[@]HD\t.*VN: \b, with SAM header >>>&0 regex =[0-9.]+ \b version %s >>&(0x04) lelong >0 \b, with %d reference sequences @@ -49,14 +49,14 @@ ############################################################################### # BAI (BAM indexing format) -# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) +# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) ############################################################################### 0 string BAI\1 SAMtools BAI (BAM indexing format) >0x04 lelong >0 \b, with %d reference sequences ############################################################################### -# CRAM (Binary Sequence Alignment/Map format) +# CRAM (Binary Sequence Alignment/Map format) ############################################################################### 0 string CRAM CRAM >0x04 byte >-1 version %d. @@ -69,13 +69,13 @@ # used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf) # data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it ############################################################################### -0 string BCF\4 +0 string BCF\4 # length of seqnm data in bytes is positive ->&0x00 lelong >0 +>&0x00 lelong >0 # length of smpl data in bytes is positive >>&(&-0x04) lelong >0 SAMtools BCF (Binary Call Format) # length of meta in bytes ->>>&(&-0x04) lelong >0 +>>>&(&-0x04) lelong >0 # have meta text string >>>>&0x00 search ##samtoolsVersion= >>>>>&0x00 string x \b, generated by SAMtools version %s @@ -88,7 +88,7 @@ ############################################################################### 0 string BCF\2\1 Binary Call Format (BCF) version 2.1 # length of header text ->&0x00 lelong >0 +>&0x00 lelong >0 # have header string >>&0x00 search ##samtoolsVersion= >>>&0x00 string x \b, generated by SAMtools version %s @@ -101,7 +101,7 @@ ############################################################################### 0 string BCF\2\2 Binary Call Format (BCF) version 2.2 # length of header text ->&0x00 lelong >0 +>&0x00 lelong >0 # have header string >>&0x00 search ##samtoolsVersion= >>>&0x00 string x \b, generated by SAMtools version %s @@ -119,11 +119,11 @@ ############################################################################### # XXX Broken? # @ -#0 regex =^@[A-Za-z0-9_.:-]+\?\n +#0 regex =^@[A-Za-z0-9_.:-]+\?\n # #>&1 regex =^[A-Za-z\n.~]++ # +[] -#>>&1 regex =^[A-Za-z0-9_.:-]*\?\n +#>>&1 regex =^[A-Za-z0-9_.:-]*\?\n # #>>>&1 regex =^[!-~\n]+\n FASTQ @@ -132,7 +132,7 @@ # used by FASTA (http://fasta.bioch.virginia.edu/fasta_www2/fasta_guide.pdf) ############################################################################### #0 byte 0x3e -# q>0 regex =^[>][!-~\t\ ]+$ +# q>0 regex =^[>][!-~\t\ ]+$ # Amino Acid codes: [A-IK-Z*-]+ #>>1 regex !=[!-'Jj;:=?@^`|~\\] FASTA # IUPAC codes/gaps: [ACGTURYKMSWBDHVNX-]+ @@ -141,37 +141,37 @@ #>>>1 regex =^[EFIJLOPQZefijlopqz]+$ \b, with Amino Acid codes ############################################################################### -# SAM (Sequence Alignment/Map format) -# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) +# SAM (Sequence Alignment/Map format) +# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) ############################################################################### # Short-cut version to recognise SAM files with (optional) header at beginning ############################################################################### -0 string @HD\t +0 string @HD\t >4 search VN: Sequence Alignment/Map (SAM), with header >>&0 regex [0-9.]+ \b version %s ############################################################################### # Longer version to recognise SAM alignment lines using (many) regexes ############################################################################### # SAM Alignment QNAME -0 regex =^[!-?A-~]{1,255}(\t[^\t]+){11} +0 regex =^[!-?A-~]{1,255}(\t[^\t]+){11} # SAM Alignment FLAG ->0 regex =^([^\t]+\t){1}[0-9]{1,5}\t +>0 regex =^([^\t]+\t){1}[0-9]{1,5}\t # SAM Alignment RNAME ->>0 regex =^([^\t]+\t){2}\\*|[^*=]*\t +>>0 regex =^([^\t]+\t){2}\\*|[^*=]*\t # SAM Alignment POS ->>>0 regex =^([^\t]+\t){3}[0-9]{1,9}\t +>>>0 regex =^([^\t]+\t){3}[0-9]{1,9}\t # SAM Alignment MAPQ ->>>>0 regex =^([^\t]+\t){4}[0-9]{1,3}\t +>>>>0 regex =^([^\t]+\t){4}[0-9]{1,3}\t # SAM Alignment CIGAR ->>>>>0 regex =\t\\*|([0-9]+[MIDNSHPX=])+)\t +>>>>>0 regex =\t(\\*|([0-9]+[MIDNSHPX=])+)\t # SAM Alignment RNEXT ->>>>>>0 regex =\t(\\*|=|[!-()+->?-~][!-~]*)\t +>>>>>>0 regex =\t(\\*|=|[!-()+->?-~][!-~]*)\t # SAM Alignment PNEXT ->>>>>>>0 regex =^([^\t]+\t){7}[0-9]{1,9}\t +>>>>>>>0 regex =^([^\t]+\t){7}[0-9]{1,9}\t # SAM Alignment TLEN ->>>>>>>>0 regex =\t[+-]{0,1}[0-9]{1,9}\t.*\t +>>>>>>>>0 regex =\t[+-]{0,1}[0-9]{1,9}\t.*\t # SAM Alignment SEQ ->>>>>>>>>0 regex =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t +>>>>>>>>>0 regex =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t # SAM Alignment QUAL >>>>>>>>>>0 regex =^([^\t]+\t){10}[!-~]+ Sequence Alignment/Map (SAM) >>>>>>>>>>>0 regex =^[@]HD\t.*VN: \b, with header diff -Nru file-5.28/magic/Magdir/c-lang file-5.29/magic/Magdir/c-lang --- file-5.28/magic/Magdir/c-lang 2016-05-21 14:28:27.000000000 +0000 +++ file-5.29/magic/Magdir/c-lang 2016-07-01 23:31:13.000000000 +0000 @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: c-lang,v 1.23 2016/05/21 14:28:27 christos Exp $ +# $File: c-lang,v 1.24 2016/07/01 23:31:13 christos Exp $ # c-lang: file(1) magic for C and related languages programs # # The strength is to beat standard HTML @@ -48,6 +48,11 @@ !:strength + 30 !:mime text/x-c++ +# Objective-C +0 regex \^#import Objective-C source text +!:strength +25 +!:mime text/x-objective-c + # From: Mikhail Teterin 0 string cscope cscope reference data >7 string x version %.2s diff -Nru file-5.28/magic/Magdir/claris file-5.29/magic/Magdir/claris --- file-5.28/magic/Magdir/claris 2014-09-11 15:03:07.000000000 +0000 +++ file-5.29/magic/Magdir/claris 2016-07-18 19:23:38.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: claris,v 1.7 2014/06/03 19:17:27 christos Exp $ +# $File: claris,v 1.8 2016/07/18 19:23:38 christos Exp $ # claris: file(1) magic for claris # "H. Nanosecond" # Claris Works a word processor, etc. @@ -18,7 +18,8 @@ # Claris works files # .cwk -0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document +# Moved to Apple AppleWorks document +#0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document # .plt 0 string \020\341\000\000\010\010 Claris Works palette files .plt diff -Nru file-5.28/magic/Magdir/commands file-5.29/magic/Magdir/commands --- file-5.28/magic/Magdir/commands 2016-04-19 13:40:02.000000000 +0000 +++ file-5.29/magic/Magdir/commands 2016-07-14 19:01:12.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: commands,v 1.54 2016/04/19 13:40:02 christos Exp $ +# $File: commands,v 1.56 2016/07/14 19:01:12 christos Exp $ # commands: file(1) magic for various shells and interpreters # #0 string/w : shell archive or script for antique kernel text @@ -112,3 +112,7 @@ # URL: http://packages.debian.org/pdmenu # From: Edward Betts 0 string #!/usr/bin/pdmenu Pdmenu configuration file text + +# From Danny Weldon +0 string \x0b\x13\x08\x00 +>0x04 uleshort <4 ksh byte-code version %d diff -Nru file-5.28/magic/Magdir/compress file-5.29/magic/Magdir/compress --- file-5.28/magic/Magdir/compress 2015-12-04 20:48:03.000000000 +0000 +++ file-5.29/magic/Magdir/compress 2016-09-16 12:12:05.000000000 +0000 @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.65 2015/12/04 20:48:03 christos Exp $ +# $File: compress,v 1.66 2016/09/16 12:12:05 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -220,6 +220,56 @@ 0 lelong 0x184c2102 LZ4 compressed data (v0.1-v0.9) !:mime application/x-lz4 +# Zstandard/LZ4 skippable frames +# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md +0 lelong&0xFFFFFFF0 0x184D2A50 +>(4.l+8) indirect + +# Zstandard Dictionary ID subroutine +0 name zstd-dictionary-id +# Single Segment = True +>0 byte &0x20 \b, Dictionary ID: +>>0 byte&0x03 0 None +>>0 byte&0x03 1 +>>>1 byte x %u +>>0 byte&0x03 2 +>>>1 leshort x %u +>>0 byte&0x03 3 +>>>1 lelong x %u +# Single Segment = False +>0 byte ^0x20 \b, Dictionary ID: +>>0 byte&0x03 0 None +>>0 byte&0x03 1 +>>>2 byte x %u +>>0 byte&0x03 2 +>>>2 leshort x %u +>>0 byte&0x03 3 +>>>2 lelong x %u + +# Zstandard compressed data +# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md +0 lelong 0xFD2FB522 Zstandard compressed data (v0.2) +!:mime application/x-zstd +0 lelong 0xFD2FB523 Zstandard compressed data (v0.3) +!:mime application/x-zstd +0 lelong 0xFD2FB524 Zstandard compressed data (v0.4) +!:mime application/x-zstd +0 lelong 0xFD2FB525 Zstandard compressed data (v0.5) +!:mime application/x-zstd +0 lelong 0xFD2FB526 Zstandard compressed data (v0.6) +!:mime application/x-zstd +0 lelong 0xFD2FB527 Zstandard compressed data (v0.7) +!:mime application/x-zstd +>4 use zstd-dictionary-id +0 lelong 0xFD2FB528 Zstandard compressed data (v0.8+) +!:mime application/x-zstd +>4 use zstd-dictionary-id + +# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md +0 lelong 0xEC30A437 Zstandard dictionary +!:mime application/x-zstd-dictionary +>4 lelong x (ID %u) + # AFX compressed files (Wolfram Kleff) 2 string -afx- AFX compressed file data diff -Nru file-5.28/magic/Magdir/cups file-5.29/magic/Magdir/cups --- file-5.28/magic/Magdir/cups 2014-09-11 15:03:07.000000000 +0000 +++ file-5.29/magic/Magdir/cups 2016-10-17 18:51:02.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: cups,v 1.3 2014/05/28 19:50:41 christos Exp $ +# $File: cups,v 1.4 2016/10/17 18:51:02 christos Exp $ # Cups: file(1) magic for the cups raster file format # From: Laurent Martelli # http://www.cups.org/documentation.php/spec-raster.html @@ -44,7 +44,7 @@ >3 string 2 Cups Raster version 2, Big Endian >3 string 3 Cups Raster version 3, Big Endian !:mime application/vnd.cups-raster ->0 use ^cups-le +>0 use \^cups-le # Cups Raster image format, Little Endian diff -Nru file-5.28/magic/Magdir/editors file-5.29/magic/Magdir/editors --- file-5.28/magic/Magdir/editors 2014-09-11 15:03:07.000000000 +0000 +++ file-5.29/magic/Magdir/editors 2016-07-18 17:44:49.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: editors,v 1.8 2009/09/19 16:28:09 christos Exp $ +# $File: editors,v 1.10 2016/07/18 17:44:49 christos Exp $ # T602 editor documents # by David Necas 0 string @CT\ T602 document data, @@ -12,7 +12,28 @@ # Vi IMproved Encrypted file # by David Necas 0 string VimCrypt~ Vim encrypted file data + +0 name vimnanoswap +>67 byte 0 +>>107 byte 0 +#>>>2 string x %s swap file +>>>24 ulelong x \b, pid %d +>>>28 string >\0 \b, user %s +>>>68 string >\0 \b, host %s +>>>108 string >\0 \b, file %s +>>>1007 byte 0x55 \b, modified + # Vi IMproved Swap file # by Sven Wegener -0 string b0VIM\ Vim swap file ->&0 string >\0 \b, version %s +0 string b0VIM\ Vim swap file +>&0 string >\0 \b, version %s +>0 use vimnanoswap + + +# Lock/swap file for several editors, at least +# Vi IMproved and nano +0 string b0nano Nano swap file +>0 use vimnanoswap + +# kate (K Advanced Text Editor) +0 string \x00\x00\x00\x12Kate\ Swap\ File\ 2.0\x00 Kate swap file diff -Nru file-5.28/magic/Magdir/filesystems file-5.29/magic/Magdir/filesystems --- file-5.28/magic/Magdir/filesystems 2016-02-14 14:38:24.000000000 +0000 +++ file-5.29/magic/Magdir/filesystems 2016-09-05 08:34:25.000000000 +0000 @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: filesystems,v 1.113 2016/02/14 14:38:24 christos Exp $ +# $File: filesystems,v 1.114 2016/09/05 08:34:25 christos Exp $ # filesystems: file(1) magic for different filesystems # 0 name partid @@ -539,8 +539,6 @@ >>>514 string !HdrS # not BeOS >>>>422 string !Be\ Boot\ Loader ->>>>>32769 string CD001 ->>>>>>0 use cdrom # jump over BPB instruction implies DOS bootsector or AdvanceMAME mbr >>>>>0 ubelong&0xFD000000 =0xE9000000 # AdvanceMAME mbr @@ -1929,6 +1927,7 @@ >>38917 string 3 (version 2.0) >>38917 byte >0x33 (unknown version, ID 0x%X) >>38917 byte <0x31 (unknown version, ID 0x%X) +# The next line is not necessary because the MBR staff is done looking for boot signature >0x1FE leshort 0xAA55 (DOS/MBR boot sector) # "application id" which appears to be used as a volume label >32808 string/T >\0 '%s' diff -Nru file-5.28/magic/Magdir/fonts file-5.29/magic/Magdir/fonts --- file-5.28/magic/Magdir/fonts 2016-03-22 22:27:47.000000000 +0000 +++ file-5.29/magic/Magdir/fonts 2016-09-14 01:26:26.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: fonts,v 1.30 2016/03/22 22:27:47 christos Exp $ +# $File: fonts,v 1.33 2016/09/14 01:26:26 christos Exp $ # fonts: file(1) magic for font data # 0 search/1 FONT ASCII vfont text @@ -15,6 +15,56 @@ 6 string %!FontType1 PostScript Type 1 font program data 0 string %!PS-Adobe-3.0\ Resource-Font PostScript Type 1 font text +# Summary: PostScript Type 1 Printer Font Metrics +# URL: https://en.wikipedia.org/wiki/PostScript_fonts +# Reference: http://partners.adobe.com/public/developer/en/font/5178.PFM.pdf +# Modified by: Joerg Jenderek +# Note: moved from ./msdos magic +# dfVersion 256=0100h +0 uleshort 0x0100 +# GRR: line above is too general as it catches also TrueType font, +# raw G3 data FAX, WhatsApp encrypted and Panorama database +# dfType 129=0081h +>66 uleshort 0x0081 +# dfVertRes 300=012Ch not needed as additional test +#>>70 uleshort 0x012c +# dfHorizRes 300=012Ch +#>>>72 uleshort 0x012c +# dfDriverInfo points to postscript information section +>>(101.l) string/c Postscript Printer Font Metrics +# above labeled "PFM data" by ./msdos (version 5.28) or "Adobe Printer Font Metrics" by TrID +!:mime application/x-font-pfm +# AppleShare Print Server +#!:apple ASPS???? +!:ext pfm +# dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking +#>>>6 string >\060 - %-.60s +# dfDriverInfo +>>>139 ulelong >0 +# often abbreviated and same as filename +>>>>(139.l) string x %s +# dfSize +>>>2 ulelong x \b, %d bytes +# dfFace 210=D2h 9Eh +>>>105 ulelong >0 +# Windows font name +>>>>(105.l) string x \b, %s +# dfItalic +>>>80 ubyte 1 italic +# dfUnderline +>>>81 ubyte 1 underline +# dfStrikeOut +>>>82 ubyte 1 strikeout +# dfWeight 400=0x0190 300=0x012c 500=0x01f4 600=0x0258 700=0x02bc +>>>83 uleshort >699 bold +# dfPitchAndFamily 16 17 48 49 64 65 +>>>90 ubyte 16 serif +>>>90 ubyte 17 serif proportional +#>>>90 ubyte 48 other +>>>90 ubyte 49 proportional +>>>90 ubyte 64 script +>>>90 ubyte 65 script proportional + # X11 font files in SNF (Server Natural Format) format # updated by Joerg Jenderek at Feb 2013 # http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm @@ -110,7 +160,12 @@ >14 string x version %s # EOT -34 string LP Embedded OpenType (EOT) +0x40 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +>0x22 string LP Embedded OpenType (EOT) +# workaround until there's lepstring16 +# >>0x52 lepstring16/h >\0 \b, %s family +>>0x52 short !0 +>>>0x54 lestring16 x \b, %s family !:mime application/vnd.ms-fontobject # Web Open Font Format (.woff) diff -Nru file-5.28/magic/Magdir/gcc file-5.29/magic/Magdir/gcc --- file-5.28/magic/Magdir/gcc 2014-09-11 15:03:07.000000000 +0000 +++ file-5.29/magic/Magdir/gcc 2016-07-01 23:31:13.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: gcc,v 1.4 2009/09/19 16:28:09 christos Exp $ +# $File: gcc,v 1.5 2016/07/01 23:31:13 christos Exp $ # gcc: file(1) magic for GCC special files # 0 string gpch GCC precompiled header @@ -12,6 +12,6 @@ # 67 = 'C', 111 = 'o', 43 = '+', 79 = 'O' >4 byte 67 for C ->4 byte 111 for Objective C +>4 byte 111 for Objective-C >4 byte 43 for C++ ->4 byte 79 for Objective C++ +>4 byte 79 for Objective-C++ diff -Nru file-5.28/magic/Magdir/gnu file-5.29/magic/Magdir/gnu --- file-5.28/magic/Magdir/gnu 2015-04-19 22:59:25.000000000 +0000 +++ file-5.29/magic/Magdir/gnu 2016-07-16 22:17:04.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: gnu,v 1.16 2015/04/19 22:59:25 christos Exp $ +# $File: gnu,v 1.17 2016/07/16 22:17:04 christos Exp $ # gnu: file(1) magic for various GNU tools # # GNU nlsutils message catalog file format @@ -34,8 +34,11 @@ # This magic is not particularly good, as the keyrings don't have true # magic. Nevertheless, it covers many keyrings. -0 beshort 0x9901 GPG key public ring -!:mime application/x-gnupg-keyring +0 ubeshort-0x9901 <2 +>3 byte 4 +>>4 bedate x GPG key public ring, created %s +!:mime application/x-gnupg-keyring + # Symmetric encryption 0 leshort 0x0d8c diff -Nru file-5.28/magic/Magdir/images file-5.29/magic/Magdir/images --- file-5.28/magic/Magdir/images 2016-03-23 15:29:20.000000000 +0000 +++ file-5.29/magic/Magdir/images 2016-07-05 19:12:21.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: images,v 1.116 2016/03/23 15:29:20 christos Exp $ +# $File: images,v 1.117 2016/07/05 19:12:21 christos Exp $ # images: file(1) magic for image formats (see also "iff", and "c-lang" for # XPM bitmaps) # @@ -171,38 +171,44 @@ >>>&0 regex =[0-9]{1,50} \b %s 0 search/1 P1 ->0 use netpbm ->>0 string x \b, bitmap +>0 regex/4 P1\\s +>>0 use netpbm +>>>0 string x \b, bitmap !:strength + 45 !:mime image/x-portable-bitmap 0 search/1 P2 ->0 use netpbm ->>0 string x \b, greymap +>0 regex/4 P2\\s +>>0 use netpbm +>>>0 string x \b, greymap !:strength + 45 !:mime image/x-portable-greymap 0 search/1 P3 ->0 use netpbm ->>0 string x \b, pixmap +>0 regex/4 P3\\s +>>0 use netpbm +>>>0 string x \b, pixmap !:strength + 45 !:mime image/x-portable-pixmap 0 string P4 ->0 use netpbm ->>0 string x \b, rawbits, bitmap +>0 regex/4 P4\\s +>>0 use netpbm +>>>0 string x \b, rawbits, bitmap !:strength + 45 !:mime image/x-portable-bitmap 0 string P5 ->0 use netpbm ->>0 string x \b, rawbits, greymap +>0 regex/4 P5\\s +>>0 use netpbm +>>>0 string x \b, rawbits, greymap !:strength + 45 !:mime image/x-portable-greymap 0 string P6 ->0 use netpbm ->>0 string x \b, rawbits, pixmap +>0 regex/4 P6\\s +>>0 use netpbm +>>>0 string x \b, rawbits, pixmap !:strength + 45 !:mime image/x-portable-pixmap diff -Nru file-5.28/magic/Magdir/jpeg file-5.29/magic/Magdir/jpeg --- file-5.28/magic/Magdir/jpeg 2015-04-10 15:36:02.000000000 +0000 +++ file-5.29/magic/Magdir/jpeg 2016-07-04 15:18:23.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: jpeg,v 1.29 2015/04/10 15:36:02 christos Exp $ +# $File: jpeg,v 1.30 2016/07/04 15:18:23 christos Exp $ # JPEG images # SunOS 5.5.1 had # @@ -117,3 +117,10 @@ # From: Mathieu Malaterre 0 belong 0xff4fff51 JPEG 2000 codestream 45 beshort 0xff52 + +# JPEG extended range +0 string \x49\x49\xbc +>3 byte 1 +>>4 lelong%2 0 JPEG-XR +!:mime image/jxr +!:ext jxr diff -Nru file-5.28/magic/Magdir/msdos file-5.29/magic/Magdir/msdos --- file-5.28/magic/Magdir/msdos 2016-06-11 00:52:14.000000000 +0000 +++ file-5.29/magic/Magdir/msdos 2016-09-14 01:26:26.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: msdos,v 1.106 2016/06/11 00:52:14 christos Exp $ +# $File: msdos,v 1.111 2016/09/14 01:26:26 christos Exp $ # msdos: file(1) magic for MS-DOS files # @@ -328,15 +328,6 @@ 0 string \xffKEYB\ \ \ \0\0\0\0 >12 string \0\0\0\0`\004\360 MS-DOS KEYBoard Layout file -# .COM formats (Daniel Quinlan, quinlan@yggdrasil.com) -# Uncommenting only the first two lines will cover about 2/3 of COM files, -# but it isn't feasible to match all COM files since there must be at least -# two dozen different one-byte "magics". -# test too generic ? -0 byte 0xe9 DOS executable (COM) ->0x1FE leshort 0xAA55 \b, boot code ->6 string SFX\ of\ LHarc (%s) - # DOS device driver updated by Joerg Jenderek at May 2011 # http://maben.homeip.net/static/S100/IBM/software/DOS/DOS%20techref/CHAPTER.009 0 ulequad&0x07a0ffffffff 0xffffffff DOS executable ( @@ -439,12 +430,37 @@ # byte 0xeb conflicts with "sequent" magic leshort 0xn2eb 0 ubeshort&0xeb8d >0xeb00 # DR-DOS STACKER.COM SCREATE.SYS missed ->0 byte 0xeb ->>0x1FE leshort 0xAA55 DOS executable (COM), boot code ->>85 string UPX DOS executable (COM), UPX compressed ->>4 string \ $ARX DOS executable (COM), ARX self-extracting archive ->>4 string \ $LHarc DOS executable (COM), LHarc self-extracting archive ->>0x20e string SFX\ by\ LARC DOS executable (COM), LARC self-extracting archive + +0 name msdos-com +>0 byte x DOS executable (COM) +>6 string SFX\ of\ LHarc \b, %s +>0x1FE leshort 0xAA55 \b, boot code +>85 string UPX \b, UPX compressed +>4 string \ $ARX \b, ARX self-extracting archive +>4 string \ $LHarc \b, LHarc self-extracting archive +>0x20e string SFX\ by\ LARC \b, LARC self-extracting archive + +# JMP 8bit +0 byte 0xeb +# allow forward jumps only +>1 byte >-1 +# that offset must be accessible +>>(1.b+2) byte x +>>>0 use msdos-com + +# JMP 16bit +0 byte 0xe9 +# forward jumps +>1 short >-1 +# that offset must be accessible +>>(1.s+3) byte x +>>>0 use msdos-com +# negative offset, must not lead into PSP +>1 short <-259 +# that offset must be accessible +>>(1,s+65539) byte x +>>>0 use msdos-com + # updated by Joerg Jenderek at Oct 2008,2015 # following line is too general 0 ubyte 0xb8 @@ -578,17 +594,158 @@ 0 string/b \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet !:mime application/vnd.ms-excel # -0 belong 0x00001a00 Lotus 1-2-3 -!:mime application/x-123 ->4 belong 0x00100400 wk3 document data ->4 belong 0x02100400 wk4 document data ->4 belong 0x07800100 fm3 or fmb document data ->4 belong 0x07800000 fm3 or fmb document data -# -0 belong 0x00000200 Lotus 1-2-3 -!:mime application/x-123 ->4 belong 0x06040600 wk1 document data ->4 belong 0x06800200 fmt document data +# Update: Joerg Jenderek +# URL: https://en.wikipedia.org/wiki/Lotus_1-2-3 +# Reference: http://www.aboutvb.de/bas/formate/pdf/wk3.pdf +# Note: newer Lotus versions >2 use longer BOF record +# record type (BeginningOfFile=0000h) + length (001Ah) +0 belong 0x00001a00 +# reserved should be 0h but 8c0dh for TUTMAC.WK3, 5h for SAMPADNS.WK3, 1h for a_readme.wk3, 1eh for K&G86.WK3 +#>18 uleshort&0x73E0 0 +# Lotus Multi Byte Character Set (LMBCS=1-31) +>20 ubyte >0 +>>20 ubyte <32 Lotus 1-2-3 +#!:mime application/x-123 +!:mime application/vnd.lotus-1-2-3 +!:apple ????L123 +# (version 5.26) labeled the entry as "Lotus 1-2-3 wk3 document data" +>>>4 uleshort 0x1000 WorKsheet, version 3 +!:ext wk3 +# (version 5.26) labeled the entry as "Lotus 1-2-3 wk4 document data" +>>>4 uleshort 0x1002 WorKsheet, version 4 +# also worksheet template 4 (.wt4) +!:ext wk4/wt4 +# no example or documentation for wk5 +#>>4 uleshort 0x???? WorKsheet, version 4 +#!:ext wk5 +# only MacrotoScript.123 example +>>>4 uleshort 0x1003 WorKsheet, version 97 +# also worksheet template Smartmaster (.12M)? +!:ext 123 +# only Set_Y2K.123 example +>>>4 uleshort 0x1005 WorKsheet, version 9.8 Millennium +!:ext 123 +# no example for this version +>>>4 uleshort 0x8001 FoRMatting data +!:ext frm +# (version 5.26) labeled the entry as "Lotus 1-2-3 fm3 or fmb document data" +# TrID labeles the entry as "Formatting Data for Lotus 1-2-3 worksheet" +>>>4 uleshort 0x8007 ForMatting data, version 3 +!:ext fm3 +>>>4 default x unknown +# file revision sub code 0004h for worksheets +>>>>6 uleshort =0x0004 worksheet +!:ext wXX +>>>>6 uleshort !0x0004 formatting data +!:ext fXX +# main revision number +>>>>4 uleshort x \b, revision 0x%x +>>>6 uleshort =0x0004 \b, cell range +# active cellcoord range (start row, page,column ; end row, page, column) +# start values normally 0~1st sheet A1 +>>>>8 ulelong !0 +>>>>>10 ubyte >0 \b%d* +>>>>>8 uleshort x \b%d, +>>>>>11 ubyte x \b%d- +# end page mostly 0 +>>>>14 ubyte >0 \b%d* +# end raw, column normally not 0 +>>>>12 uleshort x \b%d, +>>>>15 ubyte x \b%d +# Lotus Multi Byte Character Set (1~cp850,2~cp851,...,16~japan,...,31~??) +>>>>20 ubyte >1 \b, character set 0x%x +# flags +>>>>21 ubyte x \b, flags 0x%x +>>>6 uleshort !0x0004 +# record type (FONTNAME=00AEh) +>>>>30 search/29 \0\xAE +# variable length m (2) + entries (1) + ?? (1) + LCMBS string (n) +>>>>>&4 string >\0 \b, 1st font "%s" +# +# Update: Joerg Jenderek +# URL: http://fileformats.archiveteam.org/wiki/Lotus_1-2-3 +# Reference: http://www.schnarff.com/file-formats/lotus-1-2-3/WSFF2.TXT +# Note: Used by both old Lotus 1-2-3 and Lotus Symphony (DOS) til version 2.x +# record type (BeginningOfFile=0000h) + length (0002h) +0 belong 0x00000200 +# GRR: line above is too general as it catches also MS Windows CURsor +# to display MS Windows cursor (strength=70) before Lotus 1-2-3 (strength=70-1) +!:strength -1 +# skip Windows cursors with image height <256 and keep Lotus with low opcode 0001-0083h +>7 ubyte 0 +# skip Windows cursors with image width 256 and keep Lotus with positiv opcode +>>6 ubyte >0 Lotus +# !:mime application/x-123 +!:mime application/vnd.lotus-1-2-3 +!:apple ????L123 +# revision number (0404h = 123 1A, 0405h = Lotus Symphony , 0406h = 123 2.x wk1 , 8006h = fmt , ...) +# undocumented; (version 5.26) labeled the configurations as "Lotus 1-2-3" +>>>4 uleshort 0x0007 1-2-3 CoNFiguration, version 2.x (PGRAPH.CNF) +!:ext cnf +>>>4 uleshort 0x0C05 1-2-3 CoNFiguration, version 2.4J +!:ext cnf +>>>4 uleshort 0x0801 1-2-3 CoNFiguration, version 1-2.1 +!:ext cnf +>>>4 uleshort 0x0802 Symphony CoNFiguration +!:ext cnf +>>>4 uleshort 0x0804 1-2-3 CoNFiguration, version 2.2 +!:ext cnf +>>>4 uleshort 0x080A 1-2-3 CoNFiguration, version 2.3-2.4 +!:ext cnf +>>>4 uleshort 0x1402 1-2-3 CoNFiguration, version 3.x +!:ext cnf +>>>4 uleshort 0x1450 1-2-3 CoNFiguration, version 4.x +!:ext cnf +# (version 5.26) labeled the entry as "Lotus 123" +# TrID labeles the entry as "Lotus 123 Worksheet (generic)" +>>>4 uleshort 0x0404 1-2-3 WorKSheet, version 1 +# extension "wks" also for Microsoft Works document +!:ext wks +# (version 5.26) labeled the entry as "Lotus 123" +# TrID labeles the entry as "Lotus 123 Worksheet (generic)" +>>>4 uleshort 0x0405 Symphony WoRksheet, version 1.0 +!:ext wrk/wr1 +# (version 5.26) labeled the entry as "Lotus 1-2-3 wk1 document data" +# TrID labeles the entry as "Lotus 123 Worksheet (V2)" +>>>4 uleshort 0x0406 1-2-3/Symphony worksheet, version 2 +# Symphony (.wr1) +!:ext wk1/wr1 +# no example for this japan version +>>>4 uleshort 0x0600 1-2-3 WorKsheet, version 1.xJ +!:ext wj1 +# no example or documentation for wk2 +#>>>4 uleshort 0x???? 1-2-3 WorKsheet, version 2 +#!:ext wk2 +# undocumented japan version +>>>4 uleshort 0x0602 1-2-3 worksheet, version 2.4J +!:ext wj3 +# (version 5.26) labeled the entry as "Lotus 1-2-3 fmt document data" +>>>4 uleshort 0x8006 1-2-3 ForMaTting data, version 2.x +# japan version 2.4J (fj3) +!:ext fmt/fj3 +# no example for this version +>>>4 uleshort 0x8007 1-2-3 FoRMatting data, version 2.0 +!:ext frm +# (version 5.26) labeled the entry as "Lotus 1-2-3" +>>>4 default x unknown worksheet or configuration +!:ext cnf +>>>>4 uleshort x \b, revision 0x%x +# 2nd record for most worksheets describes cells range +>>>6 use lotus-cells +# 3nd record for most japan worksheets describes cells range +>>>(8.s+10) use lotus-cells +# check and then display Lotus worksheet cells range +0 name lotus-cells +# look for type (RANGE=0006h) + length (0008h) at record begin +>0 ubelong 0x06000800 \b, cell range +# cell range (start column, row, end column, row) start values normally 0,0~A1 cell +>>4 ulong !0 +>>>4 uleshort x \b%d, +>>>6 uleshort x \b%d- +# end of cell range +>>8 uleshort x \b%d, +>>10 uleshort x \b%d +# EndOfLotus123 0 string/b WordPro\0 Lotus WordPro !:mime application/vnd.lotus-wordpro 0 string/b WordPro\r\373 Lotus WordPro @@ -738,24 +895,6 @@ 0 lelong 0x00000005 >12 lelong 0x00000320 Windows Recycle Bin INFO2 file (Win2k - WinXP) - -##### put in Either Magic/font or Magic/news -# Acroread or something files wrongly identified as G3 .pfm -# these have the form \000 \001 any? \002 \000 \000 -# or \000 \001 any? \022 \000 \000 -0 belong&0xffff00ff 0x00010012 PFM data ->4 string \000\000 ->6 string >\060 - %s - -0 belong&0xffff00ff 0x00010002 PFM data ->4 string \000\000 ->6 string >\060 - %s -#0 string \000\001 pfm? -#>3 string \022\000\000Copyright\ yes -#>3 string \002\000\000Copyright\ yes -#>3 string >\0 oops, not a font file. Cancel that. -#it clashes with ttf files so put it lower down. - # From Doug Lee via a FreeBSD pr 9 string GERBILDOC First Choice document 9 string GERBILDB First Choice database @@ -940,7 +1079,8 @@ # Type: Microsoft Document Imaging Format (.mdi) # URL: http://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format # From: Daniele Sempione -0 short 0x5045 Microsoft Document Imaging Format +# Too weak (EP) +#0 short 0x5045 Microsoft Document Imaging Format # MS eBook format (.lit) 0 string/b ITOLITLS Microsoft Reader eBook Data diff -Nru file-5.28/magic/Magdir/pgp file-5.29/magic/Magdir/pgp --- file-5.28/magic/Magdir/pgp 2014-11-11 21:32:38.000000000 +0000 +++ file-5.29/magic/Magdir/pgp 2016-10-07 20:22:12.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: pgp,v 1.11 2014/11/11 21:32:38 christos Exp $ +# $File: pgp,v 1.12 2016/10/07 20:22:12 christos Exp $ # pgp: file(1) magic for Pretty Good Privacy # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html # @@ -194,6 +194,23 @@ >0 byte 0x0a SHA512 >0 byte 0x0b SHA224 +# display public key algorithms as human readable text +0 name key_algo +>0 byte 0x01 RSA (Encrypt or Sign) +# keep old look of version 5.28 without parentheses +>0 byte 0x02 RSA Encrypt-Only +>0 byte 0x03 RSA (Sign-Only) +>0 byte 16 ElGamal (Encrypt-Only) +>0 byte 17 DSA +>0 byte 18 Elliptic Curve +>0 byte 19 ECDSA +>0 byte 20 ElGamal (Encrypt or Sign) +>0 byte 21 Diffie-Hellman +>0 default x +>>0 ubyte <22 unknown (pub %d) +# this should never happen +>>0 ubyte >21 invalid (%d) + # pgp symmetric encrypted data 0 byte 0x8c PGP symmetric key encrypted data - @@ -465,5 +482,41 @@ >1 use pgpkey 0 byte 0x97 PGP Secret Sub-key - >1 use pgpkey -0 byte 0x9d PGP Secret Sub-key - ->1 use pgpkey +0 byte 0x9d +# Update: Joerg Jenderek +# secret subkey packet (tag 7) with same structure as secret key packet (tag 5) +# skip Fetus.Sys16 CALIBUS.MAIN OrbFix.Sys16.Ex by looking for positive len +>1 ubeshort >0 +#>1 ubeshort x \b, body length 0x%x +# next packet type often 88h,89h~(tag 2)~Signature Packet +#>>(1.S+3) ubyte x \b, next packet type 0x%x +# skip Dragon.SHR DEMO.INIT by looking for positive version +>>3 ubyte >0 +# skip BUISSON.13 GUITAR1 by looking for low version number +>>>3 ubyte <5 PGP Secret Sub-key +# sub-key are normally part of secret key. So it does not occur as standalone file +#!:ext bin +# version 2,3~old 4~new . Comment following line for version 5.28 look +>>>>3 ubyte x (v%d) +>>>>3 ubyte x - +# old versions 2 or 3 but no real example found +>>>>3 ubyte <4 +# 2 byte for key bits in version 5.28 look +>>>>>11 ubeshort x %db +>>>>>4 beldate x created on %s - +# old versions use 2 additional bytes after time stamp +#>>>>>8 ubeshort x 0x%x +# display key algorithm 1~RSA Encrypt|Sign - 21~Diffie-Hellman +>>>>>10 use key_algo +>>>>>(11.S/8) ubequad x +# look after first key +>>>>>>&5 use keyend +# new version +>>>>3 ubyte >3 +>>>>>9 ubeshort x %db +>>>>>4 beldate x created on %s - +# display key algorithm +>>>>>8 use key_algo +>>>>>(9.S/8) ubequad x +# look after first key for something like s2k +>>>>>>&3 use keyend diff -Nru file-5.28/magic/Magdir/psl file-5.29/magic/Magdir/psl --- file-5.28/magic/Magdir/psl 1970-01-01 00:00:00.000000000 +0000 +++ file-5.29/magic/Magdir/psl 2016-07-14 17:34:27.000000000 +0000 @@ -0,0 +1,14 @@ + +#------------------------------------------------------------------------------ +# $File: psl,v 1.2 2016/07/14 17:34:27 christos Exp $ +# psl: file(1) magic for Public Suffix List representations +# From: Daniel Kahn Gillmor +# URL: https://publicsuffix.org +# see also: http://thread.gmane.org/gmane.network.dns.libpsl.bugs/162/focus=166 + +0 search/512 \n\n//\ ===BEGIN\ ICANN\ DOMAINS===\n\n Public Suffix List data + +0 string .DAFSA@PSL_ +>15 string \n Public Suffix List data (optimized) +>>11 byte >0x2f +>>>11 byte <0x3a (Version %c) diff -Nru file-5.28/magic/Magdir/python file-5.29/magic/Magdir/python --- file-5.28/magic/Magdir/python 2015-09-16 22:19:54.000000000 +0000 +++ file-5.29/magic/Magdir/python 2016-09-16 12:06:13.000000000 +0000 @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: python,v 1.28 2015/09/16 22:19:54 christos Exp $ +# $File: python,v 1.29 2016/07/27 09:42:16 rrt Exp $ # python: file(1) magic for python # # Outlook puts """ too for urgent messages @@ -9,7 +9,7 @@ 0 string/t """ Python script text executable # MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming # that Py_UnicodeFlag is off for Python 2) -# 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n" +# two bytes of magic followed by "\r\n" in little endian order 0 belong 0x994e0d0a python 1.5/1.6 byte-compiled 0 belong 0x87c60d0a python 2.0 byte-compiled 0 belong 0x2aeb0d0a python 2.1 byte-compiled @@ -24,6 +24,7 @@ 0 belong 0x6c0c0d0a python 3.2 byte-compiled 0 belong 0x9e0c0d0a python 3.3 byte-compiled 0 belong 0xee0c0d0a python 3.4 byte-compiled +0 belong 0x160d0d0a python 3.5 byte-compiled 0 search/1/w #!\ /usr/bin/python Python script text executable !:strength + 15 diff -Nru file-5.28/magic/Magdir/ruby file-5.29/magic/Magdir/ruby --- file-5.28/magic/Magdir/ruby 2014-09-11 15:03:07.000000000 +0000 +++ file-5.29/magic/Magdir/ruby 2016-09-16 12:06:13.000000000 +0000 @@ -1,18 +1,22 @@ #------------------------------------------------------------------------------ -# $File: ruby,v 1.5 2010/07/21 16:47:17 christos Exp $ +# $File: ruby,v 1.6 2016/07/27 09:46:29 rrt Exp $ # ruby: file(1) magic for Ruby scripting language # URL: http://www.ruby-lang.org/ # From: Reuben Thomas # Ruby scripts 0 search/1/w #!\ /usr/bin/ruby Ruby script text executable +!:strength + 15 !:mime text/x-ruby 0 search/1/w #!\ /usr/local/bin/ruby Ruby script text executable +!:strength + 15 !:mime text/x-ruby 0 search/1 #!/usr/bin/env\ ruby Ruby script text executable +!:strength + 15 !:mime text/x-ruby 0 search/1 #!\ /usr/bin/env\ ruby Ruby script text executable +!:strength + 15 !:mime text/x-ruby # What looks like ruby, but does not have a shebang diff -Nru file-5.28/magic/Magdir/sgml file-5.29/magic/Magdir/sgml --- file-5.28/magic/Magdir/sgml 2015-11-29 22:14:49.000000000 +0000 +++ file-5.29/magic/Magdir/sgml 2016-09-11 13:56:42.000000000 +0000 @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------ # $File: sgml,v 1.33 2015/11/29 22:14:49 christos Exp $ +#------------------------------------------------------------------------------ # $File: sgml,v 1.34 2016/09/11 13:56:42 christos Exp $ # Type: SVG Vectorial Graphics # From: Noel Torres 0 string \>19 search/4096 \ @@ -10,25 +10,67 @@ # 0 beshort 0xfe01 MySQL table definition file >2 byte x Version %d +>3 byte 0 \b, type UNKNOWN +>3 byte 1 \b, type DIAM_ISAM +>3 byte 2 \b, type HASH +>3 byte 3 \b, type MISAM +>3 byte 4 \b, type PISAM +>3 byte 5 \b, type RMS_ISAM +>3 byte 6 \b, type HEAP +>3 byte 7 \b, type ISAM +>3 byte 8 \b, type MRG_ISAM +>3 byte 9 \b, type MYISAM +>3 byte 10 \b, type MRG_MYISAM +>3 byte 11 \b, type BERKELEY_DB +>3 byte 12 \b, type INNODB +>3 byte 13 \b, type GEMINI +>3 byte 14 \b, type NDBCLUSTER +>3 byte 15 \b, type EXAMPLE_DB +>3 byte 16 \b, type CSV_DB +>3 byte 17 \b, type FEDERATED_DB +>3 byte 18 \b, type BLACKHOLE_DB +>3 byte 19 \b, type PARTITION_DB +>3 byte 20 \b, type BINLOG +>3 byte 21 \b, type SOLID +>3 byte 22 \b, type PBXT +>3 byte 23 \b, type TABLE_FUNCTION +>3 byte 24 \b, type MEMCACHE +>3 byte 25 \b, type FALCON +>3 byte 26 \b, type MARIA +>3 byte 27 \b, type PERFORMANCE_SCHEMA +>3 byte 127 \b, type DEFAULT +>0x0033 ulong x \b, MySQL version %d +0 belong&0xffffff00 0xfefe0500 MySQL ISAM index file +>3 byte x Version %d +0 belong&0xffffff00 0xfefe0600 MySQL ISAM compressed data file +>3 byte x Version %d 0 belong&0xffffff00 0xfefe0700 MySQL MyISAM index file >3 byte x Version %d +>14 beshort x \b, %d key parts +>16 beshort x \b, %d unique key parts +>18 byte x \b, %d keys +>28 bequad x \b, %lld records +>36 bequad x \b, %lld deleted records 0 belong&0xffffff00 0xfefe0800 MySQL MyISAM compressed data file >3 byte x Version %d 0 belong&0xffffff00 0xfefe0900 MySQL Maria index file >3 byte x Version %d -0 belong&0xffffff00 0xfefe0A00 MySQL Maria compressed data file +0 belong&0xffffff00 0xfefe0a00 MySQL Maria compressed data file >3 byte x Version %d -0 belong&0xffffff00 0xfefe0500 MySQL ISAM index file ->3 byte x Version %d -0 belong&0xffffff00 0xfefe0600 MySQL ISAM compressed data file ->3 byte x Version %d -0 string \376bin MySQL replication log -0 belong&0xffffff00 0xfefe0b00 ->4 string MARIALOG MySQL Maria transaction log file ->>3 byte x Version %d 0 belong&0xffffff00 0xfefe0c00 >4 string MACF MySQL Maria control file >>3 byte x Version %d +0 string \376bin MySQL replication log, +>9 long x server id %d +>8 byte 1 +>>13 long 69 \b, MySQL V3.2.3 +>>>19 string x \b, server version %s +>>13 long 75 \b, MySQL V4.0.2-V4.1 +>>>25 string x \b, server version %s +>8 byte 15 MySQL V5+, +>>25 string x server version %s +>4 string MARIALOG MySQL Maria transaction log file +>>3 byte x Version %d #------------------------------------------------------------------------------ # iRiver H Series database file @@ -94,3 +136,6 @@ >126 string SQLite\ format\ 3 #!:mime application/x-panasonic-sqlite3 >>&-15 indirect x \b; contains + +# H2 Database from http://www.h2database.com/ +0 string --\ H2\ 0.5/B\ --\ \n H2 Database file diff -Nru file-5.28/magic/Makefile.am file-5.29/magic/Makefile.am --- file-5.28/magic/Makefile.am 2016-06-13 19:09:31.000000000 +0000 +++ file-5.29/magic/Makefile.am 2016-10-17 19:52:29.000000000 +0000 @@ -1,5 +1,5 @@ # -# $File: Makefile.am,v 1.116 2016/06/13 19:09:31 christos Exp $ +# $File: Makefile.am,v 1.120 2016/10/17 19:52:29 christos Exp $ # MAGIC_FRAGMENT_BASE = Magdir MAGIC_DIR = $(top_srcdir)/magic @@ -13,6 +13,7 @@ $(MAGIC_FRAGMENT_DIR)/acorn \ $(MAGIC_FRAGMENT_DIR)/adi \ $(MAGIC_FRAGMENT_DIR)/adventure \ +$(MAGIC_FRAGMENT_DIR)/algol68 \ $(MAGIC_FRAGMENT_DIR)/allegro \ $(MAGIC_FRAGMENT_DIR)/alliant \ $(MAGIC_FRAGMENT_DIR)/amanda \ @@ -22,7 +23,9 @@ $(MAGIC_FRAGMENT_DIR)/aout \ $(MAGIC_FRAGMENT_DIR)/apl \ $(MAGIC_FRAGMENT_DIR)/apple \ +$(MAGIC_FRAGMENT_DIR)/application \ $(MAGIC_FRAGMENT_DIR)/applix \ +$(MAGIC_FRAGMENT_DIR)/apt \ $(MAGIC_FRAGMENT_DIR)/archive \ $(MAGIC_FRAGMENT_DIR)/assembler \ $(MAGIC_FRAGMENT_DIR)/asterix \ @@ -207,6 +210,7 @@ $(MAGIC_FRAGMENT_DIR)/printer \ $(MAGIC_FRAGMENT_DIR)/project \ $(MAGIC_FRAGMENT_DIR)/psdbms \ +$(MAGIC_FRAGMENT_DIR)/psl \ $(MAGIC_FRAGMENT_DIR)/pulsar \ $(MAGIC_FRAGMENT_DIR)/pwsafe \ $(MAGIC_FRAGMENT_DIR)/pyramid \ diff -Nru file-5.28/magic/Makefile.in file-5.29/magic/Makefile.in --- file-5.28/magic/Makefile.in 2016-06-13 23:44:06.000000000 +0000 +++ file-5.29/magic/Makefile.in 2016-10-25 14:40:27.000000000 +0000 @@ -273,7 +273,7 @@ top_srcdir = @top_srcdir@ # -# $File: Makefile.am,v 1.116 2016/06/13 19:09:31 christos Exp $ +# $File: Makefile.am,v 1.120 2016/10/17 19:52:29 christos Exp $ # MAGIC_FRAGMENT_BASE = Magdir MAGIC_DIR = $(top_srcdir)/magic @@ -285,6 +285,7 @@ $(MAGIC_FRAGMENT_DIR)/acorn \ $(MAGIC_FRAGMENT_DIR)/adi \ $(MAGIC_FRAGMENT_DIR)/adventure \ +$(MAGIC_FRAGMENT_DIR)/algol68 \ $(MAGIC_FRAGMENT_DIR)/allegro \ $(MAGIC_FRAGMENT_DIR)/alliant \ $(MAGIC_FRAGMENT_DIR)/amanda \ @@ -294,7 +295,9 @@ $(MAGIC_FRAGMENT_DIR)/aout \ $(MAGIC_FRAGMENT_DIR)/apl \ $(MAGIC_FRAGMENT_DIR)/apple \ +$(MAGIC_FRAGMENT_DIR)/application \ $(MAGIC_FRAGMENT_DIR)/applix \ +$(MAGIC_FRAGMENT_DIR)/apt \ $(MAGIC_FRAGMENT_DIR)/archive \ $(MAGIC_FRAGMENT_DIR)/assembler \ $(MAGIC_FRAGMENT_DIR)/asterix \ @@ -479,6 +482,7 @@ $(MAGIC_FRAGMENT_DIR)/printer \ $(MAGIC_FRAGMENT_DIR)/project \ $(MAGIC_FRAGMENT_DIR)/psdbms \ +$(MAGIC_FRAGMENT_DIR)/psl \ $(MAGIC_FRAGMENT_DIR)/pulsar \ $(MAGIC_FRAGMENT_DIR)/pwsafe \ $(MAGIC_FRAGMENT_DIR)/pyramid \ diff -Nru file-5.28/python/magic.py file-5.29/python/magic.py --- file-5.28/python/magic.py 2016-02-02 19:04:27.000000000 +0000 +++ file-5.29/python/magic.py 2016-06-30 14:51:08.000000000 +0000 @@ -134,7 +134,7 @@ if isinstance(r, str): return r else: - return str(r).encode('utf-8') + return str(r, 'utf-8') def descriptor(self, fd): """ @@ -152,7 +152,7 @@ if isinstance(r, str): return r else: - return str(r).encode('utf-8') + return str(r, 'utf-8') def error(self): """ @@ -163,7 +163,7 @@ if isinstance(e, str): return e else: - return str(e).encode('utf-8') + return str(e, 'utf-8') def setflags(self, flags): """ diff -Nru file-5.28/src/apprentice.c file-5.29/src/apprentice.c --- file-5.28/src/apprentice.c 2016-05-17 21:43:07.000000000 +0000 +++ file-5.29/src/apprentice.c 2016-10-24 18:02:17.000000000 +0000 @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: apprentice.c,v 1.249 2016/05/17 21:43:07 christos Exp $") +FILE_RCSID("@(#)$File: apprentice.c,v 1.255 2016/10/24 18:02:17 christos Exp $") #endif /* lint */ #include "magic.h" @@ -408,11 +408,11 @@ { struct mlist *ml; - mlp->map = idx == 0 ? map : NULL; + mlp->map = NULL; if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL) return -1; - ml->map = NULL; + ml->map = idx == 0 ? map : NULL; ml->magic = map->magic[idx]; ml->nmagic = map->nmagic[idx]; @@ -451,6 +451,8 @@ #ifndef COMPILE_ONLY map = apprentice_map(ms, fn); + if (map == (struct magic_map *)-1) + return -1; if (map == NULL) { if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "using regular magic file `%s'", fn); @@ -462,7 +464,7 @@ for (i = 0; i < MAGIC_SETS; i++) { if (add_mlist(ms->mlist[i], map, i) == -1) { file_oomem(ms, sizeof(*ml)); - goto fail; + return -1; } } @@ -476,12 +478,6 @@ } } return 0; -fail: - for (i = 0; i < MAGIC_SETS; i++) { - mlist_free(ms->mlist[i]); - ms->mlist[i] = NULL; - } - return -1; #else return 0; #endif /* COMPILE_ONLY */ @@ -554,7 +550,7 @@ case MAP_TYPE_MALLOC: for (i = 0; i < MAGIC_SETS; i++) { if ((char *)map->magic[i] >= (char *)map->p && - (char *)map->magic[i] < (char *)map->p + map->len) + (char *)map->magic[i] <= (char *)map->p + map->len) continue; free(map->magic[i]); } @@ -594,7 +590,7 @@ ml = mlist->next; for (ml = mlist->next; (next = ml->next) != NULL; ml = next) { if (ml->map) - apprentice_unmap(ml->map); + apprentice_unmap(CAST(struct magic_map *, ml->map)); free(ml); if (ml == mlist) break; @@ -1879,10 +1875,13 @@ if (m->flag & INDIR) { m->in_type = FILE_LONG; m->in_offset = 0; + m->in_op = 0; /* - * read [.lbs][+-]nnnnn) + * read [.,lbs][+-]nnnnn) */ - if (*l == '.') { + if (*l == '.' || *l == ',') { + if (*l == ',') + m->in_op |= FILE_OPSIGNED; l++; switch (*l) { case 'l': @@ -1934,7 +1933,6 @@ l++; } - m->in_op = 0; if (*l == '~') { m->in_op |= FILE_OPINVERSE; l++; @@ -2930,6 +2928,7 @@ struct stat st; char *dbname = NULL; struct magic_map *map; + struct magic_map *rv = NULL; fd = -1; if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) { @@ -2978,8 +2977,10 @@ (void)close(fd); fd = -1; - if (check_buffer(ms, map, dbname) != 0) + if (check_buffer(ms, map, dbname) != 0) { + rv = (struct magic_map *)-1; goto error; + } #ifdef QUICK if (mprotect(map->p, (size_t)st.st_size, PROT_READ) == -1) { file_error(ms, errno, "cannot mprotect `%s'", dbname); @@ -2995,7 +2996,7 @@ (void)close(fd); apprentice_unmap(map); free(dbname); - return NULL; + return rv; } private int @@ -3151,7 +3152,7 @@ return NULL; /* Compatibility with old code that looked in .mime */ - if (strstr(p, ".mime") != NULL) + if (strstr(fn, ".mime") != NULL) ms->flags &= MAGIC_MIME_TYPE; return buf; } diff -Nru file-5.28/src/ascmagic.c file-5.29/src/ascmagic.c --- file-5.28/src/ascmagic.c 2016-05-03 16:10:37.000000000 +0000 +++ file-5.29/src/ascmagic.c 2016-06-27 20:56:25.000000000 +0000 @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: ascmagic.c,v 1.95 2016/05/03 16:10:37 christos Exp $") +FILE_RCSID("@(#)$File: ascmagic.c,v 1.97 2016/06/27 20:56:25 christos Exp $") #endif /* lint */ #include "magic.h" @@ -144,8 +144,10 @@ (size_t)(utf8_end - utf8_buf), NULL, NULL, TEXTTEST, text)) == 0) rv = -1; - if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) - return rv == -1 ? 0 : 1; + if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) { + rv = rv == -1 ? 0 : 1; + goto done; + } } if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) return 0; diff -Nru file-5.28/src/cdf.c file-5.29/src/cdf.c --- file-5.28/src/cdf.c 2016-06-05 00:14:26.000000000 +0000 +++ file-5.29/src/cdf.c 2016-10-24 18:02:17.000000000 +0000 @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.82 2016/06/01 22:25:25 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.85 2016/10/24 18:02:17 christos Exp $") #endif #include @@ -266,7 +266,7 @@ CDF_UNPACK(d->d_unused0); } -static int +int cdf_zero_stream(cdf_stream_t *scn) { scn->sst_len = 0; @@ -731,22 +731,25 @@ break; /* If the it is not there, just fake it; some docs don't have it */ - if (i == dir->dir_len) + if (i == dir->dir_len) { + DPRINTF(("Cannot find root storage dir\n")); goto out; + } d = &dir->dir_tab[i]; *root = d; /* If the it is not there, just fake it; some docs don't have it */ - if (d->d_stream_first_sector < 0) + if (d->d_stream_first_sector < 0) { + DPRINTF(("No first secror in dir\n")); goto out; + } return cdf_read_long_sector_chain(info, h, sat, d->d_stream_first_sector, d->d_size, scn); out: scn->sst_tab = NULL; (void)cdf_zero_stream(scn); - errno = EFTYPE; - return -1; + return 0; } static int @@ -759,6 +762,15 @@ } int +cdf_read_doc_summary_info(const cdf_info_t *info, const cdf_header_t *h, + const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, + const cdf_dir_t *dir, cdf_stream_t *scn) +{ + return cdf_read_user_stream(info, h, sat, ssat, sst, dir, + "\05DocumentSummaryInformation", scn); +} + +int cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn) @@ -1098,7 +1110,7 @@ cep->ce_namlen = rlen; np = CAST(const uint16_t *, CAST(const void *, (b + 16))); - if (CAST(const char *, np + cep->ce_namlen) > eb) { + if (RCAST(const char *, np + cep->ce_namlen) > eb) { cep->ce_namlen = 0; break; } @@ -1275,7 +1287,7 @@ } void -cdf_dump_stream(const cdf_header_t *h, const cdf_stream_t *sst) +cdf_dump_stream(const cdf_stream_t *sst) { size_t ss = sst->sst_ss; cdf_dump(sst->sst_tab, ss * sst->sst_len); @@ -1331,7 +1343,7 @@ name, d->d_stream_first_sector, d->d_size); break; } - cdf_dump_stream(h, &scn); + cdf_dump_stream(&scn); free(scn.sst_tab); break; default: @@ -1507,7 +1519,7 @@ == -1) err(1, "Cannot read short stream"); #ifdef CDF_DEBUG - cdf_dump_stream(&h, &sst); + cdf_dump_stream(&sst); #endif #ifdef CDF_DEBUG diff -Nru file-5.28/src/cdf.h file-5.29/src/cdf.h --- file-5.28/src/cdf.h 2016-04-22 16:06:56.000000000 +0000 +++ file-5.29/src/cdf.h 2016-10-17 15:21:48.000000000 +0000 @@ -316,6 +316,10 @@ const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *, const char *, cdf_stream_t *); int cdf_find_stream(const cdf_dir_t *, const char *, int); +int cdf_zero_stream(cdf_stream_t *); +int cdf_read_doc_summary_info(const cdf_info_t *, const cdf_header_t *, + const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, + const cdf_dir_t *, cdf_stream_t *); int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *, cdf_stream_t *); @@ -336,7 +340,7 @@ void cdf_dump_header(const cdf_header_t *); void cdf_dump_sat(const char *, const cdf_sat_t *, size_t); void cdf_dump(const void *, size_t); -void cdf_dump_stream(const cdf_header_t *, const cdf_stream_t *); +void cdf_dump_stream(const cdf_stream_t *); void cdf_dump_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *); void cdf_dump_property_info(const cdf_property_info_t *, size_t); diff -Nru file-5.28/src/compress.c file-5.29/src/compress.c --- file-5.28/src/compress.c 2016-05-13 23:02:28.000000000 +0000 +++ file-5.29/src/compress.c 2016-10-24 18:02:17.000000000 +0000 @@ -35,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: compress.c,v 1.97 2016/05/13 23:02:28 christos Exp $") +FILE_RCSID("@(#)$File: compress.c,v 1.100 2016/10/24 18:02:17 christos Exp $") #endif #include "magic.h" @@ -132,6 +132,9 @@ static const char *lz4_args[] = { "lz4", "-cd", NULL }; +static const char *zstd_args[] = { + "zstd", "-cd", NULL +}; private const struct { const void *magic; @@ -154,8 +157,9 @@ { "\3757zXZ\0", 6, xz_args }, /* XZ Utils */ { "LRZI", 4, lrzip_args }, /* LRZIP */ { "\004\"M\030",4, lz4_args }, /* LZ4 */ + { "\x28\xB5\x2F\xFD", 4, zstd_args }, /* zstd */ #ifdef ZLIBSUPPORT - { zlibcmp, 0, zlib_args }, /* zlib */ + { RCAST(const void *, zlibcmp), 0, zlib_args }, /* zlib */ #endif }; @@ -204,7 +208,7 @@ continue; #ifdef ZLIBSUPPORT if (compr[i].maglen == 0) - zm = (CAST(int (*)(const unsigned char *), + zm = (RCAST(int (*)(const unsigned char *), CCAST(void *, compr[i].magic)))(buf); else #endif @@ -362,7 +366,7 @@ return rn - n; default: n -= rv; - buf = ((char *)buf) + rv; + buf = CAST(char *, CCAST(void *, buf)) + rv; break; } while (n > 0); @@ -517,7 +521,7 @@ return OKDATA; err: - strlcpy((char *)*newch, z.msg, bytes_max); + strlcpy((char *)*newch, z.msg ? z.msg : zError(rc), bytes_max); *n = strlen((char *)*newch); return ERRDATA; } diff -Nru file-5.28/src/der.c file-5.29/src/der.c --- file-5.28/src/der.c 2016-06-05 00:14:43.000000000 +0000 +++ file-5.29/src/der.c 2016-10-24 18:02:17.000000000 +0000 @@ -35,13 +35,11 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: der.c,v 1.7 2016/06/01 22:01:15 christos Exp $") +FILE_RCSID("@(#)$File: der.c,v 1.10 2016/10/24 18:02:17 christos Exp $") #endif #endif #include -#include -#include #include #include @@ -53,6 +51,8 @@ #include "magic.h" #include "der.h" #else +#include +#include #include #endif @@ -181,6 +181,8 @@ for (i = 0; i < digits; i++) len = (len << 8) | c[(*p)++]; + if (*p + len >= l) + return DER_BAD; return len; } @@ -198,7 +200,7 @@ static int der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len) { - const uint8_t *d = q; + const uint8_t *d = CAST(const uint8_t *, q); switch (tag) { case DER_TAG_PRINTABLE_STRING: case DER_TAG_UTF8_STRING: @@ -220,7 +222,7 @@ int32_t der_offs(struct magic_set *ms, struct magic *m, size_t nbytes) { - const uint8_t *b = CAST(const void *, ms->search.s); + const uint8_t *b = RCAST(const uint8_t *, ms->search.s); size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes; if (gettag(b, &offs, len) == DER_BAD) @@ -251,7 +253,7 @@ int der_cmp(struct magic_set *ms, struct magic *m) { - const uint8_t *b = CAST(const void *, ms->search.s); + const uint8_t *b = RCAST(const uint8_t *, ms->search.s); const char *s = m->value.s; size_t offs = 0, len = ms->search.s_len; uint32_t tag, tlen; diff -Nru file-5.28/src/file.c file-5.29/src/file.c --- file-5.28/src/file.c 2016-05-17 15:52:45.000000000 +0000 +++ file-5.29/src/file.c 2016-10-24 15:21:07.000000000 +0000 @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: file.c,v 1.171 2016/05/17 15:52:45 christos Exp $") +FILE_RCSID("@(#)$File: file.c,v 1.172 2016/10/24 15:21:07 christos Exp $") #endif /* lint */ #include "magic.h" @@ -431,6 +431,8 @@ load(const char *magicfile, int flags) { struct magic_set *magic = magic_open(flags); + const char *e; + if (magic == NULL) { (void)fprintf(stderr, "%s: %s\n", progname, strerror(errno)); return NULL; @@ -441,6 +443,8 @@ magic_close(magic); return NULL; } + if ((e = magic_error(magic)) != NULL) + (void)fprintf(stderr, "%s: Warning: %s\n", progname, e); return magic; } diff -Nru file-5.28/src/file.h file-5.29/src/file.h --- file-5.28/src/file.h 2016-03-31 17:51:12.000000000 +0000 +++ file-5.29/src/file.h 2016-07-20 11:27:08.000000000 +0000 @@ -27,7 +27,7 @@ */ /* * file.h - definitions for file(1) program - * @(#)$File: file.h,v 1.178 2016/03/31 17:51:12 christos Exp $ + * @(#)$File: file.h,v 1.180 2016/07/20 11:27:08 christos Exp $ */ #ifndef __file_h__ @@ -134,11 +134,11 @@ or directory */ #define MAXDESC 64 /* max len of text description/MIME type */ #define MAXMIME 80 /* max len of text MIME type */ -#define MAXstring 64 /* max len of "string" types */ +#define MAXstring 96 /* max len of "string" types */ #define MAGICNO 0xF11E041C -#define VERSIONNO 13 -#define FILE_MAGICSIZE 312 +#define VERSIONNO 14 +#define FILE_MAGICSIZE 344 #define FILE_LOAD 0 #define FILE_CHECK 1 @@ -275,7 +275,7 @@ #define FILE_OPS_MASK 0x07 /* mask for above ops */ #define FILE_UNUSED_1 0x08 #define FILE_UNUSED_2 0x10 -#define FILE_UNUSED_3 0x20 +#define FILE_OPSIGNED 0x20 #define FILE_OPINVERSE 0x40 #define FILE_OPINDIRECT 0x80 diff -Nru file-5.28/src/funcs.c file-5.29/src/funcs.c --- file-5.28/src/funcs.c 2016-05-03 16:09:47.000000000 +0000 +++ file-5.29/src/funcs.c 2016-10-19 20:51:17.000000000 +0000 @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.89 2016/03/21 15:56:53 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.90 2016/10/19 20:51:17 christos Exp $") #endif /* lint */ #include "magic.h" @@ -250,7 +250,7 @@ } /* try soft magic tests */ - if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) + if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) { m = file_softmagic(ms, ubuf, nb, NULL, NULL, BINTEST, looks_text); if ((ms->flags & MAGIC_DEBUG) != 0) @@ -277,6 +277,7 @@ if (checkdone(ms, &rv)) goto done; } + } /* try text properties */ if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) { diff -Nru file-5.28/src/magic.c file-5.29/src/magic.c --- file-5.28/src/magic.c 2016-05-03 16:09:38.000000000 +0000 +++ file-5.29/src/magic.c 2016-07-18 11:43:05.000000000 +0000 @@ -33,7 +33,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: magic.c,v 1.99 2016/05/03 16:09:38 christos Exp $") +FILE_RCSID("@(#)$File: magic.c,v 1.100 2016/07/18 11:43:05 christos Exp $") #endif /* lint */ #include "magic.h" @@ -492,7 +492,7 @@ if (r < PIPE_BUF) break; } - if (nbytes == 0) { + if (nbytes == 0 && inname) { /* We can not read it, but we were able to stat it. */ if (unreadable_info(ms, sb.st_mode, inname) == -1) goto done; diff -Nru file-5.28/src/readcdf.c file-5.29/src/readcdf.c --- file-5.28/src/readcdf.c 2016-05-03 16:08:49.000000000 +0000 +++ file-5.29/src/readcdf.c 2016-10-18 22:25:42.000000000 +0000 @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008 Christos Zoulas + * Copyright (c) 2008, 2016 Christos Zoulas * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readcdf.c,v 1.57 2016/05/03 16:08:49 christos Exp $") +FILE_RCSID("@(#)$File: readcdf.c,v 1.63 2016/10/18 22:25:42 christos Exp $") #endif #include @@ -373,13 +373,61 @@ dir, "Catalog", scn)) == -1) return i; #ifdef CDF_DEBUG - cdf_dump_catalog(&h, scn); + cdf_dump_catalog(h, scn); #endif if ((i = cdf_file_catalog(ms, h, scn)) == -1) return -1; return i; } +private int +cdf_check_summary_info(struct magic_set *ms, const cdf_info_t *info, + const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, + const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn, + const cdf_directory_t *root_storage, const char **expn) +{ + int i; + const char *str = NULL; + cdf_directory_t *d; + char name[__arraycount(d->d_name)]; + size_t j, k; + +#ifdef CDF_DEBUG + cdf_dump_summary_info(h, scn); +#endif + if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) { + *expn = "Can't expand summary_info"; + return i; + } + if (i == 1) + return i; + for (j = 0; str == NULL && j < dir->dir_len; j++) { + d = &dir->dir_tab[j]; + for (k = 0; k < sizeof(name); k++) + name[k] = (char)cdf_tole2(d->d_name[k]); + str = cdf_app_to_mime(name, + NOTMIME(ms) ? name2desc : name2mime); + } + if (NOTMIME(ms)) { + if (str != NULL) { + if (file_printf(ms, "%s", str) == -1) + return -1; + i = 1; + } + } else { + if (str == NULL) + str = "vnd.ms-office"; + if (file_printf(ms, "application/%s", str) == -1) + return -1; + i = 1; + } + if (i <= 0) { + i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst, + dir, scn); + } + return i; +} + private struct sinfo { const char *name; const char *mime; @@ -388,10 +436,13 @@ } sectioninfo[] = { { "Encrypted", "encrypted", { - "EncryptedPackage", NULL, NULL, NULL, NULL, + "EncryptedPackage", "EncryptedSummary", + NULL, NULL, NULL, }, { - CDF_DIR_TYPE_USER_STREAM, 0, 0, 0, 0, + CDF_DIR_TYPE_USER_STREAM, + CDF_DIR_TYPE_USER_STREAM, + 0, 0, 0, }, }, @@ -412,6 +463,46 @@ 0, 0, 0, 0 }, }, + { "Microsoft Excel", "vnd.ms-excel", + { + "Book", "Workbook", NULL, NULL, NULL, + }, + { + CDF_DIR_TYPE_USER_STREAM, + CDF_DIR_TYPE_USER_STREAM, + 0, 0, 0, + }, + }, + { "Microsoft Word", "msword", + { + "WordDocument", NULL, NULL, NULL, NULL, + }, + { + CDF_DIR_TYPE_USER_STREAM, + 0, 0, 0, 0, + }, + }, + { "Microsoft PowerPoint", "vnd.ms-powerpoint", + { + "PowerPoint", NULL, NULL, NULL, NULL, + }, + { + CDF_DIR_TYPE_USER_STREAM, + 0, 0, 0, 0, + }, + }, + { "Microsoft Outlook Message", "vnd.ms-outlook", + { + "__properties_version1.0", + "__recip_version1.0_#00000000", + NULL, NULL, NULL, + }, + { + CDF_DIR_TYPE_USER_STREAM, + CDF_DIR_TYPE_USER_STORAGE, + 0, 0, 0, + }, + }, }; private int @@ -423,22 +514,19 @@ const struct sinfo *si = §ioninfo[sd]; for (j = 0; si->sections[j]; j++) { if (cdf_find_stream(dir, si->sections[j], si->types[j]) - <= 0) { + > 0) + break; #ifdef CDF_DEBUG - fprintf(stderr, "Can't read %s\n", - si->sections[j]); + fprintf(stderr, "Can't read %s\n", si->sections[j]); #endif - break; - } } - if (si->sections[j] != NULL) + if (si->sections[j] == NULL) continue; if (NOTMIME(ms)) { if (file_printf(ms, "CDFV2 %s", si->name) == -1) return -1; } else { - if (file_printf(ms, "application/CDFV2-%s", - si->mime) == -1) + if (file_printf(ms, "application/%s", si->mime) == -1) return -1; } return 1; @@ -459,6 +547,7 @@ const char *expn = ""; const cdf_directory_t *root_storage; + scn.sst_tab = NULL; info.i_fd = fd; info.i_buf = buf; info.i_len = nbytes; @@ -528,10 +617,7 @@ i = 1; goto out5; } else { - free(scn.sst_tab); - scn.sst_tab = NULL; - scn.sst_len = 0; - scn.sst_dirlen = 0; + cdf_zero_stream(&scn); } } @@ -539,56 +625,31 @@ &scn)) == -1) { if (errno != ESRCH) { expn = "Cannot read summary info"; - goto out4; } - i = cdf_file_catalog_info(ms, &info, &h, &sat, &ssat, &sst, - &dir, &scn); - if (i > 0) - goto out4; - i = cdf_file_dir_info(ms, &dir); - if (i < 0) - expn = "Cannot read section info"; - goto out4; + } else { + i = cdf_check_summary_info(ms, &info, &h, + &sat, &ssat, &sst, &dir, &scn, root_storage, &expn); + cdf_zero_stream(&scn); } - - -#ifdef CDF_DEBUG - cdf_dump_summary_info(&h, &scn); -#endif - if ((i = cdf_file_summary_info(ms, &h, &scn, root_storage)) < 0) - expn = "Can't expand summary_info"; - - if (i == 0) { - const char *str = NULL; - cdf_directory_t *d; - char name[__arraycount(d->d_name)]; - size_t j, k; - - for (j = 0; str == NULL && j < dir.dir_len; j++) { - d = &dir.dir_tab[j]; - for (k = 0; k < sizeof(name); k++) - name[k] = (char)cdf_tole2(d->d_name[k]); - str = cdf_app_to_mime(name, - NOTMIME(ms) ? name2desc : name2mime); - } - if (NOTMIME(ms)) { - if (str != NULL) { - if (file_printf(ms, "%s", str) == -1) - return -1; - i = 1; + if (i <= 0) { + if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat, + &sst, &dir, &scn)) == -1) { + if (errno != ESRCH) { + expn = "Cannot read summary info"; } } else { - if (str == NULL) - str = "vnd.ms-office"; - if (file_printf(ms, "application/%s", str) == -1) - return -1; - i = 1; + i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat, + &sst, &dir, &scn, root_storage, &expn); } } + if (i <= 0) { + i = cdf_file_dir_info(ms, &dir); + if (i < 0) + expn = "Cannot read section info"; + } out5: - free(scn.sst_tab); -out4: - free(sst.sst_tab); + cdf_zero_stream(&scn); + cdf_zero_stream(&sst); out3: free(dir.dir_tab); out2: @@ -605,7 +666,7 @@ if (file_printf(ms, ", %s", expn) == -1) return -1; } else { - if (file_printf(ms, "application/CDFV2-unknown") == -1) + if (file_printf(ms, "application/CDFV2") == -1) return -1; } i = 1; diff -Nru file-5.28/src/readelf.c file-5.29/src/readelf.c --- file-5.28/src/readelf.c 2015-11-18 12:29:29.000000000 +0000 +++ file-5.29/src/readelf.c 2016-10-04 21:43:10.000000000 +0000 @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readelf.c,v 1.127 2015/11/18 12:29:29 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.128 2016/10/04 21:43:10 christos Exp $") #endif #ifdef BUILTIN_ELF @@ -509,12 +509,26 @@ size_t noff, size_t doff, int *flags) { if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 && - type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) { + type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) { uint8_t desc[20]; + const char *btype; uint32_t i; *flags |= FLAGS_DID_BUILD_ID; - if (file_printf(ms, ", BuildID[%s]=", descsz == 16 ? "md5/uuid" : - "sha1") == -1) + switch (descsz) { + case 8: + btype = "xxHash"; + break; + case 16: + btype = "md5/uuid"; + break; + case 20: + btype = "sha1"; + break; + default: + btype = "unknown"; + break; + } + if (file_printf(ms, ", BuildID[%s]=", btype) == -1) return 1; (void)memcpy(desc, &nbuf[doff], descsz); for (i = 0; i < descsz; i++) diff -Nru file-5.28/src/softmagic.c file-5.29/src/softmagic.c --- file-5.28/src/softmagic.c 2016-06-13 19:03:27.000000000 +0000 +++ file-5.29/src/softmagic.c 2016-10-24 18:02:17.000000000 +0000 @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.234 2016/06/13 12:02:06 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.238 2016/10/24 18:02:17 christos Exp $") #endif /* lint */ #include "magic.h" @@ -57,13 +57,13 @@ const unsigned char *, uint32_t, size_t, struct magic *); private int mconvert(struct magic_set *, struct magic *, int); private int print_sep(struct magic_set *, int); -private int handle_annotation(struct magic_set *, struct magic *); +private int handle_annotation(struct magic_set *, struct magic *, int); private int cvt_8(union VALUETYPE *, const struct magic *); private int cvt_16(union VALUETYPE *, const struct magic *); private int cvt_32(union VALUETYPE *, const struct magic *); private int cvt_64(union VALUETYPE *, const struct magic *); -#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) +#define OFFSET_OOB(n, o, i) ((n) < (uint32_t)(o) || (i) > ((n) - (o))) #define BE64(p) (((uint64_t)(p)->hq[0]<<56)|((uint64_t)(p)->hq[1]<<48)| \ ((uint64_t)(p)->hq[2]<<40)|((uint64_t)(p)->hq[3]<<32)| \ ((uint64_t)(p)->hq[4]<<24)|((uint64_t)(p)->hq[5]<<16)| \ @@ -80,6 +80,7 @@ ((uint32_t)(p)->hl[3]<<8)|((uint32_t)(p)->hl[2])) #define BE16(p) (((uint16_t)(p)->hs[0]<<8)|((uint16_t)(p)->hs[1])) #define LE16(p) (((uint16_t)(p)->hs[1]<<8)|((uint16_t)(p)->hs[0])) +#define SEXT(s,v,p) ((s)?(intmax_t)(int##v##_t)(p):(intmax_t)(uint##v##_t)(p)) /* * softmagic - lookup one file in parsed, in-memory copy of database @@ -230,7 +231,7 @@ goto flush; } - if ((e = handle_annotation(ms, m)) != 0) { + if ((e = handle_annotation(ms, m, firstline)) != 0) { *need_separator = 1; *printed_something = 1; *returnval = 1; @@ -328,7 +329,7 @@ } else ms->c.li[cont_level].got_match = 1; - if ((e = handle_annotation(ms, m)) != 0) { + if ((e = handle_annotation(ms, m, firstline)) != 0) { *need_separator = 1; *printed_something = 1; *returnval = 1; @@ -1226,7 +1227,7 @@ memchr(c, '\r', CAST(size_t, (end - c)))))); lines--, b++) { last = b; - if (b[0] == '\r' && b[1] == '\n') + if (b < end - 1 && b[0] == '\r' && b[1] == '\n') b++; } if (lines) @@ -1294,6 +1295,45 @@ return 0; } +private uint32_t +do_ops(struct magic *m, intmax_t lhs, intmax_t off) +{ + intmax_t offset; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { + case FILE_OPAND: + offset = lhs & off; + break; + case FILE_OPOR: + offset = lhs | off; + break; + case FILE_OPXOR: + offset = lhs ^ off; + break; + case FILE_OPADD: + offset = lhs + off; + break; + case FILE_OPMINUS: + offset = lhs - off; + break; + case FILE_OPMULTIPLY: + offset = lhs * off; + break; + case FILE_OPDIVIDE: + offset = lhs / off; + break; + case FILE_OPMODULO: + offset = lhs % off; + break; + } + } else + offset = lhs; + if (m->in_op & FILE_OPINVERSE) + offset = ~offset; + + return (uint32_t)offset; +} + private int mget(struct magic_set *ms, const unsigned char *s, struct magic *m, size_t nbytes, size_t o, unsigned int cont_level, int mode, int text, @@ -1301,7 +1341,7 @@ int *printed_something, int *need_separator, int *returnval) { uint32_t offset = ms->offset; - uint32_t lhs; + intmax_t lhs; file_pushbuf_t *pb; int rv, oneed_separator, in_type; char *rbuf; @@ -1337,7 +1377,8 @@ } if (m->flag & INDIR) { - int off = m->in_offset; + intmax_t off = m->in_offset; + const int sgn = m->in_op & FILE_OPSIGNED; if (m->in_op & FILE_OPINDIRECT) { const union VALUETYPE *q = CAST(const union VALUETYPE *, ((const void *)(s + offset + off))); @@ -1345,178 +1386,55 @@ return 0; switch (cvt_flip(m->in_type, flip)) { case FILE_BYTE: - off = q->b; + off = SEXT(sgn,8,q->b); break; case FILE_SHORT: - off = q->h; + off = SEXT(sgn,16,q->h); break; case FILE_BESHORT: - off = (short)BE16(q); + off = SEXT(sgn,16,BE16(q)); break; case FILE_LESHORT: - off = (short)LE16(q); + off = SEXT(sgn,16,LE16(q)); break; case FILE_LONG: - off = q->l; + off = SEXT(sgn,32,q->l); break; case FILE_BELONG: case FILE_BEID3: - off = (int32_t)BE32(q); + off = SEXT(sgn,32,BE32(q)); break; case FILE_LEID3: case FILE_LELONG: - off = (int32_t)LE32(q); + off = SEXT(sgn,32,LE32(q)); break; case FILE_MELONG: - off = (int32_t)ME32(q); + off = SEXT(sgn,32,ME32(q)); break; } if ((ms->flags & MAGIC_DEBUG) != 0) - fprintf(stderr, "indirect offs=%u\n", off); + fprintf(stderr, "indirect offs=%jd\n", off); } switch (in_type = cvt_flip(m->in_type, flip)) { case FILE_BYTE: if (OFFSET_OOB(nbytes, offset, 1)) return 0; - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = p->b & off; - break; - case FILE_OPOR: - offset = p->b | off; - break; - case FILE_OPXOR: - offset = p->b ^ off; - break; - case FILE_OPADD: - offset = p->b + off; - break; - case FILE_OPMINUS: - offset = p->b - off; - break; - case FILE_OPMULTIPLY: - offset = p->b * off; - break; - case FILE_OPDIVIDE: - offset = p->b / off; - break; - case FILE_OPMODULO: - offset = p->b % off; - break; - } - } else - offset = p->b; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,8,p->b), off); break; case FILE_BESHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; - lhs = (p->hs[0] << 8) | p->hs[1]; - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = lhs & off; - break; - case FILE_OPOR: - offset = lhs | off; - break; - case FILE_OPXOR: - offset = lhs ^ off; - break; - case FILE_OPADD: - offset = lhs + off; - break; - case FILE_OPMINUS: - offset = lhs - off; - break; - case FILE_OPMULTIPLY: - offset = lhs * off; - break; - case FILE_OPDIVIDE: - offset = lhs / off; - break; - case FILE_OPMODULO: - offset = lhs % off; - break; - } - } else - offset = lhs; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,16,BE16(p)), off); break; case FILE_LESHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; - lhs = (p->hs[1] << 8) | p->hs[0]; - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = lhs & off; - break; - case FILE_OPOR: - offset = lhs | off; - break; - case FILE_OPXOR: - offset = lhs ^ off; - break; - case FILE_OPADD: - offset = lhs + off; - break; - case FILE_OPMINUS: - offset = lhs - off; - break; - case FILE_OPMULTIPLY: - offset = lhs * off; - break; - case FILE_OPDIVIDE: - offset = lhs / off; - break; - case FILE_OPMODULO: - offset = lhs % off; - break; - } - } else - offset = lhs; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,16,LE16(p)), off); break; case FILE_SHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = p->h & off; - break; - case FILE_OPOR: - offset = p->h | off; - break; - case FILE_OPXOR: - offset = p->h ^ off; - break; - case FILE_OPADD: - offset = p->h + off; - break; - case FILE_OPMINUS: - offset = p->h - off; - break; - case FILE_OPMULTIPLY: - offset = p->h * off; - break; - case FILE_OPDIVIDE: - offset = p->h / off; - break; - case FILE_OPMODULO: - offset = p->h % off; - break; - } - } - else - offset = p->h; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,16,p->h), off); break; case FILE_BELONG: case FILE_BEID3: @@ -1524,38 +1442,8 @@ return 0; lhs = BE32(p); if (in_type == FILE_BEID3) - lhs = cvt_id3(ms, lhs); - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = lhs & off; - break; - case FILE_OPOR: - offset = lhs | off; - break; - case FILE_OPXOR: - offset = lhs ^ off; - break; - case FILE_OPADD: - offset = lhs + off; - break; - case FILE_OPMINUS: - offset = lhs - off; - break; - case FILE_OPMULTIPLY: - offset = lhs * off; - break; - case FILE_OPDIVIDE: - offset = lhs / off; - break; - case FILE_OPMODULO: - offset = lhs % off; - break; - } - } else - offset = lhs; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + lhs = cvt_id3(ms, (uint32_t)lhs); + offset = do_ops(m, SEXT(sgn,32,lhs), off); break; case FILE_LELONG: case FILE_LEID3: @@ -1563,109 +1451,18 @@ return 0; lhs = LE32(p); if (in_type == FILE_LEID3) - lhs = cvt_id3(ms, lhs); - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = lhs & off; - break; - case FILE_OPOR: - offset = lhs | off; - break; - case FILE_OPXOR: - offset = lhs ^ off; - break; - case FILE_OPADD: - offset = lhs + off; - break; - case FILE_OPMINUS: - offset = lhs - off; - break; - case FILE_OPMULTIPLY: - offset = lhs * off; - break; - case FILE_OPDIVIDE: - offset = lhs / off; - break; - case FILE_OPMODULO: - offset = lhs % off; - break; - } - } else - offset = lhs; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + lhs = cvt_id3(ms, (uint32_t)lhs); + offset = do_ops(m, SEXT(sgn,32,lhs), off); break; case FILE_MELONG: if (OFFSET_OOB(nbytes, offset, 4)) return 0; - lhs = ME32(p); - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = lhs & off; - break; - case FILE_OPOR: - offset = lhs | off; - break; - case FILE_OPXOR: - offset = lhs ^ off; - break; - case FILE_OPADD: - offset = lhs + off; - break; - case FILE_OPMINUS: - offset = lhs - off; - break; - case FILE_OPMULTIPLY: - offset = lhs * off; - break; - case FILE_OPDIVIDE: - offset = lhs / off; - break; - case FILE_OPMODULO: - offset = lhs % off; - break; - } - } else - offset = lhs; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,32,ME32(p)), off); break; case FILE_LONG: if (OFFSET_OOB(nbytes, offset, 4)) return 0; - if (off) { - switch (m->in_op & FILE_OPS_MASK) { - case FILE_OPAND: - offset = p->l & off; - break; - case FILE_OPOR: - offset = p->l | off; - break; - case FILE_OPXOR: - offset = p->l ^ off; - break; - case FILE_OPADD: - offset = p->l + off; - break; - case FILE_OPMINUS: - offset = p->l - off; - break; - case FILE_OPMULTIPLY: - offset = p->l * off; - break; - case FILE_OPDIVIDE: - offset = p->l / off; - break; - case FILE_OPMODULO: - offset = p->l % off; - break; - } - } else - offset = p->l; - if (m->in_op & FILE_OPINVERSE) - offset = ~offset; + offset = do_ops(m, SEXT(sgn,32,p->l), off); break; default: break; @@ -2078,7 +1875,7 @@ size_t slen = ms->search.s_len; char *copy; if (slen != 0) { - copy = malloc(slen); + copy = CAST(char *, malloc(slen)); if (copy == NULL) { file_regfree(&rx); file_error(ms, errno, @@ -2231,19 +2028,25 @@ } private int -handle_annotation(struct magic_set *ms, struct magic *m) +handle_annotation(struct magic_set *ms, struct magic *m, int firstline) { if ((ms->flags & MAGIC_APPLE) && m->apple[0]) { + if (!firstline && file_printf(ms, "\n- ") == -1) + return -1; if (file_printf(ms, "%.8s", m->apple) == -1) return -1; return 1; } if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) { + if (!firstline && file_printf(ms, "\n- ") == -1) + return -1; if (file_printf(ms, "%s", m->ext) == -1) return -1; return 1; } if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) { + if (!firstline && file_printf(ms, "\n- ") == -1) + return -1; if (file_printf(ms, "%s", m->mimetype) == -1) return -1; return 1; @@ -2254,8 +2057,8 @@ private int print_sep(struct magic_set *ms, int firstline) { - if (ms->flags & MAGIC_NODESC) - return 0; +// if (ms->flags & MAGIC_NODESC) +// return 0; if (firstline) return 0; /* diff -Nru file-5.28/TODO file-5.29/TODO --- file-5.28/TODO 2015-04-09 19:58:13.000000000 +0000 +++ file-5.29/TODO 2016-10-17 14:33:34.000000000 +0000 @@ -6,7 +6,6 @@ listed in the BUGS section of the man page had been fixed!) --- - It would be nice to simplify file considerably. For example, reimplement the apprentice and non-pattern magic methods in Python, and compile the magic patterns to a giant regex (or something similar; @@ -15,8 +14,23 @@ required for soft magic, not the more detailed information given by hard-wired routines). In this regard, note that hplip, which is BSD-licensed, has a magic reimplementation in Python. - +--- Read the kerberos magic entry for more ideas. - +--- Write a string merger to make magic entry sizes dynamic. Strings will be converted to offsets from the string table. +--- +Programming language support, we can introduce the concept of a group +of rules where n rules need to match before the rule is positive. This +could require structural changes to the matching code :-( + +0 group 2 # require 2 matches +# rule 1 +>0 .... +... +# rule 2 +>0 .... +... + +christos +