git: 67c01d848bf7 - stable/13 - file: upgrade to 5.42.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Jul 2022 00:32:44 UTC
The branch stable/13 has been updated by delphij:
URL: https://cgit.FreeBSD.org/src/commit/?id=67c01d848bf71c49bcda49b02a3fd3dd20f07797
commit 67c01d848bf71c49bcda49b02a3fd3dd20f07797
Author: Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-07-04 00:07:28 +0000
Commit: Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-07-18 00:32:23 +0000
file: upgrade to 5.42.
(cherry picked from commit a4d6d3b8910f3805eebcd8703e11e066aad2e2a1)
---
contrib/file/ChangeLog | 37 +
contrib/file/Makefile.am | 3 +-
contrib/file/Makefile.in | 8 +-
contrib/file/README.md | 155 ++
contrib/file/config.h.in | 15 +
contrib/file/configure | 28 +-
contrib/file/configure.ac | 10 +-
contrib/file/magic/Magdir/animation | 3 +-
contrib/file/magic/Magdir/archive | 315 ++-
contrib/file/magic/Magdir/aria | 38 +
contrib/file/magic/Magdir/asf | 4 +-
contrib/file/magic/Magdir/bytecode | 4 +-
contrib/file/magic/Magdir/c64 | 141 +-
contrib/file/magic/Magdir/cad | 4 +-
contrib/file/magic/Magdir/ccf | 14 +
contrib/file/magic/Magdir/commands | 32 +-
contrib/file/magic/Magdir/console | 103 +-
contrib/file/magic/Magdir/ctf | 2 +-
contrib/file/magic/Magdir/database | 18 +-
contrib/file/magic/Magdir/dataone | 28 +-
contrib/file/magic/Magdir/dsf | 25 +
contrib/file/magic/Magdir/filesystems | 165 +-
contrib/file/magic/Magdir/fonts | 67 +-
contrib/file/magic/Magdir/freebsd | 22 +-
contrib/file/magic/Magdir/games | 34 +-
contrib/file/magic/Magdir/geo | 10 +-
contrib/file/magic/Magdir/iff | 3 +-
contrib/file/magic/Magdir/images | 2947 +++++++++++++++++-----------
contrib/file/magic/Magdir/intel | 204 +-
contrib/file/magic/Magdir/javascript | 14 +-
contrib/file/magic/Magdir/linux | 6 +-
contrib/file/magic/Magdir/make | 29 +-
contrib/file/magic/Magdir/mathematica | 33 +-
contrib/file/magic/Magdir/mcrypt | 16 +-
contrib/file/magic/Magdir/msdos | 38 +-
contrib/file/magic/Magdir/msooxml | 9 +-
contrib/file/magic/Magdir/msvc | 161 +-
contrib/file/magic/Magdir/nifty | 202 ++
contrib/file/magic/Magdir/ole2compounddocs | 101 +-
contrib/file/magic/Magdir/oric | 16 +
contrib/file/magic/Magdir/os2 | 4 +-
contrib/file/magic/Magdir/palm | 3 +-
contrib/file/magic/Magdir/pci_ids | 116 ++
contrib/file/magic/Magdir/python | 47 +-
contrib/file/magic/Magdir/riff | 66 +-
contrib/file/magic/Magdir/rpi | 25 +-
contrib/file/magic/Magdir/sgml | 47 +-
contrib/file/magic/Magdir/sniffer | 51 +-
contrib/file/magic/Magdir/statistics | 4 +-
contrib/file/magic/Magdir/sysex | 147 +-
contrib/file/magic/Magdir/uuencode | 18 +-
contrib/file/magic/Magdir/virtual | 8 +-
contrib/file/magic/Magdir/windows | 182 +-
contrib/file/magic/Magdir/wordprocessors | 64 +-
contrib/file/magic/Magdir/xwindows | 6 +-
contrib/file/magic/Magdir/zip | 30 +-
contrib/file/magic/Makefile.am | 8 +-
contrib/file/magic/Makefile.in | 8 +-
contrib/file/src/apprentice.c | 451 +++--
contrib/file/src/ascmagic.c | 6 +-
contrib/file/src/cdf.c | 18 +-
contrib/file/src/cdf_time.c | 7 +-
contrib/file/src/compress.c | 125 +-
contrib/file/src/der.c | 8 +-
contrib/file/src/encoding.c | 58 +-
contrib/file/src/file.c | 96 +-
contrib/file/src/file.h | 164 +-
contrib/file/src/fsmagic.c | 4 +-
contrib/file/src/funcs.c | 126 +-
contrib/file/src/is_csv.c | 4 +-
contrib/file/src/is_json.c | 53 +-
contrib/file/src/magic.c | 25 +-
contrib/file/src/print.c | 69 +-
contrib/file/src/readcdf.c | 9 +-
contrib/file/src/readelf.c | 13 +-
contrib/file/src/softmagic.c | 235 ++-
contrib/file/tests/Makefile.am | 6 +
contrib/file/tests/Makefile.in | 6 +
contrib/file/tests/arj.result | 1 +
contrib/file/tests/arj.testfile | Bin 0 -> 54 bytes
contrib/file/tests/json1.result | 2 +-
contrib/file/tests/json2.result | 2 +-
contrib/file/tests/json3.result | 2 +-
contrib/file/tests/json4.result | 1 +
contrib/file/tests/json4.testfile | 1 +
contrib/file/tests/json5.result | 1 +
contrib/file/tests/json5.testfile | 1 +
contrib/file/tests/test.c | 3 +-
lib/libmagic/config.h | 21 +-
89 files changed, 5447 insertions(+), 1969 deletions(-)
diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog
index 0bb334c9fd88..d9bf953f1ac0 100644
--- a/contrib/file/ChangeLog
+++ b/contrib/file/ChangeLog
@@ -1,3 +1,40 @@
+2022-06-10 9:40 Christos Zoulas <christos@zoulas.com>
+
+ * release 5.42
+
+2022-05-31 14:50 Christos Zoulas <christos@zoulas.com>
+
+ * PR/348: add missing cases to prevent file from aborting on
+ random magic files.
+
+2022-05-27 21:05 Christos Zoulas <christos@zoulas.com>
+
+ * PR/351: octalify filenames when not raw before printing.
+
+2022-04-18 17:51 Christos Zoulas <christos@zoulas.com>
+
+ * fix regex cacheing bug (Dirk Mueller)
+ * merge file_regcomp and file_regerror() to simplify the code
+ and reduce memory requirements for storing regexes (Dirk Mueller)
+
+2022-03-19 12:56 Christos Zoulas <christos@zoulas.com>
+
+ * cache regex (Dirk Mueller)
+ * detect filesystem full by flushing output (Dirk Mueller)
+
+2021-11-19 12:36 Christos Zoulas <christos@zoulas.com>
+
+ * implement running decompressor programs using
+ posix_spawnp(2) instead of vfork(2)
+
+2021-10-24 11:51 Christos Zoulas <christos@zoulas.com>
+
+ * Add support for msdos dates and times
+
+2021-10-20 9:55 Christos Zoulas <christos@zoulas.com>
+
+ * use the system byte swapping functions if available (Werner Fink)
+
2021-10-18 11:57 Christos Zoulas <christos@zoulas.com>
* release 5.41
diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am
index b10b1cb14daa..e816779b8c53 100644
--- a/contrib/file/Makefile.am
+++ b/contrib/file/Makefile.am
@@ -1,6 +1,7 @@
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER m4/visibility.m4
+EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER README.md \
+ m4/visibility.m4
SUBDIRS = src magic tests doc python
diff --git a/contrib/file/Makefile.in b/contrib/file/Makefile.in
index 79e1d05b5d73..e2f067361f5c 100644
--- a/contrib/file/Makefile.in
+++ b/contrib/file/Makefile.in
@@ -192,8 +192,8 @@ CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libmagic.pc.in AUTHORS COPYING ChangeLog INSTALL \
- NEWS TODO compile config.guess config.sub depcomp install-sh \
- ltmain.sh missing
+ NEWS TODO compile config.guess config.sub install-sh ltmain.sh \
+ missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -358,7 +358,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER m4/visibility.m4
+EXTRA_DIST = MAINT RELEASE-PROCEDURE README.DEVELOPER README.md \
+ m4/visibility.m4
+
SUBDIRS = src magic tests doc python
# This variable must have 'exec' in its name, in order to be installed
diff --git a/contrib/file/README.md b/contrib/file/README.md
new file mode 100644
index 000000000000..37a3b17856c6
--- /dev/null
+++ b/contrib/file/README.md
@@ -0,0 +1,155 @@
+## README for file(1) Command and the libmagic(3) library ##
+
+ @(#) $File: README.md,v 1.4 2021/10/21 01:51:31 christos Exp $
+
+- Bug Tracker: <https://bugs.astron.com/>
+- Build Status: <https://travis-ci.org/file/file>
+- Download link: <ftp://ftp.astron.com/pub/file/>
+- E-mail: <christos@astron.com>
+- Fuzzing link: <https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:file>
+- Home page: https://www.darwinsys.com/file/
+- Mailing List archives: <https://mailman.astron.com/pipermail/file/>
+- Mailing List: <file@astron.com>
+- Public repo: <https://github.com/file/file>
+- Test framework: <https://github.com/file/file-tests>
+
+Phone: Do not even think of telephoning me about this program. Send
+cash first!
+
+This is Release 5.x of Ian Darwin's (copyright but distributable)
+file(1) command, an implementation of the Unix File(1) command.
+It knows the 'magic number' of several thousands of file types.
+This version is the standard "file" command for Linux, *BSD, and
+other systems. (See "patchlevel.h" for the exact release number).
+
+The major changes for 5.x are CDF file parsing, indirect magic,
+name/use (recursion) and overhaul in mime and ascii encoding
+handling.
+
+The major feature of 4.x is the refactoring of the code into a
+library, and the re-write of the file command in terms of that
+library. The library itself, libmagic can be used by 3rd party
+programs that wish to identify file types without having to fork()
+and exec() file. The prime contributor for 4.0 was Mans Rullgard.
+
+UNIX is a trademark of UNIX System Laboratories.
+
+The prime contributor to Release 3.8 was Guy Harris, who put in
+megachanges including byte-order independence.
+
+The prime contributor to Release 3.0 was Christos Zoulas, who put
+in hundreds of lines of source code changes, including his own
+ANSIfication of the code (I liked my own ANSIfication better, but
+his (__P()) is the "Berkeley standard" way of doing it, and I wanted
+UCB to include the code...), his HP-like "indirection" (a feature
+of the HP file command, I think), and his mods that finally got
+the uncompress (-z) mode finished and working.
+
+This release has compiled in numerous environments; see PORTING
+for a list and problems.
+
+This fine freeware file(1) follows the USG (System V) model of the
+file command, rather than the Research (V7) version or the V7-derived
+4.[23] Berkeley one. That is, the file /etc/magic contains much of
+the ritual information that is the source of this program's power.
+My version knows a little more magic (including tar archives) than
+System V; the /etc/magic parsing seems to be compatible with the
+(poorly documented) System V /etc/magic format (with one exception;
+see the man page).
+
+In addition, the /etc/magic file is built from a subdirectory
+for easier(?) maintenance. I will act as a clearinghouse for
+magic numbers assigned to all sorts of data files that
+are in reasonable circulation. Send your magic numbers,
+in magic(5) format please, to the maintainer, Christos Zoulas.
+
+COPYING - read this first.
+* `README` - read this second (you are currently reading this file).
+* `INSTALL` - read on how to install
+* `src/apprentice.c` - parses /etc/magic to learn magic
+* `src/apptype.c` - used for OS/2 specific application type magic
+* `src/ascmagic.c` - third & last set of tests, based on hardwired assumptions.
+* `src/asctime_r.c` - replacement for OS's that don't have it.
+* `src/asprintf.c` - replacement for OS's that don't have it.
+* `src/buffer.c` - buffer handling functions.
+* `src/cdf.[ch]` - parser for Microsoft Compound Document Files
+* `src/cdf_time.c` - time converter for CDF.
+* `src/compress.c` - handles decompressing files to look inside.
+* `src/ctime_r.c` - replacement for OS's that don't have it.
+* `src/der.[ch]` - parser for Distinguished Encoding Rules
+* `src/dprintf.c` - replacement for OS's that don't have it.
+* `src/elfclass.h` - common code for elf 32/64.
+* `src/encoding.c` - handles unicode encodings
+* `src/file.c` - the main program
+* `src/file.h` - header file
+* `src/file_opts.h` - list of options
+* `src/fmtcheck.c` - replacement for OS's that don't have it.
+* `src/fsmagic.c` - first set of tests the program runs, based on filesystem info
+* `src/funcs.c` - utilility functions
+* `src/getline.c` - replacement for OS's that don't have it.
+* `src/getopt_long.c` - replacement for OS's that don't have it.
+* `src/gmtime_r.c` - replacement for OS's that don't have it.
+* `src/is_csv.c` - knows about Comma Separated Value file format (RFC 4180).
+* `src/is_json.c` - knows about JavaScript Object Notation format (RFC 8259).
+* `src/is_tar.c, tar.h` - knows about Tape ARchive format (courtesy John Gilmore).
+* `src/localtime_r.c` - replacement for OS's that don't have it.
+* `src/magic.h.in` - source file for magic.h
+* `src/mygetopt.h` - replacement for OS's that don't have it.
+* `src/magic.c` - the libmagic api
+* `src/names.h` - header file for ascmagic.c
+* `src/pread.c` - replacement for OS's that don't have it.
+* `src/print.c` - print results, errors, warnings.
+* `src/readcdf.c` - CDF wrapper.
+* `src/readelf.[ch]` - Stand-alone elf parsing code.
+* `src/softmagic.c` - 2nd set of tests, based on /etc/magic
+* `src/mygetopt.h` - replacement for OS's that don't have it.
+* `src/strcasestr.c` - replacement for OS's that don't have it.
+* `src/strlcat.c` - replacement for OS's that don't have it.
+* `src/strlcpy.c` - replacement for OS's that don't have it.
+* `src/strndup.c` - replacement for OS's that don't have it.
+* `src/tar.h` - tar file definitions
+* `src/vasprintf.c` - for systems that don't have it.
+* `doc/file.man` - man page for the command
+* `doc/magic.man` - man page for the magic file, courtesy Guy Harris.
+ Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile.
+
+Magdir - directory of /etc/magic pieces
+------------------------------------------------------------------------------
+
+If you submit a new magic entry please make sure you read the following
+guidelines:
+
+- Initial match is preferably at least 32 bits long, and is a _unique_ match
+- If this is not feasible, use additional check
+- Match of <= 16 bits are not accepted
+- Delay printing string as much as possible, don't print output too early
+- Avoid printf arbitrary byte as string, which can be a source of
+ crash and buffer overflow
+
+- Provide complete information with entry:
+ * One line short summary
+ * Optional long description
+ * File extension, if applicable
+ * Full name and contact method (for discussion when entry has problem)
+ * Further reference, such as documentation of format
+
+gpg for dummies:
+------------------------------------------------------------------------------
+
+```
+$ gpg --verify file-X.YY.tar.gz.asc file-X.YY.tar.gz
+gpg: assuming signed data in `file-X.YY.tar.gz'
+gpg: Signature made WWW MMM DD HH:MM:SS YYYY ZZZ using DSA key ID KKKKKKKK
+```
+
+To download the key:
+
+```
+$ gpg --keyserver hkp://keys.gnupg.net --recv-keys KKKKKKKK
+```
+------------------------------------------------------------------------------
+
+
+Parts of this software were developed at SoftQuad Inc., developers
+of SGML/HTML/XML publishing software, in Toronto, Canada.
+SoftQuad was swallowed up by Corel in 2002 and does not exist any longer.
diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in
index ec46e2d8fb99..f058839efe68 100644
--- a/contrib/file/config.h.in
+++ b/contrib/file/config.h.in
@@ -18,6 +18,9 @@
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
+/* Define to 1 if you have the <byteswap.h> header file. */
+#undef HAVE_BYTESWAP_H
+
/* Define to 1 if you have the <bzlib.h> header file. */
#undef HAVE_BZLIB_H
@@ -128,12 +131,18 @@
/* Define to 1 if you have the `pipe2' function. */
#undef HAVE_PIPE2
+/* Define to 1 if you have the `posix_spawnp' function. */
+#undef HAVE_POSIX_SPAWNP
+
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
/* Have sig_t type */
#undef HAVE_SIG_T
+/* Define to 1 if you have the <spawn.h> header file. */
+#undef HAVE_SPAWN_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -173,6 +182,12 @@
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
+/* Define to 1 if you have the <sys/bswap.h> header file. */
+#undef HAVE_SYS_BSWAP_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
diff --git a/contrib/file/configure b/contrib/file/configure
index d6a18d038f4a..0dd7b845a5fa 100755
--- a/contrib/file/configure
+++ b/contrib/file/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.41.
+# Generated by GNU Autoconf 2.69 for file 5.42.
#
# Report bugs to <christos@astron.com>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='file'
PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.41'
-PACKAGE_STRING='file 5.41'
+PACKAGE_VERSION='5.42'
+PACKAGE_STRING='file 5.42'
PACKAGE_BUGREPORT='christos@astron.com'
PACKAGE_URL=''
@@ -1334,7 +1334,7 @@ if test "$ac_init_help" = "long"; then
# 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.41 to adapt to many kinds of systems.
+\`configure' configures file 5.42 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1404,7 +1404,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.41:";;
+ short | recursive ) echo "Configuration of file 5.42:";;
esac
cat <<\_ACEOF
@@ -1524,7 +1524,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-file configure 5.41
+file configure 5.42
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2180,7 +2180,7 @@ cat >config.log <<_ACEOF
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.41, which was
+It was created by file $as_me 5.42, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3046,7 +3046,7 @@ fi
# Define the identity of the package.
PACKAGE='file'
- VERSION='5.41'
+ VERSION='5.42'
cat >>confdefs.h <<_ACEOF
@@ -12900,7 +12900,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
fi
-for ac_header in stdint.h fcntl.h inttypes.h unistd.h
+for ac_header in stdint.h fcntl.h inttypes.h unistd.h byteswap.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -12913,7 +12913,7 @@ fi
done
-for ac_header in utime.h wchar.h wctype.h
+for ac_header in spawn.h utime.h wchar.h wctype.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -12939,7 +12939,7 @@ fi
done
-for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h
+for ac_header in sys/bswap.h sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h sys/ioctl.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -14290,7 +14290,7 @@ fi
fi
-for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2
+for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2 posix_spawnp
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -15310,7 +15310,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# 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.41, which was
+This file was extended by file $as_me 5.42, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15376,7 +15376,7 @@ _ACEOF
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.41
+file config.status 5.42
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/file/configure.ac b/contrib/file/configure.ac
index ccc57e13343d..ffbe0f694ece 100644
--- a/contrib/file/configure.ac
+++ b/contrib/file/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.41],[christos@astron.com])
+AC_INIT([file],[5.42],[christos@astron.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -99,10 +99,10 @@ gl_VISIBILITY
dnl Checks for headers
AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h)
-AC_CHECK_HEADERS(utime.h wchar.h wctype.h)
+AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h byteswap.h)
+AC_CHECK_HEADERS(spawn.h utime.h wchar.h wctype.h)
AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
-AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h)
+AC_CHECK_HEADERS(sys/bswap.h sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h sys/ioctl.h)
if test "$enable_zlib" != "no"; then
AC_CHECK_HEADERS(zlib.h)
fi
@@ -165,7 +165,7 @@ else
fi])
dnl Checks for functions
-AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2)
+AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2 posix_spawnp)
dnl Provide implementation of some required functions if necessary
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
diff --git a/contrib/file/magic/Magdir/animation b/contrib/file/magic/Magdir/animation
index d59497d8005a..28a0f2d217aa 100644
--- a/contrib/file/magic/Magdir/animation
+++ b/contrib/file/magic/Magdir/animation
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: animation,v 1.87 2021/08/24 09:25:11 christos Exp $
+# $File: animation,v 1.88 2022/05/14 22:06:04 christos Exp $
# animation: file(1) magic for animation/movie formats
#
# animation formats
@@ -940,6 +940,7 @@
# DIF digital video file format <mpruett@sgi.com>
0 belong&0xffffff00 0x1f070000 DIF
+!:mime video/x-dv
>4 byte &0x01 (DVCPRO) movie file
>4 byte ^0x01 (DV) movie file
>3 byte &0x80 (PAL)
diff --git a/contrib/file/magic/Magdir/archive b/contrib/file/magic/Magdir/archive
index d4fd3c920d36..fb535ac0ff26 100644
--- a/contrib/file/magic/Magdir/archive
+++ b/contrib/file/magic/Magdir/archive
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: archive,v 1.151 2021/08/16 10:19:56 christos Exp $
+# $File: archive,v 1.162 2022/05/27 21:27:59 christos Exp $
# archive: file(1) magic for archive formats (see also "msdos" for self-
# extracting compressed archives)
#
@@ -150,7 +150,7 @@
# Incremental snapshot gnu-tar format from:
# https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
0 string GNU\ tar- GNU tar incremental snapshot data
->&0 regex [0-9]\.[0-9]+-[0-9]+ version %s
+>&0 regex [0-9]\\.[0-9]+-[0-9]+ version %s
# cpio archives
#
@@ -518,46 +518,65 @@
#>-3 ubyte x \b, last 3 bytes 0x%2.2x
#>-2 ubeshort x \b%4.4x
# From: Joerg Jenderek
-# URL: https://wiki.68kmla.org/DiskCopy_4.2_format_specification
+# URL: https://en.wikipedia.org/wiki/Disk_Copy
# reference: http://nulib.com/library/FTN.e00005.htm
0x52 ubeshort 0x0100
# test for disk image size equal or above 400k
>0x40 ubelong >409599
# test also for disk image size equal or below 1440k to skip
# windows7en.mbr UNICODE.DAT
->>0x40 ubelong <1474561
-# To skip Flags$StringJoiner.class with size 00106A61h test also for only 4 disk image sizes
-# 00064000 for 400k GCR disks
-# 000c8000 for 800k GCR disks
-# 000b4000 for 720k MFM disks
-# 00168000 for 1440k MFM disks
->>>0x40 ubelong&0xffE03fFF 0
->>>>0 use dc42-floppy
+#>>0x40 ubelong <1474561
+# test now for "low" disk image size equal or below 64 MiB to skip
+# windows7en.mbr (B441BBAAh) UNICODE.DAT (0400AF05h)
+>>0x40 ubelong <0x04000001
+# To skip Flags$StringJoiner.class with size 00106A61h test also for valid disk image sizes
+# 00064000 for 400k GCR disks dc42-400k-gcr.trid.xml
+# 000c8000 for 800k GCR disks dc42-800k-gcr.trid.xml
+# 000b4000 for 720k MFM disks dc42-720k-mfm.trid.xml
+# 00168000 for 1440k MFM disks dc42-1440k-mfm.trid.xml
+# https://lisaem.sunder.net/LisaProjectDocs.txt
+# 00500000 05M available
+# 00A00000 10M available
+# 01800000 24M possible
+# 02000000 32M uncertain
+# 04000000 64M uncertain
+>>>0x40 ubelong&0xf8003fFF 0
+# skip samples with invalid disk name length like:
+# 181 (biosmd80.rom) 202 (Flags$StringJoiner.class) 90 (UNICODE.DAT)
+>>>>0x0 ubyte <64
+>>>>>0 use dc42-floppy
# display information of Apple DiskCopy 4.2 floppy image
0 name dc42-floppy
-# image pascal name padded with NULs like Microsoft Mail
+# disk name length; maximal 63
+#>0 ubyte x DISK NAME LENGTH %u
+# ASCII image pascal (maximal 63 bytes) name padded with NULs like:
+# "Microsoft Mail" "Disquette 2" "IIe Installer Disk"
+# "-lisaem.sunder.net hd-" (dc42-lisaem.trid.xml) "-not a Macintosh disk" (dc42-nonmac.trid.xml)
>00 pstring/B x Apple DiskCopy 4.2 image %s
#!:mime application/octet-stream
!:mime application/x-dc42-floppy-image
!:apple dCpydImg
-!:ext image/dc42
-# data size in bytes like 409600
+# probably also img like: "Utilitaires 2.img" "Installation 7.img"
+!:ext image/dc42/img
+# data size in bytes like: 409600 737280 819200 1474560
>0x40 ubelong x \b, %u bytes
# for debugging purpose size in hexadecimal
#>0x40 ubelong x (%#8.8x)
-# tag size in bytes
+# tag size in bytes like: 0 (often) 2580h (PUID fmt/625) 4B00h (Microsoft Mail.image)
>0x44 ubelong >0 \b, %#x tag size
# data checksum
#>0x48 ubelong x \b, %#x checksum
# tag checksum
#>0x4c ubelong x \b, %#x tag checksum
-# disk encoding
+# disk encoding like: 0 1 2 3 (PUID: fmt/625)
>0x50 ubyte 0 \b, GCR CLV ssdd (400k)
>0x50 ubyte 1 \b, GCR CLV dsdd (800k)
>0x50 ubyte 2 \b, MFM CAV dsdd (720k)
>0x50 ubyte 3 \b, MFM CAV dshd (1440k)
>0x50 ubyte >3 \b, %#x encoding
-# format byte
+# format byte like: 12h (Lisa 400K) 24h (400K Macintosh) 96h (800K Apple II disk)
+# 2 (Mac 400k "Disquette Installation 13.image")
+# 22h (double-sided MFM or Mac 800k "Disco 12.image" "IIe Installer Disk.image")
>0x51 ubyte x \b, %#x format
#>0x54 ubequad x \b, data %#16.16llx
# ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
@@ -670,7 +689,15 @@
# 2 bytes: length of data + mentioned bytes
#
# SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
+# URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
+# Reference: http://www.cabextract.org.uk/libmspack/doc/szdd_kwaj_format.html
+# http://mark0.net/download/triddefs_xml.7z/defs/s/szdd.trid.xml
+# Note: called "Microsoft SZDD compressed (Haruhiko Okumura's LZSS)" by TrID
+# verfied by 7-Zip `7z l -tMsLZ -slt *.??_` as MsLZ
+# `deark -l -m lzss_oku -d2 setup-1-41.bin` as "LZSS.C by Haruhiko Okumura"
>0 string SZDD MS Compress archive data, SZDD variant
+# 2nd part of signature
+#>>4 ubelong 0x88F02733 \b, SIGNATURE OK
!:mime application/x-ms-compress-szdd
!:ext ??_
# The character missing from the end of the filename (0=unknown)
@@ -679,6 +706,24 @@
# Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
>>8 string !A \b, %-.1s method
>>10 ulelong >0 \b, original size: %u bytes
+# Summary: InstallShield archive with SZDD compressed
+# URL: https://community.flexera.com/t5/InstallShield-Knowledge-Base/InstallShield-Redistributable-Files/ta-p/5647
+# From: Joerg Jenderek
+1 search/48/bs SZDD\x88\xF0\x27\x33 InstallShield archive
+#!:mime application/octet-stream
+!:mime application/x-installshield-compress-szdd
+!:ext ibt
+# name of compressed archive member like: setup.dl_ _setup7int.dl_ _setup2k.dl_ _igdi.dl_ cabinet.dl_
+>0 string x %s
+# name of uncompressed archive member like: setup.dll _Setup.dll IGdi.dll CABINET.DLL
+>>&1 string x (%s)
+# probably version like: 9.0.0.333 9.1.0.429 11.50.0.42618
+>>>&1 string x \b, version %s
+# SZDD member length like: 168048 169333 181842
+>>>>&1 string x \b, %s bytes
+# MS Compress archive data
+#>&0 string SZDD \b, SIGNATURE FOUND
+>&0 indirect x
# QBasic SZDD variant
3 string \x88\xf0\x27
>0 string SZ\x20 MS Compress archive data, QBasic variant
@@ -686,6 +731,17 @@
!:ext ??$
>>8 ulelong >0 \b, original size: %u bytes
+# Summary: CAZIP compressed file
+# From: Joerg Jenderek
+# URL: http://fileformats.archiveteam.org/wiki/CAZIP
+# Reference: http://mark0.net/download/triddefs_xml.7z/defs/c/caz.trid.xml
+# Note: Format is distinct from CAZIPXP compressed
+0 string \x0D\x0A\x1ACAZIP CAZIP compressed file
+#!:mime application/octet-stream
+!:mime application/x-compress-cazip
+# like: BLINKER.WR_ CLIPDEFS._ CAOSETUP.EX_ CLIPPER.EX_ FILEIO.C_
+!:ext ??_/?_/_
+
# Summary: FTCOMP compressed archive
# From: Joerg Jenderek
# URL: http://fileformats.archiveteam.org/wiki/FTCOMP
@@ -772,13 +828,43 @@
0 string NSK NaShrink archive data
# SAPCAR
0 string #\ CAR\ archive\ header SAPCAR archive data
-0 string CAR\ 2.00RG SAPCAR archive data
+0 string CAR\ 2.00 SAPCAR archive data
+0 string CAR\ 2.01 SAPCAR archive data
+#!:mime application/octet-stream
+!:mime application/vnd.sar
+!:ext sar
# Disintegrator
0 string DST Disintegrator archive data
# ASD
0 string ASD ASD archive data
# InstallShield CAB
-0 string ISc( InstallShield CAB
+# Update: Joerg Jenderek at Nov 2021
+# URL: https://en.wikipedia.org/wiki/InstallShield
+# Reference: https://github.com/twogood/unshield/blob/master/lib/cabfile.h
+# Note: Not compatible with Microsoft CAB files
+# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield.trid.xml
+# CAB_SIGNATURE 0x28635349
+0 string ISc( InstallShield
+#!:mime application/octet-stream
+!:mime application/x-installshield
+# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield-hdr.trid.xml
+>16 ulelong !0 setup header
+# like: _SYS1.HDR _USER1.HDR data1.hdr
+!:ext hdr
+>16 ulelong =0 CAB
+# like: _SYS1.CAB _USER1.CAB DATA1.CAB data2.cab
+!:ext cab
+# https://github.com/twogood/unshield/blob/master/lib/helper.c
+# version like: 0x1005201 0x100600c 0x1007000 0x1009500
+# 0x2000578 0x20005dc 0x2000640 0x40007d0 0x4000834
+>4 ulelong x \b, version %#x
+# volume_info like: 0
+>8 ulelong !0 \b, volume_info %#x
+# cab_descriptor_offset like: 0x200
+>12 ulelong !0x200 \b, offset %#x
+#>0x200 ubequad x \b, at 0x200 %#16.16llx
+# cab_descriptor_size like: 0 (*.cab) BD5 C8B DA5 E2A E36 116C 251D 4DA9 56F0 5CC2 6E4B 777D 779E 1F7C2
+>16 ulelong !0 \b, descriptor size %#x
# TOP4
0 string T4\x1a TOP4 archive data
# BatComp left out: sig looks like COM executable
@@ -925,30 +1011,143 @@
>3 byte&0xf0 0x30
>>3 byte x (v%c)
# JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
+# Update: Joerg Jenderek
+# URL: http://fileformats.archiveteam.org/wiki/JAR_(ARJ_Software)
+# reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jar.trid.xml
+# https://www.sac.sk/download/pack/jar102x.exe/TECHNOTE.DOC
+# Note: called "JAR compressed archive" by TrID
0xe string \x1aJar\x1b JAR (ARJ Software, Inc.) archive data
+#!:mime application/octet-stream
+!:mime application/x-compress-j
+>0 ulelong x \b, CRC32 %#x
+# standard suffix is ".j"; for multi volumes following order j01 j02 ... j99 100 ... 990
+!:ext j/j01/j02
+# URL: http://fileformats.archiveteam.org/wiki/JARCS
+# reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jarcs.trid.xml
+# Note: called "JARCS compressed archive" by TrID
0 string JARCS JAR (ARJ Software, Inc.) archive data
+#!:mime application/octet-stream
+!:mime application/x-compress-jar
+!:ext jar
# ARJ archiver (jason@jarthur.Claremont.EDU)
-0 leshort 0xea60 ARJ archive data
+# URL: http://fileformats.archiveteam.org/wiki/ARJ
+# reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-arj.trid.xml
+# https://github.com/FarGroup/FarManager/
+# blob/master/plugins/multiarc/arc.doc/arj.txt
+# Note: called "ARJ compressed archive" by TrID and
+# "ARJ File Format" by DROID via PUID fmt/610
+# verified by `7z l -tarj PHRACK1.ARJ` and
+# `arj.exe l TEST-hk9.ARJ`
+0 leshort 0xea60
+# skip DROID fmt-610-signature-id-946.arj by check for valid file type of main header
+>0xA ubyte 2
+>>0 use arj-archive
+0 name arj-archive
+>0 leshort x ARJ archive
!:mime application/x-arj
->5 byte x \b, v%d,
->8 byte &0x04 multi-volume,
->8 byte &0x10 slash-switched,
->8 byte &0x20 backup,
->34 string x original name: %s,
->7 byte 0 os: MS-DOS
->7 byte 1 os: PRIMOS
->7 byte 2 os: Unix
->7 byte 3 os: Amiga
->7 byte 4 os: Macintosh
->7 byte 5 os: OS/2
->7 byte 6 os: Apple ][ GS
->7 byte 7 os: Atari ST
->7 byte 8 os: NeXT
->7 byte 9 os: VAX/VMS
->3 byte >0 %d]
+# look for terminating 0-character of filename
+>0x26 search/1024 \0
+# file name extension is normally .arj but not for parts of multi volume
+#>>&-5 string x extension %.4s
+>>&-5 string/c .arj data
+!:ext arj
+>>&-5 default x
+# for multi volume first name is archive.arj then following parts archive.a01 archive.a02 ...
+>>>8 byte &0x04 data
+!:ext a01/a02
+# for SFX first name is archive.exe then following parts archive.e01 archive.e02 ...
+>>>8 byte ^0x04 data, SFX multi-volume
+!:ext e01/e02
+# basic header size like: 0x002b 0x002c 0x04e0 0x04e3 0x04e7
+#>2 uleshort x basic header size %#4.4x
+# next fragment content like: 0x0a200a003a8fc713 0x524a000010bb3471 0x524a0000c73c70f9
+#>(2.s) ubequad x NEXT FRAGMENT CONTENT %#16.16llx
+# first_hdr_size; seems to be same as basic header size
+#>2 uleshort x 1st header size %#x
+# archiver version number like: 3 4 6 11 102
+>5 byte x \b, v%d
+# minimum archiver version to extract like: 1
+>6 ubyte !1 \b, minimum %u to extract
+# FOR DEBUGGING
+#>8 byte x \b, FLAGS %#x
+# GARBLED_FLAG1; garble with password; g switch
+>8 byte &0x01 \b, password-protected
+# encryption version: 0~old 1~old 2~new 3~reserved 4~40 bit key GOST
+>>0x20 ubyte x (v%u)
+#>8 byte &0x02 \b, secured
+# ANSIPAGE_FLAG; indicates ANSI codepage used by ARJ32; hy switch
+>8 byte &0x02 \b, ANSI codepage
+# VOLUME_FLAG indicates presence of succeeding volume; but apparently not for SFX
+>8 byte &0x04 \b, multi-volume
+#>8 byte &0x08 \b, file-offset
+# ARJPROT_FLAG; build with data protection record; hk switch
+>8 byte &0x08 \b, recoverable
+# arj protection factor; maximal 10; switch hky -> factor=y+1
+>>0x22 byte x (factor %u)
+>8 byte &0x10 \b, slash-switched
+# BACKUP_FLAG; obsolete
+>8 byte &0x20 \b, backup
+# SECURED_FLAG;
+>8 byte &0x40 \b, secured,
+# ALTNAME_FLAG; indicates dual-name archive
+>8 byte &0x80 \b, dual-name
+# security version; 0~old 2~current
+>9 ubyte !0
+>>9 ubyte !2 \b, security version %u
+# file type; 2 in main header; 0~binary 1~7-bitText 2~comment 3~directory 4~VolumeLabel 5=ChapterLabel
+>0xA ubyte !2 \b, file type %u
+# date+time when original archive was created in MS-DOS format via ./msdos
+>0xC ulelong x \b, created
+>0xC use dos-date
+# or date and time by new internal function
+#>0xE lemsdosdate x %s
+#>0xC lemsdostime x %s
+# FOR DEBUGGING
+#>0x12 uleshort x RAW DATE %#4.4x
+#>0x10 uleshort x RAW TIME %#4.4x
+# date+time when archive was last modified; sometimes nil or
+# maybe wrong like in HP4DRVR.ARJ
+#>0x10 ulelong >0 \b, modified
+#>>0x10 use dos-date
+# or date and time by new internal function
+#>>0x12 lemsdosdate x %s
+#>>0x10 lemsdostime x %s
+# archive size (currently used only for secured archives); MAYBE?
+#>0x14 ulelong !0 \b, file size %u
+# security envelope file position; MAYBE?
+#>0x18 ulelong !0 \b, at %#x security envelope
+# filespec position in filename; WHAT IS THAT?
+#>0x1C uleshort >0 \b, filespec position %#x
+# length in bytes of security envelope data like: 2CAh 301h 364h 471h
+>0x1E uleshort !0 \b, security envelope length %#x
+# last chapter like: 0 1
+>0x21 ubyte !0 \b, last chapter %u
+# filename (null-terminated string); sometimes at 0x26 when 4 bytes for extra data
+>34 byte x \b, original name:
+# with extras data
+>34 byte <0x0B
+>>38 string x %s
+# without extras data
+>34 byte >0x0A
+>>34 string x %s
+# host OS: 0~MSDOS ... 11~WIN32
+>7 byte 0 \b, os: MS-DOS
+>7 byte 1 \b, os: PRIMOS
+>7 byte 2 \b, os: Unix
+>7 byte 3 \b, os: Amiga
+>7 byte 4 \b, os: Macintosh
+>7 byte 5 \b, os: OS/2
+>7 byte 6 \b, os: Apple ][ GS
+>7 byte 7 \b, os: Atari ST
+>7 byte 8 \b, os: NeXT
+>7 byte 9 \b, os: VAX/VMS
+>7 byte 10 \b, os: WIN95
+>7 byte 11 \b, os: WIN32
# [JW] idarc says this is also possible
2 leshort 0xea60 ARJ archive data
+#2 leshort 0xea60
+#>2 use arj-archive
# HA archiver (Greg Roelofs, newt@uchicago.edu)
# This is a really bad format. A file containing HAWAII will match this...
@@ -1276,6 +1475,18 @@
!:mime application/vnd.sun.xml.base
!:ext sdb
+# URL: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/File_Format
+# From: Joerg Jenderek
+# Note: only few OXT samples are detected here by mimetype member
+# is used by OpenOffice and LibreOffice and probably also NeoOffice
+# verified by `unzip -Zv *.oxt` or `7z l -slt *.oxt`
+>>50 string vnd.openofficeorg. OpenOffice
+>>>68 string extension \b/LibreOffice Extension
+# http://extension.nirsoft.net/oxt
+!:mime application/vnd.openofficeorg.extension
+# like: Gallery-Puzzle.2.1.0.1.oxt
+!:ext oxt
+
# OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
# URL: http://fileformats.archiveteam.org/wiki/OpenDocument
# https://lists.oasis-open.org/archives/office/200505/msg00006.html
@@ -1522,12 +1733,30 @@
!:mime application/x-bittorrent
# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
-0 beshort 0x0e0f Atari MSA archive data
->2 beshort x \b, %d sectors per track
->4 beshort 0 \b, 1 sided
->4 beshort 1 \b, 2 sided
->6 beshort x \b, starting track: %d
->8 beshort x \b, ending track: %d
+# URL: http://fileformats.archiveteam.org/wiki/MSA_(Magic_Shadow_Archiver)
+# Reference: http://info-coach.fr/atari/documents/_mydoc/FD_Image_File_Format.pdf
+# http://mark0.net/download/triddefs_xml.7z/defs/m/msa.trid.xml
+# Update: Joerg Jenderek
+# Note: called by TrID "Atari MSA Disk Image" and verified by
+# command like `deark -l -m msa -d2 PDATS578.msa` as " Atari ST floppy disk image"
+# GRR: line below is too general as it matches setup.skin
+0 beshort 0x0e0f
+# skip foo setup.skin with unrealistic high number 52255 of sides by check for valid "low" value
+>4 ubeshort <2 Atari MSA archive data
+#!:mime application/octet-stream
+!:mime application/x-atari-msa
+!:ext msa
+# sectors per track like: 9 10
+>>2 beshort x \b, %d sectors per track
+# sides (0 or 1; add 1 to this to get correct number of sides)
+>>4 beshort 0 \b, 1 sided
+>>4 beshort 1 \b, 2 sided
+# starting track like: 0
*** 10643 LINES SKIPPED ***