mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
MFV: file 5.48
MFC after: 1 week
This commit is contained in:
commit
7af41682a9
82 files changed
+2759
-892
No files matched your search
+28
-2
@@ -1,3 +1,29 @@
|
||||
2026-05-07 11:32 Christos Zoulas <[email protected]>
|
||||
|
||||
* release 5.48
|
||||
|
||||
2026-05-11 15:55 Christos Zoulas <[email protected]>
|
||||
|
||||
* add landlock support (valoq)
|
||||
|
||||
2026-04-19 15:55 Christos Zoulas <[email protected]>
|
||||
|
||||
* add BE/LE GUID
|
||||
|
||||
2026-04-17 11:05 Christos Zoulas <[email protected]>
|
||||
|
||||
* multiple fixes to prevent integer overflow in 32 bits (kerwin)
|
||||
|
||||
2026-04-15 12:40 Christos Zoulas <[email protected]>
|
||||
|
||||
* PR/745: streamout: Don't flush when trying to set negative offsets
|
||||
on pipes, just continue, fixes 'cat file.zip | file -'
|
||||
* PR/753: vmihalko: Fix race is magic_getpath()
|
||||
|
||||
2026-03-11 15:14 Christos Zoulas <[email protected]>
|
||||
|
||||
* PR/728: Anton Monroe: Reinstate regex/c
|
||||
|
||||
2026-02-26 11:32 Christos Zoulas <[email protected]>
|
||||
|
||||
* release 5.47
|
||||
@@ -11,8 +37,8 @@
|
||||
|
||||
2025-05-28 15:20 Christos Zoulas <[email protected]>
|
||||
|
||||
PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
|
||||
when fd is not available.
|
||||
* PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
|
||||
when fd is not available.
|
||||
|
||||
2025-05-28 12:50 Christos Zoulas <[email protected]>
|
||||
|
||||
|
||||
+41
-22
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -70,6 +70,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -153,10 +155,9 @@ am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(pkgconfigexecdir)"
|
||||
DATA = $(pkgconfigexec_DATA)
|
||||
@@ -196,8 +197,8 @@ distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \
|
||||
; rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
@@ -227,14 +228,16 @@ am__relativize = \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
GZIP_ENV = -9
|
||||
DIST_TARGETS = dist-gzip
|
||||
# Exists only to be overridden by the user if desired.
|
||||
AM_DISTCHECK_DVI_TARGET = dvi
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = \
|
||||
find . \( -type f -a \! \
|
||||
\( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print
|
||||
pkgdatadir = @pkgdatadir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
@@ -316,8 +319,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -413,12 +418,12 @@ config.h: stamp-h1
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(AM_V_at)rm -f stamp-h1
|
||||
$(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
$(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
$(AM_V_at)rm -f stamp-h1
|
||||
$(AM_V_at)touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
@@ -560,12 +565,13 @@ cscopelist-am: $(am__tagged_files)
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
$(AM_V_at)$(MKDIR_P) "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
@@ -635,6 +641,10 @@ dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip3: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip3 -c >$(distdir).tar.bz3
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
@@ -676,9 +686,11 @@ dist dist-all:
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.bz3*) \
|
||||
bzip3 -dc $(distdir).tar.bz3 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
@@ -686,7 +698,7 @@ distcheck: dist
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
*.tar.zst*) \
|
||||
@@ -789,8 +801,8 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@@ -870,8 +882,8 @@ uninstall-am: uninstall-pkgconfigexecDATA
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip dist-zstd distcheck distclean \
|
||||
dist-all dist-bzip2 dist-bzip3 dist-gzip dist-lzip dist-shar \
|
||||
dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \
|
||||
distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
@@ -891,3 +903,10 @@ uninstall-am: uninstall-pkgconfigexecDATA
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
@@ -1,6 +1,6 @@
|
||||
## README for file(1) Command and the libmagic(3) library ##
|
||||
|
||||
@(#) $File: README.md,v 1.5 2023/05/28 13:59:47 christos Exp $
|
||||
@(#) $File: README.md,v 1.7 2026/06/07 23:44:12 christos Exp $
|
||||
|
||||
- Bug Tracker: <https://bugs.astron.com/>
|
||||
- Build Status: <https://travis-ci.org/file/file>
|
||||
@@ -64,7 +64,8 @@ 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).
|
||||
* `ChangeLog` - log of important changes
|
||||
* `README.md` - 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
|
||||
@@ -93,6 +94,7 @@ COPYING - read this first.
|
||||
* `src/is_json.c` - knows about JavaScript Object Notation format (RFC 8259).
|
||||
* `src/is_simh.c` - knows about SIMH tape file format.
|
||||
* `src/is_tar.c, tar.h` - knows about Tape ARchive format (courtesy John Gilmore).
|
||||
* `src/landlock.c` - linux landlock protection
|
||||
* `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.
|
||||
@@ -103,7 +105,10 @@ COPYING - read this first.
|
||||
* `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/swap.h` - byte swapping
|
||||
* `src/swap.c` - byte swapping
|
||||
* `src/mygetopt.h` - replacement for OS's that don't have it.
|
||||
* `src/seccomp.c` - linux seccomp protection
|
||||
* `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.
|
||||
|
||||
Vendored
+297
-130
@@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.18 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.16'
|
||||
[am__api_version='1.18'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.16.5], [],
|
||||
m4_if([$1], [1.18], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.16.5])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.18])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -273,7 +273,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# When given -MP, icc 7.0 and 7.1 complain thus:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
@@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -400,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -500,8 +500,9 @@ AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])],
|
||||
[_AM_PROG_TAR([ustar])])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES([CC])],
|
||||
@@ -534,7 +535,7 @@ if test -z "$CSCOPE"; then
|
||||
fi
|
||||
AC_SUBST([CSCOPE])
|
||||
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
AC_REQUIRE([_AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
@@ -542,47 +543,9 @@ AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
AC_REQUIRE([_AM_PROG_RM_F])
|
||||
AC_REQUIRE([_AM_PROG_XARGS_N])
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell [email protected] about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi
|
||||
dnl The trailing newline in this macro's definition is deliberate, for
|
||||
dnl backward compatibility and to allow trailing 'dnl'-style comments
|
||||
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
|
||||
@@ -615,7 +578,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -636,7 +599,7 @@ if test x"${install_sh+set}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -657,7 +620,7 @@ AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -700,7 +663,7 @@ AC_SUBST([am__quote])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -734,7 +697,7 @@ fi
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -763,7 +726,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -795,7 +758,10 @@ AC_CACHE_CHECK(
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
# aligned with autoconf, so not including core; see bug#72225.
|
||||
rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \
|
||||
conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \
|
||||
conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM
|
||||
unset am_i])
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
@@ -810,7 +776,23 @@ AC_LANG_POP([C])])
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_PROG_RM_F
|
||||
# ---------------
|
||||
# Check whether 'rm -f' without any arguments works.
|
||||
# https://bugs.gnu.org/10828
|
||||
AC_DEFUN([_AM_PROG_RM_F],
|
||||
[am__rm_f_notfound=
|
||||
AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
|
||||
AC_SUBST(am__rm_f_notfound)
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -829,26 +811,181 @@ AC_DEFUN([AM_RUN_LOG],
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_SLEEP_FRACTIONAL_SECONDS
|
||||
# ----------------------------
|
||||
AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
|
||||
AC_CACHE_CHECK([whether sleep supports fractional seconds],
|
||||
am_cv_sleep_fractional_seconds, [dnl
|
||||
AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
|
||||
[am_cv_sleep_fractional_seconds=no])
|
||||
])])
|
||||
|
||||
# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
|
||||
# -----------------------------------
|
||||
# Determine the filesystem's resolution for file modification
|
||||
# timestamps. The coarsest we know of is FAT, with a resolution
|
||||
# of only two seconds, even with the most recent "exFAT" extensions.
|
||||
# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
|
||||
# nanosecond, matching clock_gettime. However, it is probably not
|
||||
# possible to delay execution of a shell script for less than one
|
||||
# millisecond, due to process creation overhead and scheduling
|
||||
# granularity, so we don't check for anything finer than that. (See below.)
|
||||
AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
|
||||
AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
|
||||
AC_CACHE_CHECK([filesystem timestamp resolution],
|
||||
am_cv_filesystem_timestamp_resolution, [dnl
|
||||
# Default to the worst case.
|
||||
am_cv_filesystem_timestamp_resolution=2
|
||||
|
||||
# Only try to go finer than 1 sec if sleep can do it.
|
||||
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
|
||||
# - 1 sec is not much of a win compared to 2 sec, and
|
||||
# - it takes 2 seconds to perform the test whether 1 sec works.
|
||||
#
|
||||
# Instead, just use the default 2s on platforms that have 1s resolution,
|
||||
# accept the extra 1s delay when using $sleep in the Automake tests, in
|
||||
# exchange for not incurring the 2s delay for running the test for all
|
||||
# packages.
|
||||
#
|
||||
am_try_resolutions=
|
||||
if test "$am_cv_sleep_fractional_seconds" = yes; then
|
||||
# Even a millisecond often causes a bunch of false positives,
|
||||
# so just try a hundredth of a second. The time saved between .001 and
|
||||
# .01 is not terribly consequential.
|
||||
am_try_resolutions="0.01 0.1 $am_try_resolutions"
|
||||
fi
|
||||
|
||||
# In order to catch current-generation FAT out, we must *modify* files
|
||||
# that already exist; the *creation* timestamp is finer. Use names
|
||||
# that make ls -t sort them differently when they have equal
|
||||
# timestamps than when they have distinct timestamps, keeping
|
||||
# in mind that ls -t prints the *newest* file first.
|
||||
rm -f conftest.ts?
|
||||
: > conftest.ts1
|
||||
: > conftest.ts2
|
||||
: > conftest.ts3
|
||||
|
||||
# Make sure ls -t actually works. Do 'set' in a subshell so we don't
|
||||
# clobber the current shell's arguments. (Outer-level square brackets
|
||||
# are removed by m4; they're present so that m4 does not expand
|
||||
# <dollar><star>; be careful, easy to get confused.)
|
||||
if (
|
||||
set X `[ls -t conftest.ts[12]]` &&
|
||||
{
|
||||
test "$[]*" != "X conftest.ts1 conftest.ts2" ||
|
||||
test "$[]*" != "X conftest.ts2 conftest.ts1";
|
||||
}
|
||||
); then :; else
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
_AS_ECHO_UNQUOTED(
|
||||
["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
|
||||
[AS_MESSAGE_LOG_FD])
|
||||
AC_MSG_FAILURE([ls -t produces unexpected output.
|
||||
Make sure there is not a broken ls alias in your environment.])
|
||||
fi
|
||||
|
||||
for am_try_res in $am_try_resolutions; do
|
||||
# Any one fine-grained sleep might happen to cross the boundary
|
||||
# between two values of a coarser actual resolution, but if we do
|
||||
# two fine-grained sleeps in a row, at least one of them will fall
|
||||
# entirely within a coarse interval.
|
||||
echo alpha > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo beta > conftest.ts2
|
||||
sleep $am_try_res
|
||||
echo gamma > conftest.ts3
|
||||
|
||||
# We assume that 'ls -t' will make use of high-resolution
|
||||
# timestamps if the operating system supports them at all.
|
||||
if (set X `ls -t conftest.ts?` &&
|
||||
test "$[]2" = conftest.ts3 &&
|
||||
test "$[]3" = conftest.ts2 &&
|
||||
test "$[]4" = conftest.ts1); then
|
||||
#
|
||||
# Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
|
||||
# because we don't need to test make.
|
||||
make_ok=true
|
||||
if test $am_try_res != 1; then
|
||||
# But if we've succeeded so far with a subsecond resolution, we
|
||||
# have one more thing to check: make. It can happen that
|
||||
# everything else supports the subsecond mtimes, but make doesn't;
|
||||
# notably on macOS, which ships make 3.81 from 2006 (the last one
|
||||
# released under GPLv2). https://bugs.gnu.org/68808
|
||||
#
|
||||
# We test $MAKE if it is defined in the environment, else "make".
|
||||
# It might get overridden later, but our hope is that in practice
|
||||
# it does not matter: it is the system "make" which is (by far)
|
||||
# the most likely to be broken, whereas if the user overrides it,
|
||||
# probably they did so with a better, or at least not worse, make.
|
||||
# https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
|
||||
#
|
||||
# Create a Makefile (real tab character here):
|
||||
rm -f conftest.mk
|
||||
echo 'conftest.ts1: conftest.ts2' >conftest.mk
|
||||
echo ' touch conftest.ts2' >>conftest.mk
|
||||
#
|
||||
# Now, running
|
||||
# touch conftest.ts1; touch conftest.ts2; make
|
||||
# should touch ts1 because ts2 is newer. This could happen by luck,
|
||||
# but most often, it will fail if make's support is insufficient. So
|
||||
# test for several consecutive successes.
|
||||
#
|
||||
# (We reuse conftest.ts[12] because we still want to modify existing
|
||||
# files, not create new ones, per above.)
|
||||
n=0
|
||||
make=${MAKE-make}
|
||||
until test $n -eq 3; do
|
||||
echo one > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo two > conftest.ts2 # ts2 should now be newer than ts1
|
||||
if $make -f conftest.mk | grep 'up to date' >/dev/null; then
|
||||
make_ok=false
|
||||
break # out of $n loop
|
||||
fi
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
fi
|
||||
#
|
||||
if $make_ok; then
|
||||
# Everything we know to check worked out, so call this resolution good.
|
||||
am_cv_filesystem_timestamp_resolution=$am_try_res
|
||||
break # out of $am_try_res loop
|
||||
fi
|
||||
# Otherwise, we'll go on to check the next resolution.
|
||||
fi
|
||||
done
|
||||
rm -f conftest.ts?
|
||||
# (end _am_filesystem_timestamp_resolution)
|
||||
])])
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
|
||||
# This check should not be cached, as it may vary across builds of
|
||||
# different projects.
|
||||
AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([unsafe absolute working directory name]);;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
|
||||
esac
|
||||
|
||||
@@ -857,49 +994,40 @@ esac
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
am_has_slept=no
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
am_build_env_is_sane=no
|
||||
am_has_slept=no
|
||||
rm -f conftest.file
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
test "$[]2" = conftest.file
|
||||
); then
|
||||
am_build_env_is_sane=yes
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep "$am_cv_filesystem_timestamp_resolution"
|
||||
am_has_slept=yes
|
||||
done
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
if test "$[2]" = conftest.file || test $am_try -eq 2; then
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep 1
|
||||
am_has_slept=yes
|
||||
done
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
AC_MSG_RESULT([$am_build_env_is_sane])
|
||||
if test "$am_build_env_is_sane" = no; then
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
# If we didn't sleep, we still need to ensure time stamps of config.status and
|
||||
# generated files are strictly newer.
|
||||
am_sleep_pid=
|
||||
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
|
||||
( sleep 1 ) &
|
||||
AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
|
||||
( sleep "$am_cv_filesystem_timestamp_resolution" ) &
|
||||
am_sleep_pid=$!
|
||||
fi
|
||||
])
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[AC_MSG_CHECKING([that generated files are newer than configure])
|
||||
if test -n "$am_sleep_pid"; then
|
||||
@@ -910,18 +1038,18 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Enable less verbose build rules; with the default set to DEFAULT
|
||||
# ("yes" being less verbose, "no" or empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_ARG_ENABLE([silent-rules], [dnl
|
||||
# _AM_SILENT_RULES
|
||||
# ----------------
|
||||
# Enable less verbose build rules support.
|
||||
AC_DEFUN([_AM_SILENT_RULES],
|
||||
[AM_DEFAULT_VERBOSITY=1
|
||||
AC_ARG_ENABLE([silent-rules], [dnl
|
||||
AS_HELP_STRING(
|
||||
[--enable-silent-rules],
|
||||
[less verbose build output (undo: "make V=1")])
|
||||
@@ -929,11 +1057,6 @@ AS_HELP_STRING(
|
||||
[--disable-silent-rules],
|
||||
[verbose build output (undo: "make V=0")])dnl
|
||||
])
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
|
||||
esac
|
||||
dnl
|
||||
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
|
||||
dnl do not support nested variable expansions.
|
||||
@@ -952,14 +1075,6 @@ am__doit:
|
||||
else
|
||||
am_cv_make_support_nested_variables=no
|
||||
fi])
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AC_SUBST([AM_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_V])dnl
|
||||
@@ -968,9 +1083,37 @@ AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
|
||||
AM_BACKSLASH='\'
|
||||
AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
|
||||
dnl to AM_SILENT_RULES to change the default value.
|
||||
AC_CONFIG_COMMANDS_PRE([dnl
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
esac
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
|
||||
# empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_REQUIRE([_AM_SILENT_RULES])
|
||||
AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline
|
||||
dnl We intentionally force a newline after the assignment, since a) nothing
|
||||
dnl good can come of more text following, and b) that was the behavior
|
||||
dnl before 1.17. See https://bugs.gnu.org/72267.
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -998,7 +1141,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1017,7 +1160,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1063,15 +1206,19 @@ m4_if([$1], [v7],
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
|
||||
if test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if test x$am_uid = xunknown; then
|
||||
AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
|
||||
elif test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi
|
||||
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
|
||||
if test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
if test x$gm_gid = xunknown; then
|
||||
AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
|
||||
elif test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
@@ -1148,6 +1295,26 @@ AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# _AM_PROG_XARGS_N
|
||||
# ----------------
|
||||
# Check whether 'xargs -n' works. It should work everywhere, so the fallback
|
||||
# is not optimized at all as we never expect to use it.
|
||||
AC_DEFUN([_AM_PROG_XARGS_N],
|
||||
[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
|
||||
AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
|
||||
3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
|
||||
AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
|
||||
am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
|
||||
])dnl
|
||||
AC_SUBST(am__xargs_n)
|
||||
])
|
||||
|
||||
m4_include([m4/libtool.m4])
|
||||
m4_include([m4/ltoptions.m4])
|
||||
m4_include([m4/ltsugar.m4])
|
||||
|
||||
+28
-12
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
scriptversion=2025-02-03.05; # UTC
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <[email protected]>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -37,11 +37,11 @@ IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# func_file_conv build_file unneeded_conversions
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
|
||||
# conversion will take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
@@ -51,9 +51,20 @@ func_file_conv ()
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
|
||||
# MSYS2 environment.
|
||||
file_conv=cygwin
|
||||
else
|
||||
# Original MinGW environment.
|
||||
file_conv=mingw
|
||||
fi
|
||||
;;
|
||||
CYGWIN* | MSYS*)
|
||||
MSYS*)
|
||||
# Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
|
||||
file_conv=cygwin
|
||||
;;
|
||||
CYGWIN*)
|
||||
# Cygwin environment.
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
@@ -63,12 +74,14 @@ func_file_conv ()
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
# This is the optimization mentioned above:
|
||||
# If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
cygwin/*)
|
||||
file=`cygpath -w "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
@@ -143,7 +156,7 @@ func_cl_wrapper ()
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
*.o | *.lo | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
@@ -248,14 +261,17 @@ If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <[email protected]>.
|
||||
GNU Automake home page: <https://www.gnu.org/software/automake/>.
|
||||
General help using GNU software: <https://www.gnu.org/gethelp/>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
echo "compile (GNU Automake) $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
@@ -340,7 +356,7 @@ exit $ret
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
|
||||
@@ -107,6 +107,12 @@
|
||||
/* Define to 1 if you have the 'zstd' library (-lzstd). */
|
||||
#undef HAVE_LIBZSTD
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <linux/landlock.h> header file. */
|
||||
#undef HAVE_LINUX_LANDLOCK_H
|
||||
|
||||
/* Define to 1 if you have the 'localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
|
||||
Vendored
+419
-140
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.72 for file 5.47.
|
||||
# Generated by GNU Autoconf 2.72 for file 5.48.
|
||||
#
|
||||
# Report bugs to <[email protected]>.
|
||||
#
|
||||
@@ -614,8 +614,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='file'
|
||||
PACKAGE_TARNAME='file'
|
||||
PACKAGE_VERSION='5.47'
|
||||
PACKAGE_STRING='file 5.47'
|
||||
PACKAGE_VERSION='5.48'
|
||||
PACKAGE_STRING='file 5.48'
|
||||
PACKAGE_BUGREPORT='[email protected]'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -716,6 +716,8 @@ build_os
|
||||
build_vendor
|
||||
build_cpu
|
||||
build
|
||||
am__xargs_n
|
||||
am__rm_f_notfound
|
||||
AM_BACKSLASH
|
||||
AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V
|
||||
@@ -799,6 +801,7 @@ enable_zstdlib
|
||||
enable_lzlib
|
||||
enable_lrziplib
|
||||
enable_libseccomp
|
||||
enable_landlock
|
||||
enable_fsect_man5
|
||||
enable_dependency_tracking
|
||||
enable_static
|
||||
@@ -1370,7 +1373,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.47 to adapt to many kinds of systems.
|
||||
'configure' configures file 5.48 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1441,7 +1444,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of file 5.47:";;
|
||||
short | recursive ) echo "Configuration of file 5.48:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1463,6 +1466,8 @@ Optional Features:
|
||||
--disable-lrziplib disable liblrzip (lrzip) compression support
|
||||
[default=auto]
|
||||
--disable-libseccomp disable libseccomp sandboxing [default=auto]
|
||||
--disable-landlock disable Landlock filesystem sandboxing
|
||||
[default=auto]
|
||||
--enable-fsect-man5 enable file formats in man section 5
|
||||
--enable-dependency-tracking
|
||||
do not reject slow dependency extractors
|
||||
@@ -1567,7 +1572,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
file configure 5.47
|
||||
file configure 5.48
|
||||
generated by GNU Autoconf 2.72
|
||||
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
@@ -2153,7 +2158,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.47, which was
|
||||
It was created by file $as_me 5.48, which was
|
||||
generated by GNU Autoconf 2.72. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@@ -2933,7 +2938,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
am__api_version='1.16'
|
||||
am__api_version='1.18'
|
||||
|
||||
|
||||
|
||||
@@ -3036,6 +3041,165 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
|
||||
|
||||
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sleep supports fractional seconds" >&5
|
||||
printf %s "checking whether sleep supports fractional seconds... " >&6; }
|
||||
if test ${am_cv_sleep_fractional_seconds+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) if sleep 0.001 2>/dev/null
|
||||
then :
|
||||
am_cv_sleep_fractional_seconds=yes
|
||||
else case e in #(
|
||||
e) am_cv_sleep_fractional_seconds=no ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_sleep_fractional_seconds" >&5
|
||||
printf "%s\n" "$am_cv_sleep_fractional_seconds" >&6; }
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking filesystem timestamp resolution" >&5
|
||||
printf %s "checking filesystem timestamp resolution... " >&6; }
|
||||
if test ${am_cv_filesystem_timestamp_resolution+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) # Default to the worst case.
|
||||
am_cv_filesystem_timestamp_resolution=2
|
||||
|
||||
# Only try to go finer than 1 sec if sleep can do it.
|
||||
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
|
||||
# - 1 sec is not much of a win compared to 2 sec, and
|
||||
# - it takes 2 seconds to perform the test whether 1 sec works.
|
||||
#
|
||||
# Instead, just use the default 2s on platforms that have 1s resolution,
|
||||
# accept the extra 1s delay when using $sleep in the Automake tests, in
|
||||
# exchange for not incurring the 2s delay for running the test for all
|
||||
# packages.
|
||||
#
|
||||
am_try_resolutions=
|
||||
if test "$am_cv_sleep_fractional_seconds" = yes; then
|
||||
# Even a millisecond often causes a bunch of false positives,
|
||||
# so just try a hundredth of a second. The time saved between .001 and
|
||||
# .01 is not terribly consequential.
|
||||
am_try_resolutions="0.01 0.1 $am_try_resolutions"
|
||||
fi
|
||||
|
||||
# In order to catch current-generation FAT out, we must *modify* files
|
||||
# that already exist; the *creation* timestamp is finer. Use names
|
||||
# that make ls -t sort them differently when they have equal
|
||||
# timestamps than when they have distinct timestamps, keeping
|
||||
# in mind that ls -t prints the *newest* file first.
|
||||
rm -f conftest.ts?
|
||||
: > conftest.ts1
|
||||
: > conftest.ts2
|
||||
: > conftest.ts3
|
||||
|
||||
# Make sure ls -t actually works. Do 'set' in a subshell so we don't
|
||||
# clobber the current shell's arguments. (Outer-level square brackets
|
||||
# are removed by m4; they're present so that m4 does not expand
|
||||
# <dollar><star>; be careful, easy to get confused.)
|
||||
if (
|
||||
set X `ls -t conftest.ts[12]` &&
|
||||
{
|
||||
test "$*" != "X conftest.ts1 conftest.ts2" ||
|
||||
test "$*" != "X conftest.ts2 conftest.ts1";
|
||||
}
|
||||
); then :; else
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
printf "%s\n" ""Bad output from ls -t: \"`ls -t conftest.ts[12]`\""" >&5
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
|
||||
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
|
||||
as_fn_error $? "ls -t produces unexpected output.
|
||||
Make sure there is not a broken ls alias in your environment.
|
||||
See 'config.log' for more details" "$LINENO" 5; }
|
||||
fi
|
||||
|
||||
for am_try_res in $am_try_resolutions; do
|
||||
# Any one fine-grained sleep might happen to cross the boundary
|
||||
# between two values of a coarser actual resolution, but if we do
|
||||
# two fine-grained sleeps in a row, at least one of them will fall
|
||||
# entirely within a coarse interval.
|
||||
echo alpha > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo beta > conftest.ts2
|
||||
sleep $am_try_res
|
||||
echo gamma > conftest.ts3
|
||||
|
||||
# We assume that 'ls -t' will make use of high-resolution
|
||||
# timestamps if the operating system supports them at all.
|
||||
if (set X `ls -t conftest.ts?` &&
|
||||
test "$2" = conftest.ts3 &&
|
||||
test "$3" = conftest.ts2 &&
|
||||
test "$4" = conftest.ts1); then
|
||||
#
|
||||
# Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
|
||||
# because we don't need to test make.
|
||||
make_ok=true
|
||||
if test $am_try_res != 1; then
|
||||
# But if we've succeeded so far with a subsecond resolution, we
|
||||
# have one more thing to check: make. It can happen that
|
||||
# everything else supports the subsecond mtimes, but make doesn't;
|
||||
# notably on macOS, which ships make 3.81 from 2006 (the last one
|
||||
# released under GPLv2). https://bugs.gnu.org/68808
|
||||
#
|
||||
# We test $MAKE if it is defined in the environment, else "make".
|
||||
# It might get overridden later, but our hope is that in practice
|
||||
# it does not matter: it is the system "make" which is (by far)
|
||||
# the most likely to be broken, whereas if the user overrides it,
|
||||
# probably they did so with a better, or at least not worse, make.
|
||||
# https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
|
||||
#
|
||||
# Create a Makefile (real tab character here):
|
||||
rm -f conftest.mk
|
||||
echo 'conftest.ts1: conftest.ts2' >conftest.mk
|
||||
echo ' touch conftest.ts2' >>conftest.mk
|
||||
#
|
||||
# Now, running
|
||||
# touch conftest.ts1; touch conftest.ts2; make
|
||||
# should touch ts1 because ts2 is newer. This could happen by luck,
|
||||
# but most often, it will fail if make's support is insufficient. So
|
||||
# test for several consecutive successes.
|
||||
#
|
||||
# (We reuse conftest.ts[12] because we still want to modify existing
|
||||
# files, not create new ones, per above.)
|
||||
n=0
|
||||
make=${MAKE-make}
|
||||
until test $n -eq 3; do
|
||||
echo one > conftest.ts1
|
||||
sleep $am_try_res
|
||||
echo two > conftest.ts2 # ts2 should now be newer than ts1
|
||||
if $make -f conftest.mk | grep 'up to date' >/dev/null; then
|
||||
make_ok=false
|
||||
break # out of $n loop
|
||||
fi
|
||||
n=`expr $n + 1`
|
||||
done
|
||||
fi
|
||||
#
|
||||
if $make_ok; then
|
||||
# Everything we know to check worked out, so call this resolution good.
|
||||
am_cv_filesystem_timestamp_resolution=$am_try_res
|
||||
break # out of $am_try_res loop
|
||||
fi
|
||||
# Otherwise, we'll go on to check the next resolution.
|
||||
fi
|
||||
done
|
||||
rm -f conftest.ts?
|
||||
# (end _am_filesystem_timestamp_resolution)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_filesystem_timestamp_resolution" >&5
|
||||
printf "%s\n" "$am_cv_filesystem_timestamp_resolution" >&6; }
|
||||
|
||||
# This check should not be cached, as it may vary across builds of
|
||||
# different projects.
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
|
||||
printf %s "checking whether build environment is sane... " >&6; }
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
@@ -3044,10 +3208,14 @@ am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[\\\"\#\$\&\'\`$am_lf]*)
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
|
||||
esac
|
||||
|
||||
@@ -3056,49 +3224,45 @@ esac
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
am_has_slept=no
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
if test "$*" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$*" != "X conftest.file $srcdir/configure"; then
|
||||
am_build_env_is_sane=no
|
||||
am_has_slept=no
|
||||
rm -f conftest.file
|
||||
for am_try in 1 2; do
|
||||
echo "timestamp, slept: $am_has_slept" > conftest.file
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
test "$2" = conftest.file
|
||||
); then
|
||||
am_build_env_is_sane=yes
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep "$am_cv_filesystem_timestamp_resolution"
|
||||
am_has_slept=yes
|
||||
done
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment" "$LINENO" 5
|
||||
fi
|
||||
if test "$2" = conftest.file || test $am_try -eq 2; then
|
||||
break
|
||||
fi
|
||||
# Just in case.
|
||||
sleep 1
|
||||
am_has_slept=yes
|
||||
done
|
||||
test "$2" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
as_fn_error $? "newly created file is older than distributed files!
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_build_env_is_sane" >&5
|
||||
printf "%s\n" "$am_build_env_is_sane" >&6; }
|
||||
if test "$am_build_env_is_sane" = no; then
|
||||
as_fn_error $? "newly created file is older than distributed files!
|
||||
Check your system clock" "$LINENO" 5
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
# If we didn't sleep, we still need to ensure time stamps of config.status and
|
||||
# generated files are strictly newer.
|
||||
am_sleep_pid=
|
||||
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
|
||||
( sleep 1 ) &
|
||||
if test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1
|
||||
then :
|
||||
|
||||
else case e in #(
|
||||
e) ( sleep "$am_cv_filesystem_timestamp_resolution" ) &
|
||||
am_sleep_pid=$!
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
rm -f conftest.file
|
||||
@@ -3388,17 +3552,13 @@ else
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
|
||||
AM_DEFAULT_VERBOSITY=1
|
||||
# Check whether --enable-silent-rules was given.
|
||||
if test ${enable_silent_rules+y}
|
||||
then :
|
||||
enableval=$enable_silent_rules;
|
||||
fi
|
||||
|
||||
case $enable_silent_rules in # (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=1;;
|
||||
esac
|
||||
am_make=${MAKE-make}
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
|
||||
printf %s "checking whether $am_make supports nested variables... " >&6; }
|
||||
@@ -3421,15 +3581,45 @@ esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
|
||||
printf "%s\n" "$am_cv_make_support_nested_variables" >&6; }
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AM_BACKSLASH='\'
|
||||
|
||||
am__rm_f_notfound=
|
||||
if (rm -f && rm -fr && rm -rf) 2>/dev/null
|
||||
then :
|
||||
|
||||
else case e in #(
|
||||
e) am__rm_f_notfound='""' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking xargs -n works" >&5
|
||||
printf %s "checking xargs -n works... " >&6; }
|
||||
if test ${am_cv_xargs_n_works+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) if test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
|
||||
3"
|
||||
then :
|
||||
am_cv_xargs_n_works=yes
|
||||
else case e in #(
|
||||
e) am_cv_xargs_n_works=no ;;
|
||||
esac
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_xargs_n_works" >&5
|
||||
printf "%s\n" "$am_cv_xargs_n_works" >&6; }
|
||||
if test "$am_cv_xargs_n_works" = yes
|
||||
then :
|
||||
am__xargs_n='xargs -n'
|
||||
else case e in #(
|
||||
e) am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "" "$am__xargs_n_arg"; done; }'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then
|
||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
|
||||
# is not polluted with repeated "-I."
|
||||
@@ -3452,7 +3642,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='file'
|
||||
VERSION='5.47'
|
||||
VERSION='5.48'
|
||||
|
||||
|
||||
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
||||
@@ -3490,9 +3680,133 @@ AMTAR='$${TAR-tar}'
|
||||
|
||||
|
||||
# We'll loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar pax cpio none'
|
||||
_am_tools='gnutar plaintar pax cpio none'
|
||||
|
||||
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
|
||||
# The POSIX 1988 'ustar' format is defined with fixed-size fields.
|
||||
# There is notably a 21 bits limit for the UID and the GID. In fact,
|
||||
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
|
||||
# and bug#13588).
|
||||
am_max_uid=2097151 # 2^21 - 1
|
||||
am_max_gid=$am_max_uid
|
||||
# The $UID and $GID variables are not portable, so we need to resort
|
||||
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
|
||||
# below are definitely unexpected, so allow the users to see them
|
||||
# (that is, avoid stderr redirection).
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5
|
||||
printf %s "checking whether UID '$am_uid' is supported by ustar format... " >&6; }
|
||||
if test x$am_uid = xunknown; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ancient id detected; assuming current UID is ok, but dist-ustar might not work" >&5
|
||||
printf "%s\n" "$as_me: WARNING: ancient id detected; assuming current UID is ok, but dist-ustar might not work" >&2;}
|
||||
elif test $am_uid -le $am_max_uid; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
_am_tools=none
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5
|
||||
printf %s "checking whether GID '$am_gid' is supported by ustar format... " >&6; }
|
||||
if test x$gm_gid = xunknown; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: ancient id detected; assuming current GID is ok, but dist-ustar might not work" >&5
|
||||
printf "%s\n" "$as_me: WARNING: ancient id detected; assuming current GID is ok, but dist-ustar might not work" >&2;}
|
||||
elif test $am_gid -le $am_max_gid; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
_am_tools=none
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
|
||||
printf %s "checking how to create a ustar tar archive... " >&6; }
|
||||
|
||||
# Go ahead even if we have the value already cached. We do so because we
|
||||
# need to set the values for the 'am__tar' and 'am__untar' variables.
|
||||
_am_tools=${am_cv_prog_tar_ustar-$_am_tools}
|
||||
|
||||
for _am_tool in $_am_tools; do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar; do
|
||||
{ echo "$as_me:$LINENO: $_am_tar --version" >&5
|
||||
($_am_tar --version) >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && break
|
||||
done
|
||||
am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x ustar -w "$$tardir"'
|
||||
am__tar_='pax -L -x ustar -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
|
||||
am__untar='cpio -i -H ustar -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_ustar}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works.
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
{ echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
|
||||
(tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
{ echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
|
||||
($am__untar <conftest.tar) >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
{ echo "$as_me:$LINENO: cat conftest.dir/file" >&5
|
||||
(cat conftest.dir/file) >&5 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
if test ${am_cv_prog_tar_ustar+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) am_cv_prog_tar_ustar=$_am_tool ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
|
||||
printf "%s\n" "$am_cv_prog_tar_ustar" >&6; }
|
||||
|
||||
|
||||
|
||||
@@ -3513,89 +3827,13 @@ fi
|
||||
|
||||
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell [email protected] about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
AM_DEFAULT_VERBOSITY=0
|
||||
|
||||
END
|
||||
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-silent-rules was given.
|
||||
if test ${enable_silent_rules+y}
|
||||
then :
|
||||
enableval=$enable_silent_rules;
|
||||
fi
|
||||
|
||||
case $enable_silent_rules in # (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=0;;
|
||||
esac
|
||||
am_make=${MAKE-make}
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
|
||||
printf %s "checking whether $am_make supports nested variables... " >&6; }
|
||||
if test ${am_cv_make_support_nested_variables+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) if printf "%s\n" 'TRUE=$(BAR$(V))
|
||||
BAR0=false
|
||||
BAR1=true
|
||||
V=1
|
||||
am__doit:
|
||||
@$(TRUE)
|
||||
.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
|
||||
am_cv_make_support_nested_variables=yes
|
||||
else
|
||||
am_cv_make_support_nested_variables=no
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
|
||||
printf "%s\n" "$am_cv_make_support_nested_variables" >&6; }
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AM_BACKSLASH='\'
|
||||
|
||||
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
@@ -3735,6 +3973,17 @@ fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_libseccomp" >&5
|
||||
printf "%s\n" "$enable_libseccomp" >&6; }
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Landlock LSM support" >&5
|
||||
printf %s "checking for Landlock LSM support... " >&6; }
|
||||
# Check whether --enable-landlock was given.
|
||||
if test ${enable_landlock+y}
|
||||
then :
|
||||
enableval=$enable_landlock;
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_landlock" >&5
|
||||
printf "%s\n" "$enable_landlock" >&6; }
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file formats in man section 5" >&5
|
||||
printf %s "checking for file formats in man section 5... " >&6; }
|
||||
# Check whether --enable-fsect-man5 was given.
|
||||
@@ -4935,7 +5184,10 @@ _ACEOF
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
# aligned with autoconf, so not including core; see bug#72225.
|
||||
rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \
|
||||
conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \
|
||||
conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM
|
||||
unset am_i ;;
|
||||
esac
|
||||
fi
|
||||
@@ -5115,7 +5367,7 @@ else case e in #(
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# When given -MP, icc 7.0 and 7.1 complain thus:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
@@ -13968,6 +14220,12 @@ if test "x$ac_cv_header_wctype_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_WCTYPE_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_limits_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default"
|
||||
@@ -16204,6 +16462,15 @@ then :
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
if test "$enable_landlock" != "no"; then
|
||||
ac_fn_c_check_header_compile "$LINENO" "linux/landlock.h" "ac_cv_header_linux_landlock_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_linux_landlock_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_LINUX_LANDLOCK_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
if test "$MINGW" = 1; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for regexec in -lgnurx" >&5
|
||||
@@ -16452,6 +16719,18 @@ printf %s "checking that generated files are newer than configure... " >&6; }
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5
|
||||
printf "%s\n" "done" >&6; }
|
||||
case $enable_silent_rules in # (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
esac
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
|
||||
if test -n "$EXEEXT"; then
|
||||
am__EXEEXT_TRUE=
|
||||
am__EXEEXT_FALSE='#'
|
||||
@@ -16880,7 +17159,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.47, which was
|
||||
This file was extended by file $as_me 5.48, which was
|
||||
generated by GNU Autoconf 2.72. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -16948,7 +17227,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
file config.status 5.47
|
||||
file config.status 5.48
|
||||
configured by $0, generated by GNU Autoconf 2.72,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT([file],[5.47],[[email protected]])
|
||||
AC_INIT([file],[5.48],[[email protected]])
|
||||
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
@@ -69,6 +69,11 @@ AC_ARG_ENABLE([libseccomp],
|
||||
[AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
|
||||
AC_MSG_RESULT($enable_libseccomp)
|
||||
|
||||
AC_MSG_CHECKING(for Landlock LSM support)
|
||||
AC_ARG_ENABLE([landlock],
|
||||
[AS_HELP_STRING([--disable-landlock], [disable Landlock filesystem sandboxing @<:@default=auto@:>@])])
|
||||
AC_MSG_RESULT($enable_landlock)
|
||||
|
||||
AC_MSG_CHECKING(for file formats in man section 5)
|
||||
AC_ARG_ENABLE(fsect-man5,
|
||||
[ --enable-fsect-man5 enable file formats in man section 5],
|
||||
@@ -115,7 +120,7 @@ dnl Checks for headers
|
||||
AC_HEADER_MAJOR
|
||||
AC_HEADER_SYS_WAIT
|
||||
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(spawn.h utime.h wchar.h wctype.h limits.h)
|
||||
AC_CHECK_HEADERS(getopt.h err.h xlocale.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
|
||||
@@ -229,6 +234,9 @@ fi
|
||||
if test "$enable_libseccomp" != "no"; then
|
||||
AC_CHECK_LIB(seccomp, seccomp_init)
|
||||
fi
|
||||
if test "$enable_landlock" != "no"; then
|
||||
AC_CHECK_HEADERS(linux/landlock.h)
|
||||
fi
|
||||
if test "$MINGW" = 1; then
|
||||
AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
|
||||
fi
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
scriptversion=2024-12-03.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -47,11 +47,13 @@ Environment variables:
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <[email protected]>.
|
||||
GNU Automake home page: <https://www.gnu.org/software/automake/>.
|
||||
General help using GNU software: <https://www.gnu.org/gethelp/>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
echo "depcomp (GNU Automake) $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
@@ -113,7 +115,6 @@ nl='
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
@@ -128,7 +129,7 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
# Avoid interference from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
@@ -198,8 +199,8 @@ gcc3)
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## Note that this doesn't just cater to obsolete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IBM xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
@@ -783,7 +784,7 @@ exit 0
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -69,6 +69,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -141,10 +143,9 @@ am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
|
||||
}
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
|
||||
@@ -238,8 +239,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -504,6 +507,7 @@ ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -566,11 +570,11 @@ install-strip:
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(am__rm_f) $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@@ -687,3 +691,10 @@ libmagic.3: Makefile libmagic.man
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
+13
-11
@@ -1,5 +1,5 @@
|
||||
.\" $File: magic.man,v 1.115 2025/11/24 15:45:00 christos Exp $
|
||||
.Dd November 24, 2025
|
||||
.\" $File: magic.man,v 1.118 2026/04/19 19:56:49 christos Exp $
|
||||
.Dd April 19, 2026
|
||||
.Dt MAGIC __FSECTION__
|
||||
.Os
|
||||
.\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
|
||||
@@ -86,17 +86,17 @@ Use upper case insensitive matching: upper case
|
||||
characters in the magic match both lower and upper case characters in the
|
||||
target, whereas lower case characters in the magic only match upper case
|
||||
characters in the target.
|
||||
(not valid for regex)
|
||||
For regex, this turns on REG_ICASE.
|
||||
.It c
|
||||
Use lower case insensitive matching: lower case
|
||||
characters in the magic match both lower and upper case characters in the
|
||||
target, whereas upper case characters in the magic only match upper case
|
||||
target, whereas upper case characters in the magic only match lower case
|
||||
characters in the target.
|
||||
(not valid for regex)
|
||||
To do a complete case insensitive match, specify both
|
||||
.Dq c
|
||||
and
|
||||
.Dq C .
|
||||
For regex, this turns on REG_ICASE.
|
||||
.It f
|
||||
Require that the matched string is a full word, not a partial word match.
|
||||
.It s
|
||||
@@ -296,7 +296,7 @@ The
|
||||
modifier, changes the limit of length to mean number of lines instead of a
|
||||
byte count.
|
||||
Lines are delimited by the platforms native line delimiter.
|
||||
When a line count is specified, an implicit byte count also computed assuming
|
||||
When a line count is specified, an implicit byte count is also computed assuming
|
||||
each line is 80 characters long.
|
||||
If neither a byte or line count is specified, the search is limited automatically
|
||||
to 8KiB.
|
||||
@@ -373,10 +373,12 @@ The DER types are:
|
||||
.Dv rel-oid-iri .
|
||||
These types can be followed by an optional numeric size, which indicates
|
||||
the field width in bytes.
|
||||
.It Dv guid
|
||||
.It Dv guid ,
|
||||
.It Dv leguid ,
|
||||
.It Dv beguid
|
||||
A Globally Unique Identifier, parsed and printed as
|
||||
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
|
||||
It's format is a string.
|
||||
Its format is a string.
|
||||
.It Dv offset
|
||||
This is a quad value indicating the current offset of the file.
|
||||
It can be used to determine the size of the file or the magic buffer.
|
||||
@@ -602,7 +604,7 @@ the current magic description using the following format:
|
||||
!:strength OP VALUE
|
||||
.Ed
|
||||
.Pp
|
||||
The operand
|
||||
The operator
|
||||
.Dv OP
|
||||
can be:
|
||||
.Dv + ,
|
||||
@@ -613,7 +615,7 @@ or
|
||||
and
|
||||
.Dv VALUE
|
||||
is a constant between 0 and 255.
|
||||
This constant is applied using the specified operand
|
||||
This constant is applied using the specified operator
|
||||
to the currently computed default magic strength.
|
||||
.Pp
|
||||
Some file formats contain additional information which is to be printed
|
||||
@@ -709,7 +711,7 @@ That way variable length structures can be examined:
|
||||
.Pp
|
||||
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).
|
||||
there is neither PE\e0\e0 nor LX\e0\e0 in the above example).
|
||||
.Pp
|
||||
If this indirect offset cannot be used directly, simple calculations are
|
||||
possible: appending
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: a2ml,v 1.1 2026/03/20 13:59:12 christos Exp $
|
||||
# a2ml: file(1) magic for A2ML (Attested Markup Language) files
|
||||
# URL: https://github.com/hyperpolymath/a2ml
|
||||
# From: Jonathan D.A. Jewell <[email protected]>
|
||||
|
||||
# A2ML is a lightweight attested markup format with a typed, formally
|
||||
# verified core. Files use the .a2ml extension.
|
||||
# Specification: https://github.com/hyperpolymath/standards/blob/main/a2ml/SPEC-v1.0.adoc
|
||||
# MIME type: application/vnd.a2ml
|
||||
|
||||
# Document starts with @abstract directive (canonical A2ML opening)
|
||||
0 string @abstract: A2ML Attested Markup Language document
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
|
||||
# AI manifest files starting with agent-id or manifest block
|
||||
0 string agent-id: A2ML Attested Markup Language document (AI manifest)
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
|
||||
0 string manifest: A2ML Attested Markup Language document (AI manifest)
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
|
||||
0 string pedigree: A2ML Attested Markup Language document (AI manifest)
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
|
||||
# Heading line followed by @abstract deeper in the file
|
||||
0 string #\\
|
||||
>&0 search/512 \n@abstract: A2ML Attested Markup Language document
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
|
||||
# @opaque directive with language annotation (A2ML code block)
|
||||
0 search/512 @opaque(lang= A2ML Attested Markup Language document
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
!:strength -10
|
||||
|
||||
# @refs block (A2ML reference list)
|
||||
0 search/512 \n@refs:\n A2ML Attested Markup Language document
|
||||
!:mime application/vnd.a2ml
|
||||
!:ext a2ml
|
||||
!:strength -10
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: acorn,v 1.9 2024/08/30 17:29:28 christos Exp $
|
||||
# $File: acorn,v 1.10 2026/06/02 16:53:30 christos Exp $
|
||||
# acorn: file(1) magic for files found on Acorn systems
|
||||
#
|
||||
|
||||
@@ -67,3 +67,27 @@
|
||||
>>8 byte x version %d,
|
||||
>>10 leshort =1 1 pattern
|
||||
>>10 leshort !1 %d patterns
|
||||
|
||||
# BBC Micro ROM image type magic
|
||||
# 16KB 6502 sideways ROMs — name string at offset 9 (Acorn convention)
|
||||
#
|
||||
|
||||
# Language+Service ROMs: JMP at +0 AND +3, target high byte $80-$BF
|
||||
0 ubyte 0x4c
|
||||
>2 ubyte >0x7f
|
||||
>>2 ubyte <0xc0
|
||||
>>>3 ubyte 0x4c
|
||||
>>>>5 ubyte >0x7f
|
||||
>>>>>5 ubyte <0xc0
|
||||
>>>>>>9 string >\0 BBC Micro ROM (%s)
|
||||
|
||||
# Service-only ROMs: $00 at +0..+2, JMP at +3, target high byte $80-$BF
|
||||
0 lelong 0x4c000000
|
||||
>5 ubyte >0x7f
|
||||
>>5 ubyte <0xc0
|
||||
>>>9 string >\0 BBC Micro ROM (%s)
|
||||
|
||||
# Language-only ROMs: BASIC II pattern (CMP #$01; BEQ)
|
||||
0 leshort 0x01c9
|
||||
>2 leshort 0x1ff0
|
||||
>>9 string >\0 BBC Micro ROM (%s)
|
||||
@@ -1,29 +1,34 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: aes,v 1.1 2020/08/18 21:20:22 christos Exp $
|
||||
# $File: aes,v 1.5 2026/05/14 02:00:00 christos Exp $
|
||||
#
|
||||
# aes: magic file for AES encrypted files
|
||||
|
||||
# Summary: AES Crypt Encrypted Data File
|
||||
# From: Joerg Jenderek
|
||||
# From: Joerg Jenderek/Paul E. Jones
|
||||
# URL: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
|
||||
# Reference: https://www.aescrypt.com/aes_file_format.html
|
||||
0 string AES
|
||||
>3 ubyte <3 AES encrypted data, version %u
|
||||
>3 ubyte 0
|
||||
>>4 ubyte <0x10 AES encrypted data, version 0
|
||||
#!:mime application/aes
|
||||
!:mime application/x-aes-encrypted
|
||||
!:ext aes
|
||||
# For Version 2 the encrypted file can have text tags
|
||||
>>3 ubyte =2
|
||||
>3 ubyte >0
|
||||
>>4 ubyte 0
|
||||
>>>3 ubyte x AES encrypted data, version %u
|
||||
#!:mime application/aes
|
||||
!:mime application/x-aes-encrypted
|
||||
!:ext aes
|
||||
# Since Version 2 the encrypted file can have text tags
|
||||
>>3 ubyte >1
|
||||
# length of an extension identifier and contents like: 0 24 33 38
|
||||
#>>5 ubeshort x \b, tag length %u
|
||||
#>>5 pstring/H x '%s'
|
||||
#>>>>5 ubeshort x \b, tag length %u
|
||||
#>>>>5 pstring/H x '%s'
|
||||
# standard extension tags like CREATED_BY
|
||||
>>>7 string CREATED_BY \b, created by
|
||||
# software product, manufacturer like "SharpAESCrypt v1.3.3.0" "aescrypt (Windows GUI) 3.10" ...
|
||||
>>>>&1 string x "%s"
|
||||
>>>>&1 string x "%.64s"
|
||||
# TODO: more other tags
|
||||
# tag CREATED_DATE like YYYY-MM-DD
|
||||
# tag CREATED_TIME like HH:MM:SS
|
||||
#
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: amigaos,v 1.23 2026/02/05 18:49:06 christos Exp $
|
||||
# $File: amigaos,v 1.26 2026/04/17 15:13:18 christos Exp $
|
||||
# amigaos: file(1) magic for AmigaOS binary formats:
|
||||
|
||||
#
|
||||
@@ -11,6 +11,7 @@
|
||||
0 belong 0x000003e7 AmigaOS object/library data
|
||||
#
|
||||
0 beshort 0xe310 Amiga Workbench
|
||||
!:mime image/x-amiga-icon
|
||||
>2 beshort 1
|
||||
>>48 byte 1 disk icon
|
||||
>>48 byte 2 drawer icon
|
||||
@@ -218,3 +219,56 @@
|
||||
|
||||
# https://github.com/alb42/Leu/blob/master/TCDReaderUnit.pas
|
||||
3 string TURBOCALC TurboCalc spreadsheet
|
||||
|
||||
# MOST was a text/image viewer for AmigaOS, CFF is its compressed file format
|
||||
|
||||
# Text format (CFF\x00)
|
||||
0 string CFF\0 MOST compressed text data
|
||||
!:ext cff
|
||||
>0x30 beshort x \b, %u bytes compressed
|
||||
>0x34 beshort x \b, %u bytes uncompressed
|
||||
|
||||
# Image format (CFF\x01)
|
||||
0 string CFF\1 MOST compressed image data
|
||||
!:ext cff
|
||||
>0x32 beshort x \b, %u wide
|
||||
>0x34 beshort x \b, %u tall
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Crunch-Mania: file(1) magic for Amiga Crunch-Mania compressed files
|
||||
# https://www.amiga-stuff.com/crunchers-id.html
|
||||
|
||||
# Standard mode
|
||||
0 string CrM! Crunch-Mania data, standard
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
0 string Crm! Crunch-Mania data, standard, sampled
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
# LZH mode
|
||||
0 string CrM2 Crunch-Mania data, LZH
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
0 string Crm2 Crunch-Mania data, LZH, sampled
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
# Encrypted variants
|
||||
0 string crM! Crunch-Mania data, standard, encrypted
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
0 string crm! Crunch-Mania data, standard, sampled, encrypted
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
0 string crM2 Crunch-Mania data, LZH, encrypted
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
|
||||
0 string crm2 Crunch-Mania data, LZH, sampled, encrypted
|
||||
!:ext crm
|
||||
>6 belong x \b, %u bytes uncompressed
|
||||
@@ -0,0 +1,32 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: andrew,v 1.1 2026/04/16 15:13:19 christos Exp $
|
||||
# andrew: file(1) magic for Andrew Project files:
|
||||
# https://en.wikipedia.org/wiki/Andrew_Project
|
||||
|
||||
# Andrew Toolkit (ATK / AUIS) data stream
|
||||
# From Carnegie Mellon University's Andrew User Interface System (c. 1988)
|
||||
|
||||
0 string \\begindata{raster, Andrew Toolkit raster image data
|
||||
!:mime application/andrew-inset
|
||||
!:ext raster
|
||||
|
||||
0 string \\begindata{text, Andrew Toolkit text document
|
||||
!:mime application/andrew-inset
|
||||
!:ext ez
|
||||
|
||||
0 string \\begindata{table, Andrew Toolkit table
|
||||
!:mime application/andrew-inset
|
||||
!:ext ez
|
||||
|
||||
0 string \\begindata{figure, Andrew Toolkit figure
|
||||
!:mime application/andrew-inset
|
||||
!:ext ez
|
||||
|
||||
0 string \\begindata{zip, Andrew Toolkit zip (compound document)
|
||||
!:mime application/andrew-inset
|
||||
!:ext ez
|
||||
|
||||
# Generic fallback for any other ATK data type
|
||||
0 regex/s \\\\begindata\\{[a-z] Andrew Toolkit data
|
||||
!:mime application/andrew-inset
|
||||
!:ext ez
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------
|
||||
# $File: android,v 1.26 2024/09/04 19:06:11 christos Exp $
|
||||
# $File: android,v 1.27 2026/04/12 21:11:22 christos Exp $
|
||||
# Various android related magic entries
|
||||
#------------------------------------------------------------
|
||||
|
||||
@@ -184,6 +184,13 @@
|
||||
0 lelong 0x00080003 Android binary XML
|
||||
!:strength +1
|
||||
|
||||
# Android binary XML magic
|
||||
# Used by Android Package Mangaer to encode files in an efficient format.
|
||||
# Some known file using this format: /data/system/packages.xml, /data/system/packages-backup.xml
|
||||
# https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/util/BinaryXmlSerializer.java;l=72
|
||||
# From <[email protected]> "Yuvraj Saxena"
|
||||
0 string ABX Android binary XML
|
||||
|
||||
# Android cryptfs footer
|
||||
# From https://android.googlesource.com/\
|
||||
# platform/system/vold/+/refs/heads/master/cryptfs.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: apple,v 1.51 2024/09/04 19:06:12 christos Exp $
|
||||
# $File: apple,v 1.54 2026/06/02 17:32:17 christos Exp $
|
||||
# apple: file(1) magic for Apple file formats
|
||||
#
|
||||
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
|
||||
@@ -775,5 +775,31 @@
|
||||
>>>0x1ec beshort 0xffd8 (JPEG)
|
||||
|
||||
# MacPaint image
|
||||
65 string PNTGMPNT MacPaint image data
|
||||
#0 belong 2 MacPaint image data
|
||||
65 string PNTGMPNT MacPaint image data, MacBinary-wrapped
|
||||
!:mime image/x-macpaint
|
||||
!:ext mac/macp/pntg
|
||||
0 belong 0x00000002
|
||||
>4 belong 0xFFFFFFFF MacPaint image data, version 2
|
||||
!:mime image/x-macpaint
|
||||
!:ext mac/macp/pntg
|
||||
0 belong 0x00000003
|
||||
>4 belong 0xFFFFFFFF MacPaint image data, version 3
|
||||
!:mime image/x-macpaint
|
||||
!:ext mac/macp/pntg
|
||||
|
||||
# Apple Sparse Disk Image
|
||||
# Located at the start of the file
|
||||
0 string sprs Apple Sparse Disk Image
|
||||
>4 belong >0 \b, version %d
|
||||
>8 belong &0x01 \b, growable
|
||||
>8 belong &0x02 \b, layout-fixed
|
||||
>8 belong &0x04 \b, encrypted
|
||||
>8 belong &0x08 \b, kernel-managed
|
||||
>8 belong >0 \b, (flags %#x)
|
||||
>12 belong >0 \b, block size: %d
|
||||
>24 bequad >0 \b, capacity: %lld bytes
|
||||
|
||||
# DMG image
|
||||
-512 string koly
|
||||
>-504 belong 512 Apple DMG
|
||||
>>-508 belong x \b, version %d
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: archive,v 1.218 2026/01/10 16:16:27 christos Exp $
|
||||
# $File: archive,v 1.223 2026/05/10 01:23:57 christos Exp $
|
||||
# archive: file(1) magic for archive formats (see also "msdos" for self-
|
||||
# extracting compressed archives)
|
||||
#
|
||||
@@ -2570,6 +2570,30 @@
|
||||
12 string BB02 Bacula volume
|
||||
>20 bedate x \b, started %s
|
||||
|
||||
# Bareos volume format.
|
||||
# URL:
|
||||
# https://docs.bareos.org/DeveloperGuide/mediaformat.html#volume-label-format
|
||||
# From: Bruno Fiedmann <[email protected]>
|
||||
# Note: label_btime (local time) is stored as 8-byte big-endian microseconds;
|
||||
# must divide by 1000000 for Unix seconds
|
||||
# Note: MediaType detected using search; ProgVersion start at 142
|
||||
# (typically after LabelProg field)
|
||||
# Note: ProgVersion start at 142, but we want to remove 'Ver. ' anyways
|
||||
12 string BB02 Bareos Volume
|
||||
>36 string Bareos 2.0 immortal
|
||||
>93 string x \b, Volume Name: %s
|
||||
>100 search/100 File\0 \b, Media Type: File
|
||||
>100 search/100 Tape\0 \b, Media Type: Tape
|
||||
>100 search/100 VTape\0 \b, Media Type: VTape
|
||||
>100 search/100 Fifo\0 \b, Media Type: Fifo
|
||||
>61 beqldate/1000000 x \b, Label Date: %s
|
||||
>147 string x \b, Version: %s
|
||||
|
||||
# Bareos Disaster Recovery Image
|
||||
# URL: https://doc.bareos.org/
|
||||
# From: Bruno Friedmann <[email protected]>
|
||||
0 string barrifil Bareos Disaster Recovery Image
|
||||
|
||||
# ePub is XHTML + XML inside a ZIP archive. The first member of the
|
||||
# archive must be an uncompressed file called 'mimetype' with contents
|
||||
# 'application/epub+zip'
|
||||
@@ -2879,3 +2903,25 @@
|
||||
|
||||
0 string \xd2\x4e\x4a\x19\xc2\x68\x4c\x83\x10 Proxmox File Archive Format payload stream / ppxar
|
||||
|
||||
|
||||
# ZIM (Zeno IMproved) file - Archive format used by Kiwix for offline browsing
|
||||
# Reference: https://wiki.openzim.org/wiki/ZIM_file_format
|
||||
0 ulelong 0x044D495A ZIM archive data
|
||||
!:mime application/x-zim
|
||||
!:ext zim
|
||||
>4 uleshort x \b, version %u
|
||||
>6 uleshort x \b.%u
|
||||
>8 beguid x \b, UUID %s
|
||||
>24 ulelong x \b, %u entries
|
||||
>28 ulelong x \b, %u clusters
|
||||
|
||||
# FAR Archive magic
|
||||
#
|
||||
# The Fuchsia archive format (FAR) is a specific container format used by the
|
||||
# Fuchsia operating system to store directory trees, typically for software packages.
|
||||
#
|
||||
# https://fuchsia.dev/fuchsia-src/development/source_code/archive_format
|
||||
#
|
||||
# From <[email protected]> "Yuvraj Saxena"
|
||||
#
|
||||
0 ubequad 0xc8bf0b48adabc511 Fuchsia OS FAR Archive
|
||||
@@ -0,0 +1,233 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: atari,v 1.2 2026/04/30 18:40:15 christos Exp $
|
||||
# atari: file(1) magic for Atari formats:
|
||||
|
||||
# Operating system ROMs for the Atari ST series of computers, including a
|
||||
# GPLv2+ implementation called EmuTOS.
|
||||
# Teemu Hukkanen <[email protected]>
|
||||
#
|
||||
# OSHEADER https://freemint.github.io/tos.hyp/en/OSHEADER.html
|
||||
# The first byte is a bra.s instruction, an unconditional short jump
|
||||
0 byte 0x60
|
||||
# The second byte is the offset for the jump target address,
|
||||
# jumping past the OS header
|
||||
# TOS 1.00 uses 0x1E
|
||||
>0x01 byte 0x1E
|
||||
>>0 use atari-tos-rom
|
||||
# TOS >1.00 and EmuTOS uses 0x2E
|
||||
>0x01 byte 0x2E
|
||||
>>0 use atari-tos-rom
|
||||
|
||||
# EmuTOS for Amiga
|
||||
0 beshort 0x1111
|
||||
>0x02 beshort 0x4EF9
|
||||
>>0xD2 beshort 0x602E
|
||||
>>>0xD2 use atari-tos-versions
|
||||
|
||||
0 name atari-tos-versions
|
||||
# Enumerate all known versions
|
||||
>0x02 beshort 0x0100 Atari TOS ROM 1.00
|
||||
>>0 use atari-tos-rom
|
||||
# EmuTOS uses 1.04 for 192kB ROMs, and 2.06 for >=256kB ROMs
|
||||
>0x02 beshort 0x0102 Atari TOS ROM 1.02
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0104 Atari TOS ROM 1.04
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0106 Atari TOS ROM 1.06
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0162 Atari TOS ROM 1.62
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0205 Atari TOS ROM 2.05
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0206
|
||||
# ST-Book TOS 2.08 header says 2.06, identify it by release date
|
||||
>>0x18 belong 0x03101992 Atari TOS ROM 2.08
|
||||
>>>0 use atari-tos-rom
|
||||
>>0x18 belong !0x03101992 Atari TOS ROM 2.06
|
||||
>>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0207 Atari TOS ROM 2.07
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0208 Atari TOS ROM 2.08
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0300 Atari TOS ROM 3.00
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0301 Atari TOS ROM 3.01
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0305 Atari TOS ROM 3.05
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0306 Atari TOS ROM 3.06
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0400 Atari TOS ROM 4.00
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0401 Atari TOS ROM 4.01
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0402 Atari TOS ROM 4.02
|
||||
>>0 use atari-tos-rom
|
||||
>0x02 beshort 0x0404 Atari TOS ROM 4.04
|
||||
>>0 use atari-tos-rom
|
||||
|
||||
0 name atari-tos-rom
|
||||
# Release date, display using ISO 8601 date
|
||||
# Year
|
||||
>0x1A beshort x %.4x
|
||||
# Month
|
||||
>0x18 byte x \b-%.2x
|
||||
# Day
|
||||
>0x19 byte x \b-%.2x
|
||||
# os_conf: Video sync mode and language/country
|
||||
#>0x1C beshort x (os_conf: %u)
|
||||
# Video mode is not relevant for multilingual variants
|
||||
>0x1C beshort !255
|
||||
>>0x1C beshort ^1 Video: NTSC
|
||||
>>0x1C beshort &1 Video: PAL
|
||||
# Language / Country
|
||||
# https://github.com/emutos/emutos/blob/master/include/ctrycodes.h
|
||||
# TOS uses a country to indicate locale, use IETF language tags instead.
|
||||
>0x1C beshort x Locale:
|
||||
>0x1C beshort 0 en-US
|
||||
# PAL 1.04 and 1.06 TEX variants
|
||||
>0x1C beshort 1
|
||||
>>0x2A85C string AUSWAHL: de-DE
|
||||
# NTSC with de-DE
|
||||
>0x1C beshort 2
|
||||
# NTSC Kaos TOS de-CH
|
||||
>>0x26806 string Auswahl: de-CH
|
||||
# NTSC Kaos TOS en-GB
|
||||
>>0x26806 string Select: en-GB
|
||||
# NTSC 1.06 TEX variant
|
||||
>>0x2A4FC string AUSWAHL: de-DE
|
||||
# NTSC 2.06 TEX variant
|
||||
>>0x32C3E string AUSWAHL: de-DE
|
||||
# PAL de-DE
|
||||
# Several translations are based on de-DE, detect all known variants.
|
||||
>0x1C beshort 3
|
||||
# 1.00 de-DE
|
||||
>>0x15097 string AUSWAHL de-DE
|
||||
# 1.00 fi-FI
|
||||
>>0x15092 string VALINTA fi-FI
|
||||
# 1.00 dk-DK
|
||||
>>0x15090 string FIL\ V dk-DK
|
||||
# 1.02 de-DE
|
||||
>>0x16691 string AUSWAHL de-DE
|
||||
# 1.04 de-DE
|
||||
>>0x2BAE2 string AUSWAHL: de-DE
|
||||
# 1.04 cs-CZ
|
||||
>>0x2BAE4 string Soubor: cs-CZ
|
||||
# 1.04 de-DE
|
||||
>>0x2BAEC string AUSWAHL: de-DE
|
||||
# 1.06 de-DE
|
||||
>>0x2DA56 string AUSWAHL: de-DE
|
||||
# 1.62 de-DE
|
||||
>>0x2DB4A string AUSWAHL: de-DE
|
||||
# 1.62 cs-CZ
|
||||
>>0x2DB4C string Soubor: cs-CZ
|
||||
# 2.05 is-IS
|
||||
>>0x34E80 string Drif: is-IS
|
||||
# 2.05 de-DE
|
||||
>>0x34E5A string AUSWAHL: de-DE
|
||||
# 2.06 de-DE
|
||||
>>0x36B68 string AUSWAHL: de-DE
|
||||
# 2.06 cs-CZ
|
||||
>>0x36B68 string Soubor: cs-CZ
|
||||
# 2.06 sr-Latn
|
||||
>>0x36B68 string IZBOR: sr-Latn
|
||||
# 2.06 sr-Cyrl
|
||||
>>0x36B68 belong 0xC8C7C1CE sr-Cyrl
|
||||
# 2.08 de-DE
|
||||
>>0x36B18 string AUSWAHL: de-DE
|
||||
# 3.01 de-DE
|
||||
>>0x395F0 string AUSWAHL: de-DE
|
||||
# 3.06 de-DE
|
||||
>>0x3EDD2 string AUSWAHL: de-DE
|
||||
# EmuTOS uses the de-DE language code correctly
|
||||
>>0x2C string ETOS de-DE
|
||||
>0x1C beshort 5 fr-FR
|
||||
>0x1C beshort 7 en-GB
|
||||
>0x1C beshort 9 es-ES
|
||||
>0x1C beshort 11 it-IT
|
||||
# PAL sv-SE
|
||||
>0x1C beshort 13
|
||||
# 1.02 sv-SE
|
||||
>>0x1979F string PAPPERSKORG sv-SE
|
||||
# 1.04 sv-SE
|
||||
>>0x2FC9F string PAPPERSKORG sv-SE
|
||||
# 1.04 no-NO
|
||||
>>0x2FCA0 string Papirkurv no-NO
|
||||
# 1.06 sv-SE
|
||||
>>0x31C13 string PAPPERSKORG sv-SE
|
||||
# 1.62 sv-SE
|
||||
>>0x31D07 string PAPPERSKORG sv-SE
|
||||
# 2.05 sv-SE
|
||||
>>0x3C309 string PAPPERSKORG sv-SE
|
||||
# 2.06 sv-SE
|
||||
>>0x3E00D string PAPPERSKORG sv-SE
|
||||
# 3.06 sv-SE
|
||||
>>0x46277 string PAPPERSKORG sv-SE
|
||||
# EmuTOS uses the sv-SE language code correctly
|
||||
>>0x2C string ETOS sv-SE
|
||||
# 2.06 NTSC ru-RU (2004)
|
||||
>0x1C beshort 14 ru-RU
|
||||
>0x1C beshort 15 fr-CH
|
||||
# Kaos TOS NTSC de-CH
|
||||
>0x1C beshort 16 de-CH
|
||||
>0x1C beshort 17 de-CH
|
||||
>0x1C beshort 19 tr-TR
|
||||
>0x1C beshort 21 fi-FI
|
||||
>0x1C beshort 23 no-NO
|
||||
>0x1C beshort 25 dk-DK
|
||||
# Dutch TOS 1.04 (1989-04-06) uses Saudi-Arabia as country code.
|
||||
>0x1C beshort 27
|
||||
>>0x2BAB0 string Selectie: nl-NL
|
||||
>0x1C beshort 29 nl-NL
|
||||
>0x1C beshort 31 cs-CZ
|
||||
>0x1C beshort 33 hu-HU
|
||||
>0x1C beshort 35 pl-PL
|
||||
>0x1C beshort 39 ru-RU
|
||||
>0x1C beshort 49 ro-RO
|
||||
>0x1C beshort 63 el-GR
|
||||
>0x1C beshort 109 cat
|
||||
# Multilingual TOS, either TOS 4.x, or 1024kB EmuTOS, which contain multiple
|
||||
# languages, and select the language and video mode based on settings in
|
||||
# NVRAM.
|
||||
>0x1C beshort 255 Multilingual
|
||||
# Kaos TOS, a modified version of TOS 1.04
|
||||
>0x5FFC string KAOS Kaos TOS
|
||||
>0x2CDB0 string 1.4.3 Kaos TOS 1.4.3
|
||||
# EmuTOS
|
||||
>0x2C string ETOS EmuTOS
|
||||
# Extended OS header, EmuTOS >= 1.0.0
|
||||
# https://github.com/emutos/emutos/blob/master/doc/version.txt
|
||||
>0x34 string OSXH
|
||||
# Length of extended OS header
|
||||
>>0x38 belong 25
|
||||
# Major version
|
||||
>>>0x3C byte x v%d
|
||||
# Minor version
|
||||
>>>0x3D byte x \b.%d
|
||||
# Fix version
|
||||
>>>0x3E byte x \b.%d
|
||||
# Zero means official release, Non-zero means snapshot
|
||||
>>>0x3F byte !0 Snapshot
|
||||
# Display version string for snapshots
|
||||
>>>>(0x40.L) string x (%s)
|
||||
>>>0x48 beshort x Machine:
|
||||
>>>0x48 beshort &1 ST
|
||||
>>>0x48 beshort &2 STe
|
||||
>>>0x48 beshort &4 TT
|
||||
>>>0x48 beshort &8 Falcon
|
||||
>>>0x48 beshort &16 FireBee
|
||||
>>>0x48 beshort &32 M548X
|
||||
>>>0x48 beshort &64 Amiga
|
||||
>>>0x48 beshort &256 ARAnyM
|
||||
>>>0x4A beshort x CPU:
|
||||
>>>0x4A beshort &1 68000
|
||||
>>>0x4A beshort &2 68010
|
||||
>>>0x4A beshort &4 68020
|
||||
>>>0x4A beshort &8 68030
|
||||
>>>0x4A beshort &16 68040
|
||||
>>>0x4A beshort &32 68060
|
||||
>>>0x4A beshort &64 68080
|
||||
>>>0x4A beshort &256 ColdFire-V4e
|
||||
# Adjustable cold boot delay in seconds when > 0.
|
||||
>>>0x4C byte >0 Boot-Delay: %is
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: c-lang,v 1.38 2025/05/30 13:36:08 christos Exp $
|
||||
# $File: c-lang,v 1.39 2026/04/16 18:17:04 christos Exp $
|
||||
# c-lang: file(1) magic for C and related languages programs
|
||||
#
|
||||
# The strength is to beat standard HTML
|
||||
@@ -79,15 +79,15 @@
|
||||
!:strength + 13
|
||||
!:mime text/x-c++
|
||||
0 search/8192 public
|
||||
>0 regex \^[[:space:]]*public: C++ source text
|
||||
>0 regex \^[[:space:]]*public:[[:space:]]*$ C++ source text
|
||||
!:strength + 45
|
||||
!:mime text/x-c++
|
||||
0 search/8192 private
|
||||
>0 regex \^[[:space:]]*private: C++ source text
|
||||
>0 regex \^[[:space:]]*private:[[:space:]]*$ C++ source text
|
||||
!:strength + 45
|
||||
!:mime text/x-c++
|
||||
0 search/8192 protected
|
||||
>0 regex \^[[:space:]]*protected: C++ source text
|
||||
>0 regex \^[[:space:]]*protected:[[:space:]]*$ C++ source text
|
||||
!:strength + 45
|
||||
!:mime text/x-c++
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: cad,v 1.31 2022/12/09 15:36:23 christos Exp $
|
||||
# $File: cad,v 1.32 2026/04/16 15:06:17 christos Exp $
|
||||
# autocad: file(1) magic for cad files
|
||||
#
|
||||
|
||||
@@ -435,3 +435,15 @@
|
||||
>20 search/1000/w \<amf AMF (Additive Manufacturing Format) model, XML document
|
||||
!:mime application/x-amf
|
||||
!:ext amf
|
||||
|
||||
# AutoCAD Slide
|
||||
# Screen captures created by MSLIDE, viewed with VSLIDE
|
||||
# Spec: http://www.martinreddy.net/gfx/2d/SLD.txt
|
||||
# PRONOM: x-fmt/105
|
||||
|
||||
0 string AutoCAD\ Slide\r\n\x1a\0 AutoCAD Slide,
|
||||
!:mime image/x-sld
|
||||
!:ext sld
|
||||
>17 byte 0x56 version 2
|
||||
>29 leshort 0x1234 \b, little-endian
|
||||
>29 beshort 0x1234 \b, big-endian
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: coff,v 1.15 2024/11/10 18:54:33 christos Exp $
|
||||
# $File: coff,v 1.16 2026/04/20 14:53:18 christos Exp $
|
||||
# coff: file(1) magic for Common Object Files not specific to known cpu types or manufactures
|
||||
#
|
||||
# COFF
|
||||
@@ -68,7 +68,8 @@
|
||||
>0 uleshort 0xa64e ARM64 (classic + x86-64 ABI)
|
||||
# PE/COFF ARM64 classic ABI, ARM COFF (./arm)
|
||||
>0 uleshort 0xaa64 ARM64
|
||||
>0 uleshort 0xace1 OMNI VM (omniprox.dll)
|
||||
# Processor type OMNI is for OMNI VM, for example used by omniprox.dll and can be created by MSVC6.0 CVTRES.EXE with /MACHINE:OMNI flag
|
||||
>0 uleshort 0xace1 OMNI VM
|
||||
# Processor type CEE can be only in object files (created by older ilasm.exe with /OBJECT flag), not in PE executables
|
||||
>0 uleshort 0xc0ee COM+ Execution Engine
|
||||
>0 default x Unknown processor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: compress,v 1.96 2024/11/09 23:47:04 christos Exp $
|
||||
# $File: compress,v 1.99 2026/04/17 12:52:29 christos Exp $
|
||||
# compress: file(1) magic for pure-compression formats (no archives)
|
||||
#
|
||||
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
||||
@@ -443,6 +443,15 @@
|
||||
0 string/b BZ3v1 bzip3 compressed data
|
||||
>5 ulelong x \b, blocksize %u
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# ZXC: ZXC compressed data
|
||||
# From: Bertrand Lebonnois <[email protected]>
|
||||
# https://github.com/hellobertrand/zxc
|
||||
0 lelong 0x9CB02EF5 ZXC compressed data
|
||||
!:mime application/x-zxc
|
||||
!:ext zxc
|
||||
>4 byte x \b (v%u)
|
||||
>6 byte &0x80 \b, checksum enabled
|
||||
|
||||
# https://support-docs.illumina.com/SW/ORA_Format_Specification/Content/\
|
||||
# SW/ORA/ORAFormatSpecification.htm
|
||||
@@ -456,3 +465,24 @@
|
||||
# https://github.com/xamarin/xamarin-android/pull/4686
|
||||
0 string XALZ Xamarin LZ4-compressed assembly
|
||||
>8 ulelong x \b, uncompressed size %u
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Kanzi: Kanzi compressed data
|
||||
# From: Frederic Langlet <[email protected]>
|
||||
# https://github.com/flanglet/kanzi-cpp/wiki/Bitstream-Format
|
||||
0 belong 0x4B414E5A kanzi compressed data
|
||||
!:mime application/x-knz
|
||||
!:ext knz
|
||||
>4 byte/16 x \b, version %u
|
||||
|
||||
# Branch for Version > 5 (Uses Bits 3 and 2 for checksum)
|
||||
>4 byte/16 >5
|
||||
>>4 byte&0x0C 0x04 \b, 32-bit checksum
|
||||
>>4 byte&0x0C 0x08 \b, 64-bit checksum
|
||||
|
||||
# DTSZ (Data Transformer Standard Zip)
|
||||
# Maintainer: Arie Abraham Benichou
|
||||
0 belong&0xFFFF8000 0x020208000 DTSZ compressed data
|
||||
>2 byte&0x7F x \b, version %d
|
||||
!:mime application/x-dtsz
|
||||
!:ext dtsz
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: console,v 1.81 2026/01/31 15:44:17 christos Exp $
|
||||
# $File: console,v 1.82 2026/06/02 16:59:22 christos Exp $
|
||||
# Console game magic
|
||||
# Toby Deshane <[email protected]>
|
||||
|
||||
@@ -1466,3 +1466,8 @@
|
||||
0 uleshort 0x0258 P/ECE executable
|
||||
>(0x04.s) string x \b: "%s"
|
||||
!:ext pex
|
||||
|
||||
# Mii character data (Wii/3DS)
|
||||
0 string RNCD Mii character data
|
||||
# Mii database (Wii)
|
||||
0 string RNOD Mii database entry
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: dyadic,v 1.9 2019/04/19 00:42:27 christos Exp $
|
||||
# $File: dyadic,v 1.10 2026/05/09 20:08:12 christos Exp $
|
||||
# Dyadic: file(1) magic for Dyalog APL.
|
||||
#
|
||||
# updated by Joerg Jenderek at Oct 2013
|
||||
@@ -51,6 +51,7 @@
|
||||
>>>1 byte 0x17 DFS component file 64-bit level 2 journaled checksummed
|
||||
>>>1 byte 0x18 DFS component file 64-bit level 3 journaled checksummed
|
||||
>>>1 byte 0x19 external workspace
|
||||
>>>1 byte 0x1a session layout file
|
||||
>>>1 byte 0x80 DDB
|
||||
>>>2 byte x version %d
|
||||
>>>3 byte x \b.%d
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: filesystems,v 1.169 2025/12/27 15:29:44 christos Exp $
|
||||
# $File: filesystems,v 1.171 2026/05/17 17:30:59 christos Exp $
|
||||
# filesystems: file(1) magic for different filesystems
|
||||
#
|
||||
0 name partid
|
||||
@@ -261,18 +261,6 @@
|
||||
# for sector sizes with 512 or more Bytes
|
||||
>0x1FE leshort 0xAA55 DOS/MBR boot sector
|
||||
|
||||
# ExFAT
|
||||
3 string/w =EXFAT
|
||||
>0x1FE leshort 0xAA55
|
||||
>>0x6E ubyte 1
|
||||
>>>0x6F ubyte 0x80
|
||||
>>>0 ubyte 0xEB DOS/MBR boot sector,
|
||||
>>>0x69 ubyte x ExFAT Filesystem version %d.
|
||||
>>>0x68 ubyte x \b%d
|
||||
>>>0x6d ubyte x \b, (1<<%d) sectors per cluster
|
||||
>>>0x48 ulequad x \b, sectors %lld
|
||||
>>>0x64 ulelong x \b, serial number %#x
|
||||
|
||||
# keep old DOS/MBR boot sector as dummy for mbr and bootloader displaying
|
||||
# only for sector sizes with 512 or more Bytes
|
||||
0x1FE leshort 0xAA55 DOS/MBR boot sector
|
||||
@@ -1058,6 +1046,20 @@
|
||||
>>>>>>>466 ubyte 0x0F \b, extended partition table (LBA)
|
||||
>>>>>>>466 ubyte 0x0 \b, extended partition table (last)
|
||||
|
||||
# exFAT
|
||||
# x86 real mode relative jump followed by string "EXFAT "
|
||||
>0 string \xEB\x76\x90EXFAT\ \ \ \b, ExFAT Filesystem
|
||||
>>0x6E ubyte <3 \b, numer of FATs %d
|
||||
>>>0x69 ubyte x \b, revision %d.
|
||||
>>>0x68 ubyte x \b%d
|
||||
>>>0x6C ubyte x \b, (1<<%d) bytes per sector
|
||||
>>>0x6D ubyte x \b, (1<<%d) sectors per cluster
|
||||
>>>0x48 ulequad x \b, sectors %lld
|
||||
>>>0x64 ulelong x \b, serial number %#x
|
||||
# MS Windows compat, SD association SDXC spec part 2
|
||||
>>>0x1B8 ulelong >0 \b, with MBR disk signature %#-.4x
|
||||
>>>>0x1C6 ulelong 0 \b, recursive partition
|
||||
|
||||
# DOS x86 sector separated and moved from "DOS/MBR boot sector" by Joerg Jenderek at May 2011
|
||||
|
||||
>0x200 lelong 0x82564557 \b, BSD disklabel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: finger,v 1.3 2019/04/19 00:42:27 christos Exp $
|
||||
# $File: finger,v 1.4 2026/04/17 15:22:11 christos Exp $
|
||||
# fingerprint: file(1) magic for fingerprint data
|
||||
# XPM bitmaps)
|
||||
#
|
||||
@@ -14,3 +14,8 @@
|
||||
0 string FP2 libfprint fingerprint data V2
|
||||
>3 beshort x \b, driver_id %x
|
||||
>5 belong x \b, devtype %x
|
||||
|
||||
# http://justsolve.archiveteam.org/wiki/Audfprint_fingerprint_file
|
||||
0 string audfprinthash Audfprint fingerprint data
|
||||
0 string audfprintpeak Audfprint fingerprint data
|
||||
!:ext afpt/afpk
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: fonts,v 1.54 2025/02/10 22:01:36 rrt Exp $
|
||||
# $File: fonts,v 1.55 2026/03/24 22:28:58 christos Exp $
|
||||
# fonts: file(1) magic for font data
|
||||
#
|
||||
0 search/1 FONT ASCII vfont text
|
||||
@@ -266,7 +266,7 @@
|
||||
>0 use sfnt-names
|
||||
# GRR: below test is too general
|
||||
# sfnt version often 0x00010000
|
||||
0 string \000\001\000\000
|
||||
0 string \000\001\000\000
|
||||
>0 use sfnt-font
|
||||
>0 use sfnt-names
|
||||
# validate and display sfnt font data like number of tables
|
||||
@@ -280,16 +280,18 @@
|
||||
# skip bad examples with garbage table names like in a5.show HYPERC MAC
|
||||
# tag names consist of up to four characters padded with spaces at end like
|
||||
# BASE C2PA DSIG OS/2 Zapf acnt glyf cvt vmtx xref ...
|
||||
>>12 regex/4l \^[A-Za-z][A-Za-z2][A-Za-z/][A-Za-z2\ ]
|
||||
#>>>0 ubelong x \b, sfnt version %#x
|
||||
>>>0 ubelong !0x4f54544f TrueType
|
||||
>>12 regex/4l \^[A-Za-z][A-Za-z2][A-Za-z/\ ][A-Za-z2\ ]
|
||||
#>>>0 ubelong x \b, sfnt version %#x
|
||||
>>>0 ubelong !0x4f54544f TrueType
|
||||
# fontkit FK
|
||||
>>>>12 ubelong 0x464b2020 (FontKit)
|
||||
!:mime font/ttf
|
||||
!:apple ????tfil
|
||||
# .ttf for TrueType font
|
||||
# EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
|
||||
!:ext ttf/tte
|
||||
# sfnt version 4F54544Fh~OTTO
|
||||
>>>0 ubelong =0x4f54544f OpenType
|
||||
>>>0 ubelong =0x4f54544f OpenType
|
||||
!:mime font/otf
|
||||
!:apple ????OTTO
|
||||
!:ext otf
|
||||
@@ -302,7 +304,8 @@
|
||||
#>>>4 ubeshort <10 TMIN
|
||||
#>>>4 ubeshort >24 TBIG
|
||||
# table directory entries
|
||||
>>>12 string x \b, 1st "%4.4s"
|
||||
>>>12 ubelong !0x464b2020 (FontKit)
|
||||
>>>>12 string x \b, 1st "%4.4s"
|
||||
|
||||
# search and display 1st name in sfnt font which is often copyright text
|
||||
# does not work inside font collections
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: games,v 1.38 2025/05/31 15:42:06 christos Exp $
|
||||
# $File: games,v 1.40 2026/04/16 20:25:40 christos Exp $
|
||||
# games: file(1) for games
|
||||
|
||||
# Fabio Bonelli <[email protected]>
|
||||
@@ -245,14 +245,14 @@
|
||||
# Type: SGF Smart Game Format
|
||||
# URL: https://www.red-bean.com/sgf/
|
||||
# From: Eduardo Sabbatella <[email protected]>
|
||||
2 regex \\(;.*GM\\[[0-9]{1,2}\\] Smart Game Format
|
||||
>2 regex GM\\[1\\] - Go Game
|
||||
>2 regex GM\\[6\\] - BackGammon Game
|
||||
>2 regex GM\\[11\\] - Hex Game
|
||||
>2 regex GM\\[18\\] - Amazons Game
|
||||
>2 regex GM\\[19\\] - Octi Game
|
||||
>2 regex GM\\[20\\] - Gess Game
|
||||
>2 regex GM\\[21\\] - twix Game
|
||||
2 regex/c \\(;.*GM\\[[0-9]{1,2}\\] Smart Game Format
|
||||
>2 regex/c GM\\[1\\] - Go Game
|
||||
>2 regex/c GM\\[6\\] - BackGammon Game
|
||||
>2 regex/c GM\\[11\\] - Hex Game
|
||||
>2 regex/c GM\\[18\\] - Amazons Game
|
||||
>2 regex/c GM\\[19\\] - Octi Game
|
||||
>2 regex/c GM\\[20\\] - Gess Game
|
||||
>2 regex/c GM\\[21\\] - twix Game
|
||||
|
||||
# Epic Games/Unreal Engine Package
|
||||
# URL: https://docs.unrealengine.com/udk/Three/ContentCooking.html
|
||||
@@ -436,7 +436,7 @@
|
||||
0 uleshort 0x0469 GTA2 binary mission script (SCR), Industrial area (bil)
|
||||
|
||||
0 string v9.6\0\0 GTA2 replay file (REP),
|
||||
>8 regex/30 [a-z0-9:\ ]+\0\0 created on %s
|
||||
>8 regex/30c [a-z0-9:\ ]+\0\0 created on %s
|
||||
|
||||
# GTA 3D-Era (III/VC/SA/LCS/VCS) - used by the RenderWare engine by Criterion Games
|
||||
|
||||
@@ -708,3 +708,28 @@
|
||||
>>14 uledate =0 \b, unknown creation date
|
||||
>>14 uledate !0 \b, created: %s
|
||||
>6 uleshort <1 \b, unknown creation date
|
||||
|
||||
|
||||
# osu! replay file
|
||||
# https://osu.ppy.sh/wiki/en/Client/File_formats/osr_%28file_format%29
|
||||
# Weak magic
|
||||
#1 lelong >20070000
|
||||
## osu lazer, why 90 C3 C9 01?
|
||||
#>1 lelong <30000017
|
||||
#>>0 byte <4
|
||||
#>>>5 byte 0x0b
|
||||
#>>>>0 byte 0 osu! standard
|
||||
#>>>>0 byte 1 osu! taiko
|
||||
#>>>>0 byte 2 osu! catch
|
||||
#>>>>0 byte 3 osu! mania
|
||||
#>>>>1 lelong x \b replay, version %u
|
||||
#!:ext osr
|
||||
#!:mime application/x-osu-replay
|
||||
|
||||
# osu! beatmap file
|
||||
# https://osu.ppy.sh/wiki/en/Client/File_formats/osu_%28file_format%29
|
||||
|
||||
0 string osu\040file\040format\040v osu! beatmap file
|
||||
>17 string x \b, version %s
|
||||
!:ext osu
|
||||
!:mime application/x-osu-beatmap
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: images,v 1.267 2025/11/24 14:22:31 christos Exp $
|
||||
# $File: images,v 1.276 2026/06/02 17:44:28 christos Exp $
|
||||
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
||||
# XPM bitmaps)
|
||||
#
|
||||
@@ -490,6 +490,7 @@
|
||||
#
|
||||
|
||||
# IHDR parser
|
||||
# https://www.w3.org/TR/png-3/#11IHDR
|
||||
0 name png-ihdr
|
||||
>0 ubelong x \b, %d x
|
||||
>4 ubelong x %d,
|
||||
@@ -499,29 +500,49 @@
|
||||
>9 ubyte 3 colormap,
|
||||
>9 ubyte 4 gray+alpha,
|
||||
>9 ubyte 6 \b/color RGBA,
|
||||
>9 default x invalid color type,
|
||||
#>10 ubyte 0 deflate/32K,
|
||||
>10 ubyte !0 invalid compression,
|
||||
#>11 ubyte 0 adaptive,
|
||||
>11 ubyte !0 invalid filter method,
|
||||
>12 ubyte 0 non-interlaced
|
||||
>12 ubyte 1 interlaced
|
||||
>12 ubyte >1 invalid interlace method
|
||||
|
||||
# APNG acTL parser
|
||||
# https://www.w3.org/TR/png-3/#acTL-chunk
|
||||
0 name apng-actl
|
||||
>0 ubelong 1 \b, %d frame
|
||||
>0 ubelong >1 \b, %d frames
|
||||
>4 ubelong 0 \b, play indefinitely
|
||||
>4 ubelong 1 \b, %d play
|
||||
>4 ubelong >1 \b, %d plays
|
||||
|
||||
# PNG image.
|
||||
0 string \x89PNG\x0d\x0a\x1a\x0a
|
||||
!:strength +10
|
||||
>8 clear x
|
||||
|
||||
# Mozilla APNG image.
|
||||
>33 search/16384 \x00\x00\x00\x08acTL Animated PNG image data
|
||||
!:mime image/apng
|
||||
!:ext apng/png
|
||||
>>8 string \x00\x00\x00\x0DIHDR
|
||||
>>>16 use png-ihdr
|
||||
>>&0 use apng-actl
|
||||
|
||||
# Standard PNG image.
|
||||
0 string \x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR PNG image data
|
||||
>8 default x
|
||||
>>8 string \x00\x00\x00\x0DIHDR PNG image data
|
||||
!:mime image/png
|
||||
!:ext png
|
||||
!:strength +10
|
||||
>16 use png-ihdr
|
||||
>33 string \x00\x00\x00\x08acTL \b, animated
|
||||
>>41 ubelong 1 (%d frame
|
||||
>>41 ubelong >1 (%d frames
|
||||
>>45 ubelong 0 \b, infinite repetitions)
|
||||
>>45 ubelong 1 \b, %d repetition)
|
||||
>>45 ubelong >1 \b, %d repetitions)
|
||||
!:ext png
|
||||
>>>16 use png-ihdr
|
||||
|
||||
# Apple CgBI PNG image.
|
||||
0 string \x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
|
||||
>8 string \x00\x00\x00\x04CgBI
|
||||
>24 string \x00\x00\x00\x0DIHDR PNG image data (CgBI)
|
||||
!:mime image/png
|
||||
!:ext png
|
||||
!:strength +10
|
||||
!:ext png
|
||||
>>32 use png-ihdr
|
||||
|
||||
# possible GIF replacements; none yet released!
|
||||
@@ -1734,10 +1755,14 @@
|
||||
>>>-0 offset =32066
|
||||
# like: spider.pi1 pinkgirl.pi1 frog3.pi1
|
||||
>>>>0 use degas-bitmap
|
||||
# about 55 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32128
|
||||
# file size 32128 is always Atari NEOchrome, not DEGAS.
|
||||
# NEOchrome files have a 128-byte header (vs DEGAS 34-byte header)
|
||||
# and are always exactly 32128 bytes (128 + 32000 pixel data).
|
||||
# DEGAS uncompressed is 32034, DEGAS Elite uncompressed is 32066.
|
||||
# URL: http://fileformats.archiveteam.org/wiki/NEOchrome
|
||||
# Reference: https://wiki.multimedia.cx/index.php?title=Neochrome
|
||||
>>>-0 offset =32128
|
||||
# like: mountain.pi1 bigspid.pi1 alf33.pi1
|
||||
>>>>0 use degas-bitmap
|
||||
>>>>0 use neochrome-bitmap
|
||||
# 1 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 44834
|
||||
>>>-0 offset =44834
|
||||
# like: kenshin.pi1
|
||||
@@ -1768,25 +1793,30 @@
|
||||
# http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
|
||||
# http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
|
||||
# http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
|
||||
# Note: GEM v1 checks must be a separate top-level entry from DEGAS mid-res
|
||||
# above, because the >>-0 offset (end-of-file) tests for DEGAS file sizes
|
||||
# corrupt the offset context for sibling > checks at level 1.
|
||||
# header_size
|
||||
>2 beshort 0x0008
|
||||
>>0 use gem_info
|
||||
>2 beshort 0x0009
|
||||
>>0 use gem_info
|
||||
# no example for NOSIG
|
||||
>2 beshort 24
|
||||
>>0 use gem_info
|
||||
# no example for HYPERPAINT
|
||||
>2 beshort 25
|
||||
>>0 use gem_info
|
||||
16 string XIMG\0
|
||||
>0 use gem_info
|
||||
# no example
|
||||
# commented out, dup warning should be fixed differently
|
||||
#0 beshort 0x0001
|
||||
#>2 beshort 0x0008
|
||||
#>>0 use gem_info
|
||||
#>2 beshort 0x0009
|
||||
#>>0 use gem_info
|
||||
## no example for NOSIG
|
||||
#>2 beshort 24
|
||||
#>>0 use gem_info
|
||||
## no example for HYPERPAINT
|
||||
#>2 beshort 25
|
||||
#>>0 use gem_info
|
||||
#16 string XIMG\0
|
||||
#>0 use gem_info
|
||||
## no example
|
||||
16 string STTT\0\x10
|
||||
>0 use gem_info
|
||||
# no example or description
|
||||
16 string TIMG\0
|
||||
>0 use gem_info
|
||||
#>0 use gem_info
|
||||
## no example or description
|
||||
#16 string TIMG\0
|
||||
#>0 use gem_info
|
||||
|
||||
# DEGAS high-res uncompressed bitmap *.pi3
|
||||
0 beshort 0x0002
|
||||
@@ -1841,6 +1871,13 @@
|
||||
# skip some (36/212) Python Pickle (factor_cache.pickle environment.pickle) with invalid 1st atari color entry (2863 6363 7d71)
|
||||
>2 ubeshort&0xF000 0
|
||||
>>0 use degas-bitmap
|
||||
# display information of Atari NEOchrome bitmap images
|
||||
# NEOchrome files are always 32128 bytes (128-byte header + 32000 pixel data)
|
||||
# and always 320x200 at 16 colours (low-res only)
|
||||
0 name neochrome-bitmap
|
||||
>0 ubyte x Atari NEOchrome bitmap 320 x 200 x 16
|
||||
!:mime image/x-neo
|
||||
!:ext neo
|
||||
# display information of Atari DEGAS and DEGAS Elite bitmap images
|
||||
0 name degas-bitmap
|
||||
>0 ubyte x Atari DEGAS
|
||||
@@ -4625,3 +4662,58 @@
|
||||
>>>>>28 byte 3 \b, YCbCr RGB
|
||||
# wavelet levels
|
||||
>>>>>29 ubyte x \b, %u wavelet levels
|
||||
|
||||
# Usenix FaceSaver - grayscale face image format
|
||||
# Created by Metron Computerware Ltd., used at USENIX conferences from 1987.
|
||||
# ASCII format: header lines (FirstName:, LastName:, PicData:, Image:, etc.)
|
||||
# followed by hex-encoded pixel data.
|
||||
# Spec: https://www.fileformat.info/format/facesaver/egff.htm
|
||||
# Netpbm: fstopgm, pgmtofs
|
||||
|
||||
0 string FirstName: Usenix FaceSaver image data
|
||||
!:mime image/x-facesaver
|
||||
!:ext face/fs
|
||||
|
||||
# CompuServe RLE (CIS) - monochrome bitmap, predecessor to GIF
|
||||
# Created by CompuServe Inc., specified October 1986 by Chris Hopkins.
|
||||
# Spec: https://www.brutman.com/RLE/RLESTND.TXT
|
||||
# ESC G H = high-res (256x192), ESC G M = medium-res (128x96)
|
||||
# Files use .rle extension (clashes with Utah RLE and others)
|
||||
|
||||
0 string \x1bGH CompuServe RLE image data, 256 x 192
|
||||
!:mime image/x-compuserve-rle
|
||||
!:ext rle/cis
|
||||
|
||||
0 string \x1bGM CompuServe RLE image data, 128 x 96
|
||||
!:mime image/x-compuserve-rle
|
||||
!:ext rle/cis
|
||||
|
||||
# Created by Russell Marks in 1997 for zgv (https://en.wikipedia.org/wiki/Zgv)
|
||||
0 string MRF1 MRF image data,
|
||||
!:mime image/x-mrf
|
||||
!:ext mrf
|
||||
>4 belong x %d x
|
||||
>8 belong x %d
|
||||
|
||||
# FIASCO - Fractal Image And Sequence Codec
|
||||
# Author: Ullrich Hafner, Univ. Würzburg (1999)
|
||||
# Source: https://github.com/l-tamas/Fiasco codec/wfa.h
|
||||
0 string FIASCO\n FIASCO fractal compressed image data
|
||||
!:ext wfa/fco
|
||||
|
||||
0 string Fiasco FIASCO basis (dictionary) file
|
||||
!:ext fco
|
||||
|
||||
0 string Jasc\040Paint\040Shop\040Pro\040Browser\040Cache\040File Jasc Paint Shop Pro Browser Cache
|
||||
>40 string %s (version %s)
|
||||
# Magic file for older Jasc Paint Shop Pro Browser Cache files (.jbf)
|
||||
0 string JASC\040BROWS\040FILE Jasc Paint Shop Pro Browser Cache (old format)
|
||||
|
||||
# SBIG CCDOPS - CCD astronomical camera image format.
|
||||
# Created by Santa Barbara Instrument Group (SBIG), 1988.
|
||||
# Header line 1 is always "ST-N Image" where N is the camera model
|
||||
# number (4, 5, 6, 7, 8, 9, 10, 237, 402, etc.)
|
||||
# Spec formerly at sbig.com. Netpbm: sbigtopgm, pgmtosbig
|
||||
0 string ST-
|
||||
>&0 regex [0-9]+\040Image SBIG CCDOPS camera image
|
||||
!:mime image/x-sbig
|
||||
@@ -1,9 +1,19 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: interleaf,v 1.10 2009/09/19 16:28:10 christos Exp $
|
||||
# $File: interleaf,v 1.11 2026/06/02 17:29:55 christos Exp $
|
||||
# interleaf: file(1) magic for InterLeaf TPS:
|
||||
#
|
||||
0 string =\210OPS Interleaf saved data
|
||||
0 string =<!OPS Interleaf document text
|
||||
>5 string ,\ Version\ = \b, version
|
||||
>>17 string >\0 %.3s
|
||||
|
||||
# Interleaf image data (ileaf img format) Used by Interleaf (later BroadVision)
|
||||
# technical publishing software.
|
||||
# Header: 0x89 "OPS" magic, BE 16-bit version, resolution, dimensions,
|
||||
# depth, compression flag, optional colormap.
|
||||
# Netpbm: leaftoppm, ppmtoleaf
|
||||
|
||||
0 string \x89OPS Interleaf image data
|
||||
!:mime image/x-interleaf
|
||||
!:ext leaf
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: ispell,v 1.10 2023/10/23 19:49:58 christos Exp $
|
||||
# $File: ispell,v 1.11 2026/04/16 18:06:17 christos Exp $
|
||||
# ispell: file(1) magic for ispell, MySpell, Hunspell and aspell
|
||||
#
|
||||
# Ispell 3.0 has a magic of 0x9601 and ispell 3.1 has 0x9602. This magic
|
||||
@@ -110,10 +110,11 @@
|
||||
#>>>>&1 string x DECLARATION=%s
|
||||
>>>>0 use spell-aff
|
||||
# ispell variant without declaration like in: /usr/lib/ispell/bulgarian.aff /usr/lib/ispell/russian.aff
|
||||
>>>0 default x
|
||||
# XXX: too weak
|
||||
#>>>0 default x
|
||||
# skip /etc/nilfs_cleanerd.conf by looking for ispell suffix section
|
||||
>>>>0 search/3233 suffixes\n
|
||||
>>>>>0 use spell-aff
|
||||
#>>>>0 search/3233 suffixes\n
|
||||
#>>>>>0 use spell-aff
|
||||
# variant starting with empty line and comment character at the beginning of 2nd line like in: /usr/lib/ispell/polish.aff
|
||||
0 ubeshort 0x0a23
|
||||
# skip /etc/discover-modprobe.conf by looking for ispell declaration
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: javascript,v 1.7 2024/11/10 14:48:55 christos Exp $
|
||||
# $File: javascript,v 1.8 2026/04/15 17:29:21 christos Exp $
|
||||
# javascript: magic for javascript and node.js scripts.
|
||||
#
|
||||
0 string/tw #!/bin/node Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
0 string/tw #!/usr/bin/node Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
0 string/tw #!/bin/nodejs Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
0 string/tw #!/usr/bin/nodejs Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
0 string/t #!/usr/bin/env\ node Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
0 string/t #!/usr/bin/env\ nodejs Node.js script executable
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
|
||||
# JavaScript
|
||||
# The strength is increased to beat the C++ but lose to HTML rules,
|
||||
# because javascript is embedded in hmtl files typically
|
||||
0 search "use\x20strict" JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 search 'use\x20strict' JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex module(\\.|\\[["'])exports.*= JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex \^(const|var|let).*=.*require\\( JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex \^export\x20(function|class|default|const|var|let|async)\x20 JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex \\((async\x20)?function[(\x20] JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex \^(import|export).*\x20from\x20 JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex \^(import|export)\x20["']\\./ JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
0 regex typeof.*[!=]== JavaScript source
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext js
|
||||
|
||||
# React Native minified JavaScript
|
||||
0 search/128 __BUNDLE_START_TIME__= React Native minified JavaScript
|
||||
!:strength +20
|
||||
!:mime application/javascript
|
||||
!:mime text/javascript
|
||||
!:ext bundle/jsbundle
|
||||
|
||||
# Hermes by Facebook https://hermesengine.dev/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: k9,v 1.1 2026/03/20 13:59:12 christos Exp $
|
||||
# k9: file(1) magic for K9 Self-Validating Components
|
||||
# URL: https://github.com/hyperpolymath/k9-svc
|
||||
# From: Jonathan D.A. Jewell <[email protected]>
|
||||
|
||||
# K9 files are self-validating components using the must-just-nickel triad.
|
||||
# They begin with the ASCII magic number "K9!" (0x4B 0x39 0x21) and use a
|
||||
# tiered security model: Kennel (data only), Yard (validation), Hunt (full
|
||||
# execution with cryptographic signature).
|
||||
# Specification: https://github.com/hyperpolymath/standards/blob/main/k9-svc/SPEC.adoc
|
||||
# MIME type: application/vnd.k9+nickel
|
||||
|
||||
# K9 magic number: "K9!" at byte offset 0
|
||||
0 string K9! K9 Self-Validating Component
|
||||
!:mime application/vnd.k9+nickel
|
||||
!:ext k9
|
||||
|
||||
# Detect security level from content following the magic number
|
||||
>&0 search/1024 security_level:\ 'Kennel K9 Self-Validating Component (Kennel level, data only)
|
||||
|
||||
>&0 search/1024 security_level:\ 'Yard K9 Self-Validating Component (Yard level, validation)
|
||||
|
||||
>&0 search/1024 security_level:\ 'Hunt K9 Self-Validating Component (Hunt level, executable)
|
||||
|
||||
# K9 Nickel contract files (.k9.ncl) -- pedigree definition
|
||||
0 search/256 K9Pedigree K9 Nickel contract (pedigree definition)
|
||||
!:mime application/vnd.k9+nickel
|
||||
!:ext k9.ncl/ncl
|
||||
!:strength -10
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: lua,v 1.9 2026/01/25 16:07:06 christos Exp $
|
||||
# $File: lua,v 1.10 2026/04/17 15:24:30 christos Exp $
|
||||
# lua: file(1) magic for Lua scripting language
|
||||
# URL: https://www.lua.org/
|
||||
# From: Reuben Thomas <[email protected]>, Seo Sanghyeon <[email protected]>
|
||||
@@ -14,6 +14,8 @@
|
||||
!:mime text/x-lua
|
||||
0 search/1 #!\ /usr/bin/env\ lua Lua script text executable
|
||||
!:mime text/x-lua
|
||||
0 search/1/w #!\ /usr/libexec/flua Lua script text executable
|
||||
!:mime text/x-lua
|
||||
|
||||
# Lua bytecode
|
||||
0 string \033Lua Lua bytecode,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: mail.news,v 1.33 2025/02/28 19:28:01 christos Exp $
|
||||
# $File: mail.news,v 1.34 2026/06/02 18:47:23 christos Exp $
|
||||
# mail.news: file(1) magic for mail and news
|
||||
#
|
||||
# Unfortunately, saved netnews also has From line added in some news software.
|
||||
@@ -44,7 +44,7 @@
|
||||
!:mime message/x-gnu-rmail
|
||||
# ~/RMAIL
|
||||
!:ext /
|
||||
0 string/t Received: RFC 822 mail text
|
||||
0 string Received: RFC 822 mail text
|
||||
!:mime message/rfc822
|
||||
0 string/t MIME-Version: MIME entity text
|
||||
#0 string/t Content- MIME entity text
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: mips,v 1.15 2024/09/01 13:49:15 christos Exp $
|
||||
# $File: mips,v 1.16 2026/04/19 20:17:41 christos Exp $
|
||||
# mips: file(1) magic for MIPS ECOFF and Ucode, as used in SGI IRIX
|
||||
# and DEC Ultrix
|
||||
#
|
||||
@@ -54,6 +54,8 @@
|
||||
0 leshort 0x0166
|
||||
>16 leshort 56 MIPSEL MIPS-II ECOFF executable
|
||||
>>0 use display-mips-ecoff
|
||||
>16 leshort 0
|
||||
>>0 use display-coff
|
||||
#
|
||||
# MIPS 3 additions
|
||||
#
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: msdos,v 1.214 2025/09/06 17:00:32 christos Exp $
|
||||
# $File: msdos,v 1.216 2026/03/11 20:05:18 christos Exp $
|
||||
# msdos: file(1) magic for MS-DOS files
|
||||
#
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
# OS/2 batch files are REXX. the second regex is a bit generic, oh well
|
||||
# the matched commands seem to be common in REXX and uncommon elsewhere
|
||||
100 search/0xffff rxfuncadd
|
||||
>100 regex =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
|
||||
>100 regex/c =^[\ \t]{0,10}call[\ \t]{1,10}rxfunc OS/2 REXX batch file text
|
||||
100 search/0xffff say
|
||||
>100 regex/ =^[\ \t]{0,10}say\ ['"] OS/2 REXX batch file text
|
||||
>100 regex/c =^[\ \t]{0,10}say\ ['"] OS/2 REXX batch file text
|
||||
|
||||
|
||||
# Tests for various EXE types.
|
||||
@@ -1506,7 +1506,7 @@
|
||||
>1 leshort <-259
|
||||
# that offset must be accessible
|
||||
# add 10000h to jump at end of 64 KiB segment, add 1 for jump instruction and 2 for 16-bit offset
|
||||
>>(1,s+65539) byte x
|
||||
>>(1.s+65539) byte x
|
||||
# after jump next instruction for DEBUGGING!
|
||||
#>>>&-1 ubelong x \b, NEXT instruction %#8.8x
|
||||
>>>0 use msdos-com
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: nix,v 1.1 2026/06/02 19:41:27 christos Exp $
|
||||
# nix: Nix Expression Language (.nix)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Detect via common function arguments or structural patterns at the start
|
||||
0 string {
|
||||
>1 search/500 stdenv Nix package definition
|
||||
#>1 search/500 mkDerivation Nix expression (mkDerivation)
|
||||
|
||||
# Fallback: Detect if it's a generic Nix attribute set or function layout
|
||||
#0 search/100 stdenv.mkDerivation Nix expression (mkDerivation)
|
||||
# search/100 import <nixpkgs> Nix expression (script/default)
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: ole2compounddocs,v 1.29 2024/06/18 17:07:48 christos Exp $
|
||||
# $File: ole2compounddocs,v 1.30 2026/04/17 14:43:18 christos Exp $
|
||||
# Microsoft OLE 2 Compound Documents : file(1) magic for Microsoft Structured
|
||||
# storage (https://en.wikipedia.org/wiki/Compound_File_Binary_Format)
|
||||
# Additional tests for OLE 2 Compound Documents should be under this recipe.
|
||||
@@ -268,7 +268,7 @@
|
||||
# Second directory entry name FileHeader hint for Thinkfree Office document
|
||||
>>>>128 lestring16 FileHeader : Hancom HWP (Hangul Word Processor) file, version 5.0
|
||||
#!:mime application/haansofthwp
|
||||
!:mime application/x-hwp
|
||||
!:mime application/hwp+zip
|
||||
# https://example-files.online-convert.com/document/hwp/example.hwp
|
||||
!:ext hwp
|
||||
#
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: partclone,v 1.1 2026/05/09 20:03:34 christos Exp $
|
||||
# partclone: file(1) magic for images generated by partclone(8)
|
||||
#
|
||||
# Format documentation: <https://github.com/Thomas-Tsai/partclone/blob/master/IMAGE_FORMATS.md>
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
0 string partclone-image
|
||||
# version 0001
|
||||
>30 string 0001
|
||||
>>34 short 0
|
||||
>>>15 string/T >\0 Partclone image, version 0001, filesystem: %s
|
||||
>>>40 lequad >0 \b, total size %llu
|
||||
>>>36 lelong >0 \b, block size %u
|
||||
>>>56 lequad >0 \b, %llu/
|
||||
>>>48 lequad >0 \b%llu blocks used
|
||||
# version 0002
|
||||
>30 string 0002
|
||||
>>92 leshort 2
|
||||
>>>16 string/T >\0 Partclone image, version 0002, created by v%s
|
||||
>>>36 string/T >\0 \b, filesystem: %s
|
||||
>>>34 leshort 0xC0DE
|
||||
>>>>52 lequad >0 \b, total size %llu
|
||||
>>>>84 lelong >0 \b, block size %u
|
||||
>>>>76 lequad >0 \b, %llu/
|
||||
>>>>60 lequad >0 \b%llu blocks used
|
||||
>>>34 leshort 0xDEC0
|
||||
>>>>52 bequad >0 \b, total size %llu
|
||||
>>>>84 belong >0 \b, block size %u
|
||||
>>>>76 bequad >0 \b, %llu/
|
||||
>>>>60 bequad >0 \b%llu blocks used
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: riff,v 1.52 2025/09/08 12:48:15 christos Exp $
|
||||
# $File: riff,v 1.53 2026/04/16 17:09:52 christos Exp $
|
||||
# riff: file(1) magic for RIFF format
|
||||
# See
|
||||
#
|
||||
@@ -695,7 +695,7 @@
|
||||
!:ext amv
|
||||
#!:ext amv/mtv
|
||||
# URL: http://fileformats.archiveteam.org/wiki/WebP
|
||||
>8 string WEBP \b, Web/P image
|
||||
>8 string WEBP \b, WebP image
|
||||
!:mime image/webp
|
||||
!:ext webp
|
||||
>>12 use riff-walk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: ruby,v 1.10 2019/07/21 09:40:17 christos Exp $
|
||||
# $File: ruby,v 1.11 2026/06/02 22:05:09 christos Exp $
|
||||
# ruby: file(1) magic for Ruby scripting language
|
||||
# URL: https://www.ruby-lang.org/
|
||||
# From: Reuben Thomas <[email protected]>
|
||||
@@ -47,9 +47,6 @@
|
||||
!:strength + 10
|
||||
!:mime text/x-ruby
|
||||
|
||||
0 search/8192 require
|
||||
>0 regex \^[[:space:]]*require[[:space:]]'[A-Za-z_/.]+' Ruby script text
|
||||
!:mime text/x-ruby
|
||||
0 search/8192 include
|
||||
>0 regex \^[[:space:]]*include\ ([A-Z]+[a-z]*(::))+ Ruby script text
|
||||
!:mime text/x-ruby
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: sun,v 1.29 2024/03/31 15:06:56 christos Exp $
|
||||
# $File: sun,v 1.30 2026/06/02 17:28:15 christos Exp $
|
||||
# sun: file(1) magic for Sun machines
|
||||
#
|
||||
# Values for big-endian Sun (MC680x0, SPARC) binaries on pre-5.x
|
||||
@@ -140,3 +140,13 @@
|
||||
# New format for Sun/Cobalt boot ROMs is annoying, it stores the version code
|
||||
# at the very end where file(1) can't get it.
|
||||
0 string CRfs COBALT boot rom data (Flat boot rom or file system)
|
||||
|
||||
|
||||
# Sun Icon - raster icon format from SunView/OpenWindows
|
||||
# Used on Sun workstations from the mid-1980s onwards.
|
||||
# ASCII format: C-style comment header with dimensions, followed by hex data.
|
||||
# Netpbm: sunicontopnm
|
||||
|
||||
0 string /*\ Format_version=1 Sun icon image data
|
||||
!:mime image/x-sun-icon
|
||||
!:ext icon/ico
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: tex,v 1.24 2026/02/01 16:17:53 christos Exp $
|
||||
# $File: tex,v 1.25 2026/06/02 18:16:34 christos Exp $
|
||||
# tex: file(1) magic for TeX files
|
||||
#
|
||||
# XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
|
||||
@@ -44,9 +44,13 @@
|
||||
>33 string >\0 (%s)
|
||||
|
||||
# Texinfo and GNU Info, from Daniel Quinlan ([email protected])
|
||||
0 search/1 \\input\ texinfo Texinfo source text
|
||||
0 search/b/1 \\input\ texinfo Texinfo source text
|
||||
!:mime text/x-texinfo
|
||||
0 search/1 This\ is\ Info\ file GNU Info text
|
||||
0 search/b/1 This\ is\ Info\ file GNU Info text
|
||||
!:mime text/x-info
|
||||
0 search/b/10 INFO-DIR-SECTION GNU Info text
|
||||
!:mime text/x-info
|
||||
0 search/b/10 START-INFO-DIR-ENTRY GNU Info text
|
||||
!:mime text/x-info
|
||||
|
||||
0 string %!TEX\040root TeX Document text
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: virtual,v 1.22 2026/02/05 18:51:36 christos Exp $
|
||||
# $File: virtual,v 1.23 2026/04/15 16:56:41 christos Exp $
|
||||
# From: James Nobis <[email protected]>
|
||||
# Microsoft hard disk images for:
|
||||
# Virtual Server
|
||||
@@ -198,7 +198,11 @@
|
||||
>0x10 lelong x \b, version %u
|
||||
>0x14 lelong x \b, XML length %u
|
||||
>0x18 lelong 1 \b, running
|
||||
>0x1c lelong 1 \b, compressed
|
||||
>0x1c lelong 0 \b, RAW (no compression)
|
||||
>0x1c lelong 1 \b, gzip compressed
|
||||
>0x1c lelong 2 \b, bzip2 compressed
|
||||
>0x1c lelong 3 \b, xz compressed
|
||||
>0x1c lelong 4 \b, lzop compressed
|
||||
|
||||
0 string LibvirtQemudPart Libvirt QEMU partial Suspend Image
|
||||
# From: Alex Beregszaszi <[email protected]>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: windows,v 1.69 2025/09/06 16:58:00 christos Exp $
|
||||
# $File: windows,v 1.73 2026/04/20 14:53:18 christos Exp $
|
||||
# windows: file(1) magic for Microsoft Windows
|
||||
#
|
||||
# This file is mainly reserved for files where programs
|
||||
@@ -663,7 +663,7 @@
|
||||
# skip space at beginning
|
||||
>0 string \040
|
||||
# name without extension and greater character or name with hlp extension
|
||||
>>1 regex \^([^\xd>]*|.*\\.hlp) MS Windows help file Content, based "%s"
|
||||
>>1 regex/c \^([^\xd>]*|.*\\.hlp) MS Windows help file Content, based "%s"
|
||||
!:mime text/plain
|
||||
!:apple ????TEXT
|
||||
!:ext cnt
|
||||
@@ -1106,7 +1106,7 @@
|
||||
# space after right bracket
|
||||
# or AutoRun.Amd64 for 64 bit systems
|
||||
# or only NL separator
|
||||
>>&0 regex \^autorun
|
||||
>>&0 regex/c \^autorun
|
||||
# but sometimes total commander directory tree file "treeinfo.wc" with lines like
|
||||
# [AUTORUN]
|
||||
# [boot]
|
||||
@@ -1120,56 +1120,56 @@
|
||||
!:ext inf
|
||||
# https://msdn.microsoft.com/en-us/library/windows/hardware/ff549520(v=vs.85).aspx
|
||||
# version strings ASCII coded case-independent for Windows setup information script file
|
||||
>>&0 regex \^(version|strings)] Windows setup INFormation
|
||||
>>&0 regex/c \^(version|strings)] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
#!:mime application/x-wine-extension-inf
|
||||
!:ext inf
|
||||
# NETCRC.INF OEMCPL.INF
|
||||
>>&0 regex \^(WinsockCRCList|OEMCPL)] Windows setup INFormation
|
||||
>>&0 regex/c \^(WinsockCRCList|OEMCPL)] Windows setup INFormation
|
||||
!:mime application/x-setupscript
|
||||
!:ext inf
|
||||
# http://www.winfaq.de/faq_html/Content/tip2500/onlinefaq.php?h=tip2653.htm
|
||||
# https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102.aspx
|
||||
# .ShellClassInfo DeleteOnCopy LocalizedFileNames ASCII coded case-independent
|
||||
>>&0 regex/1024 \^(\\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)] Windows desktop.ini
|
||||
>>&0 regex/1024c \^(\\.ShellClassInfo|DeleteOnCopy|LocalizedFileNames)] Windows desktop.ini
|
||||
!:mime application/x-wine-extension-ini
|
||||
#!:mime text/plain
|
||||
# https://support.microsoft.com/kb/84709/
|
||||
>>&0 regex \^don't\ load] Windows CONTROL.INI
|
||||
>>&0 regex/c \^don't\ load] Windows CONTROL.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
>>&0 regex \^(ndishlp\\$|protman\\$|NETBEUI\\$)] Windows PROTOCOL.INI
|
||||
>>&0 regex/c \^(ndishlp\\$|protman\\$|NETBEUI\\$)] Windows PROTOCOL.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# https://technet.microsoft.com/en-us/library/cc722567.aspx
|
||||
# http://www.winfaq.de/faq_html/Content/tip0000/onlinefaq.php?h=tip0137.htm
|
||||
>>&0 regex \^(windows|Compatibility|embedding)] Windows WIN.INI
|
||||
>>&0 regex/c \^(windows|Compatibility|embedding)] Windows WIN.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# https://en.wikipedia.org/wiki/SYSTEM.INI
|
||||
>>&0 regex \^(boot|386enh|drivers)] Windows SYSTEM.INI
|
||||
>>&0 regex/c \^(boot|386enh|drivers)] Windows SYSTEM.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# http://www.mdgx.com/newtip6.htm
|
||||
>>&0 regex \^SafeList] Windows IOS.INI
|
||||
>>&0 regex/c \^SafeList] Windows IOS.INI
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# https://en.wikipedia.org/wiki/NTLDR Windows Boot Loader information
|
||||
>>&0 regex \^boot\x20loader] Windows boot.ini
|
||||
>>&0 regex/c \^boot\x20loader] Windows boot.ini
|
||||
!:mime application/x-wine-extension-ini
|
||||
!:ext ini
|
||||
# https://en.wikipedia.org/wiki/CONFIG.SYS
|
||||
>>&0 regex \^menu] MS-DOS CONFIG.SYS
|
||||
>>&0 regex/c \^menu] MS-DOS CONFIG.SYS
|
||||
# @CONFIG.UI configuration file of previous DOS version saved by Caldera OPENDOS INSTALL.EXE
|
||||
# CONFIG.PSS saved version of file CONFIG.SYS created by %WINDIR%\SYSTEM\MSCONFIG.EXE
|
||||
# CONFIG.TSH renamed file CONFIG.SYS.BAT by %WINDIR%\SYSTEM\MSCONFIG.EXE
|
||||
# dos and w40 used in dual booting scene
|
||||
!:ext sys/dos/w40
|
||||
# https://support.microsoft.com/kb/118579/
|
||||
>>&0 regex \^Paths]\r\n MS-DOS MSDOS.SYS
|
||||
>>&0 regex/c \^Paths]\r\n MS-DOS MSDOS.SYS
|
||||
!:ext sys/dos
|
||||
# http://chmspec.nongnu.org/latest/INI.html#HHP
|
||||
>>&0 regex \^options]\r\n Microsoft HTML Help Project
|
||||
>>&0 regex/c \^options]\r\n Microsoft HTML Help Project
|
||||
!:mime text/plain
|
||||
!:ext hhp
|
||||
# From: Joerg Jenderek
|
||||
@@ -1178,7 +1178,7 @@
|
||||
# http://mark0.net/download/triddefs_xml.7z/defs/c/cpx.trid.xml
|
||||
# Note: stored in directory %WINDIR%\SysWOW64 or %WINDIR%\system
|
||||
# second word often Latin but sometimes Cyrillic like in 12510866.CPX
|
||||
>>&0 regex \^Windows\ (Latin|Cyrillic) Windows codepage translator
|
||||
>>&0 regex/c \^Windows\ (Latin|Cyrillic) Windows codepage translator
|
||||
#!:mime text/plain
|
||||
!:mime text/x-ms-cpx
|
||||
# like: 12510866.CPX
|
||||
@@ -1187,7 +1187,7 @@
|
||||
# URL: https://en.wikipedia.org/wiki/File_Explorer
|
||||
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/s/scf-exp.trid.xml,scf-exp-old.trid.xml
|
||||
# Note: called "Windows Explorer Command Shell File" by TrID and "File Explorer Command" by Windows via SHCmdFile
|
||||
>>&0 regex \^Shell]\r\n Windows Explorer Shell Command File
|
||||
>>&0 regex/c \^Shell]\r\n Windows Explorer Shell Command File
|
||||
#!:mime text/plain
|
||||
!:mime text/x-ms-scf
|
||||
# like: channels.scf desktop.scf explorer.scf "Desktop anzeigen.scf"
|
||||
@@ -1199,7 +1199,7 @@
|
||||
# URL: http://en.wikipedia.org/wiki/VIA_Technologies
|
||||
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/s/scf-via.trid.xml
|
||||
# Note: called "VIA setup configuration file" by TrID
|
||||
>>&0 regex \^SCF]\r\n VIA setup configuration
|
||||
>>&0 regex/c \^SCF]\r\n VIA setup configuration
|
||||
#!:mime text/plain
|
||||
!:mime text/x-via-scf
|
||||
# like: SETUP.SCF
|
||||
@@ -1208,7 +1208,7 @@
|
||||
# URL: https://en.wikipedia.org/wiki/InstallShield
|
||||
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/l/lid-is.trid.xml
|
||||
# Note: contain also 3 keywords like: count Default key0
|
||||
>>&0 regex \^Languages] InstallShield Language Identifier
|
||||
>>&0 regex/c \^Languages] InstallShield Language Identifier
|
||||
#!:mime text/plain
|
||||
!:mime text/x-installshield-lid
|
||||
# like: SETUP.LID
|
||||
@@ -1217,7 +1217,7 @@
|
||||
# URL: https://www.file-extensions.org/tag-file-extension
|
||||
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/t/taginfo.trid.xml
|
||||
# Note: contain also keywords like: Application Category Company Misc Version
|
||||
>>&0 regex \^TagInfo] TagInfo
|
||||
>>&0 regex/c \^TagInfo] TagInfo
|
||||
#!:mime text/plain
|
||||
#!:mime text/prs.lines.tag
|
||||
!:mime text/x-ms-tag
|
||||
@@ -1260,7 +1260,7 @@
|
||||
>>>>>&0 ubyte x
|
||||
# characters, digits, underscore and white space followed by right bracket
|
||||
# terminated by CR implies section line to skip BOOTLOG.TXT DETLOG.TXT
|
||||
>>>>>>&-1 regex/T \^([A-Za-z0-9_\(\)\ ]+)\][\r\n] Generic INItialization configuration [%-.40s
|
||||
>>>>>>&-1 regex/T \^([A-Za-z0-9_\(\)\ ]+)\]\r Generic INItialization configuration [%-.40s
|
||||
# NETDEF.INF multiarc.ini
|
||||
#!:mime application/x-setupscript
|
||||
!:mime application/x-wine-extension-ini
|
||||
@@ -1915,3 +1915,11 @@
|
||||
|
||||
# MSFT format
|
||||
0 string MSFT\x02\x00\x01\x00 Type Library (MSFT format)
|
||||
|
||||
# Magic file for OllyDbg 2.01 Module Info files (.udd)
|
||||
0 string Mod\x00 OllyDbg 2.0 Module Info File
|
||||
|
||||
# COFF object files for OMNI VM
|
||||
# MSVC6.0 CVTRES.EXE can create COFF binary for OMNI by /MACHINE:OMNI flag
|
||||
0 leshort =0xace1
|
||||
>0 use display-coff
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# $File: wordprocessors,v 1.39 2024/11/09 23:26:33 christos Exp $
|
||||
# $File: wordprocessors,v 1.40 2026/04/16 19:12:15 christos Exp $
|
||||
# wordprocessors: file(1) magic fo word processors.
|
||||
#
|
||||
####### PWP file format used on Smith Corona Personal Word Processors:
|
||||
@@ -664,3 +664,7 @@
|
||||
# Atari ST Hypertext files
|
||||
0 string HDOC\0 ST-Guide file
|
||||
0 string HREF\0 ST-Guide reference file
|
||||
|
||||
|
||||
# Atari 1st Word Plus files
|
||||
0 string \x1F0 1st Word Plus file
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $File: Makefile.am,v 1.201 2026/02/01 16:25:09 christos Exp $
|
||||
# $File: Makefile.am,v 1.206 2026/06/02 19:41:27 christos Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@@ -10,6 +10,7 @@ pkgdata_DATA = magic.mgc
|
||||
MAGIC_FRAGMENTS = \
|
||||
$(MAGIC_DIR)/Header \
|
||||
$(MAGIC_DIR)/Localstuff \
|
||||
$(MAGIC_FRAGMENT_DIR)/a2ml \
|
||||
$(MAGIC_FRAGMENT_DIR)/acorn \
|
||||
$(MAGIC_FRAGMENT_DIR)/adi \
|
||||
$(MAGIC_FRAGMENT_DIR)/adventure \
|
||||
@@ -19,6 +20,7 @@ $(MAGIC_FRAGMENT_DIR)/allegro \
|
||||
$(MAGIC_FRAGMENT_DIR)/alliant \
|
||||
$(MAGIC_FRAGMENT_DIR)/amanda \
|
||||
$(MAGIC_FRAGMENT_DIR)/amigaos \
|
||||
$(MAGIC_FRAGMENT_DIR)/andrew \
|
||||
$(MAGIC_FRAGMENT_DIR)/android \
|
||||
$(MAGIC_FRAGMENT_DIR)/animation \
|
||||
$(MAGIC_FRAGMENT_DIR)/aout \
|
||||
@@ -34,6 +36,7 @@ $(MAGIC_FRAGMENT_DIR)/arm \
|
||||
$(MAGIC_FRAGMENT_DIR)/asf \
|
||||
$(MAGIC_FRAGMENT_DIR)/assembler \
|
||||
$(MAGIC_FRAGMENT_DIR)/asterix \
|
||||
$(MAGIC_FRAGMENT_DIR)/atari \
|
||||
$(MAGIC_FRAGMENT_DIR)/att3b \
|
||||
$(MAGIC_FRAGMENT_DIR)/audio \
|
||||
$(MAGIC_FRAGMENT_DIR)/avm \
|
||||
@@ -156,6 +159,7 @@ $(MAGIC_FRAGMENT_DIR)/isz \
|
||||
$(MAGIC_FRAGMENT_DIR)/java \
|
||||
$(MAGIC_FRAGMENT_DIR)/javascript \
|
||||
$(MAGIC_FRAGMENT_DIR)/jpeg \
|
||||
$(MAGIC_FRAGMENT_DIR)/k9 \
|
||||
$(MAGIC_FRAGMENT_DIR)/karma \
|
||||
$(MAGIC_FRAGMENT_DIR)/kde \
|
||||
$(MAGIC_FRAGMENT_DIR)/keepass \
|
||||
@@ -220,6 +224,7 @@ $(MAGIC_FRAGMENT_DIR)/news \
|
||||
$(MAGIC_FRAGMENT_DIR)/nifty \
|
||||
$(MAGIC_FRAGMENT_DIR)/nim-lang \
|
||||
$(MAGIC_FRAGMENT_DIR)/nitpicker \
|
||||
$(MAGIC_FRAGMENT_DIR)/nix \
|
||||
$(MAGIC_FRAGMENT_DIR)/numpy \
|
||||
$(MAGIC_FRAGMENT_DIR)/oasis \
|
||||
$(MAGIC_FRAGMENT_DIR)/ocaml \
|
||||
@@ -237,6 +242,7 @@ $(MAGIC_FRAGMENT_DIR)/pack \
|
||||
$(MAGIC_FRAGMENT_DIR)/palm \
|
||||
$(MAGIC_FRAGMENT_DIR)/parix \
|
||||
$(MAGIC_FRAGMENT_DIR)/parrot \
|
||||
$(MAGIC_FRAGMENT_DIR)/partclone \
|
||||
$(MAGIC_FRAGMENT_DIR)/pascal \
|
||||
$(MAGIC_FRAGMENT_DIR)/pbf \
|
||||
$(MAGIC_FRAGMENT_DIR)/pbm \
|
||||
@@ -267,13 +273,13 @@ $(MAGIC_FRAGMENT_DIR)/python \
|
||||
$(MAGIC_FRAGMENT_DIR)/qt \
|
||||
$(MAGIC_FRAGMENT_DIR)/r \
|
||||
$(MAGIC_FRAGMENT_DIR)/revision \
|
||||
$(MAGIC_FRAGMENT_DIR)/ringdove \
|
||||
$(MAGIC_FRAGMENT_DIR)/riff \
|
||||
$(MAGIC_FRAGMENT_DIR)/ringdove \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpi \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpm \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpmsg \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/rst \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/ruby \
|
||||
$(MAGIC_FRAGMENT_DIR)/rust \
|
||||
$(MAGIC_FRAGMENT_DIR)/sc \
|
||||
@@ -342,8 +348,8 @@ $(MAGIC_FRAGMENT_DIR)/vmware \
|
||||
$(MAGIC_FRAGMENT_DIR)/vorbis \
|
||||
$(MAGIC_FRAGMENT_DIR)/vxl \
|
||||
$(MAGIC_FRAGMENT_DIR)/warc \
|
||||
$(MAGIC_FRAGMENT_DIR)/web \
|
||||
$(MAGIC_FRAGMENT_DIR)/weak \
|
||||
$(MAGIC_FRAGMENT_DIR)/web \
|
||||
$(MAGIC_FRAGMENT_DIR)/webassembly \
|
||||
$(MAGIC_FRAGMENT_DIR)/windows \
|
||||
$(MAGIC_FRAGMENT_DIR)/wireless \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -70,6 +70,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -142,10 +144,9 @@ am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
|
||||
DATA = $(pkgdata_DATA)
|
||||
@@ -233,8 +234,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -279,7 +282,7 @@ top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
#
|
||||
# $File: Makefile.am,v 1.201 2026/02/01 16:25:09 christos Exp $
|
||||
# $File: Makefile.am,v 1.206 2026/06/02 19:41:27 christos Exp $
|
||||
#
|
||||
MAGIC_FRAGMENT_BASE = Magdir
|
||||
MAGIC_DIR = $(top_srcdir)/magic
|
||||
@@ -288,6 +291,7 @@ pkgdata_DATA = magic.mgc
|
||||
MAGIC_FRAGMENTS = \
|
||||
$(MAGIC_DIR)/Header \
|
||||
$(MAGIC_DIR)/Localstuff \
|
||||
$(MAGIC_FRAGMENT_DIR)/a2ml \
|
||||
$(MAGIC_FRAGMENT_DIR)/acorn \
|
||||
$(MAGIC_FRAGMENT_DIR)/adi \
|
||||
$(MAGIC_FRAGMENT_DIR)/adventure \
|
||||
@@ -297,6 +301,7 @@ $(MAGIC_FRAGMENT_DIR)/allegro \
|
||||
$(MAGIC_FRAGMENT_DIR)/alliant \
|
||||
$(MAGIC_FRAGMENT_DIR)/amanda \
|
||||
$(MAGIC_FRAGMENT_DIR)/amigaos \
|
||||
$(MAGIC_FRAGMENT_DIR)/andrew \
|
||||
$(MAGIC_FRAGMENT_DIR)/android \
|
||||
$(MAGIC_FRAGMENT_DIR)/animation \
|
||||
$(MAGIC_FRAGMENT_DIR)/aout \
|
||||
@@ -312,6 +317,7 @@ $(MAGIC_FRAGMENT_DIR)/arm \
|
||||
$(MAGIC_FRAGMENT_DIR)/asf \
|
||||
$(MAGIC_FRAGMENT_DIR)/assembler \
|
||||
$(MAGIC_FRAGMENT_DIR)/asterix \
|
||||
$(MAGIC_FRAGMENT_DIR)/atari \
|
||||
$(MAGIC_FRAGMENT_DIR)/att3b \
|
||||
$(MAGIC_FRAGMENT_DIR)/audio \
|
||||
$(MAGIC_FRAGMENT_DIR)/avm \
|
||||
@@ -434,6 +440,7 @@ $(MAGIC_FRAGMENT_DIR)/isz \
|
||||
$(MAGIC_FRAGMENT_DIR)/java \
|
||||
$(MAGIC_FRAGMENT_DIR)/javascript \
|
||||
$(MAGIC_FRAGMENT_DIR)/jpeg \
|
||||
$(MAGIC_FRAGMENT_DIR)/k9 \
|
||||
$(MAGIC_FRAGMENT_DIR)/karma \
|
||||
$(MAGIC_FRAGMENT_DIR)/kde \
|
||||
$(MAGIC_FRAGMENT_DIR)/keepass \
|
||||
@@ -498,6 +505,7 @@ $(MAGIC_FRAGMENT_DIR)/news \
|
||||
$(MAGIC_FRAGMENT_DIR)/nifty \
|
||||
$(MAGIC_FRAGMENT_DIR)/nim-lang \
|
||||
$(MAGIC_FRAGMENT_DIR)/nitpicker \
|
||||
$(MAGIC_FRAGMENT_DIR)/nix \
|
||||
$(MAGIC_FRAGMENT_DIR)/numpy \
|
||||
$(MAGIC_FRAGMENT_DIR)/oasis \
|
||||
$(MAGIC_FRAGMENT_DIR)/ocaml \
|
||||
@@ -515,6 +523,7 @@ $(MAGIC_FRAGMENT_DIR)/pack \
|
||||
$(MAGIC_FRAGMENT_DIR)/palm \
|
||||
$(MAGIC_FRAGMENT_DIR)/parix \
|
||||
$(MAGIC_FRAGMENT_DIR)/parrot \
|
||||
$(MAGIC_FRAGMENT_DIR)/partclone \
|
||||
$(MAGIC_FRAGMENT_DIR)/pascal \
|
||||
$(MAGIC_FRAGMENT_DIR)/pbf \
|
||||
$(MAGIC_FRAGMENT_DIR)/pbm \
|
||||
@@ -545,13 +554,13 @@ $(MAGIC_FRAGMENT_DIR)/python \
|
||||
$(MAGIC_FRAGMENT_DIR)/qt \
|
||||
$(MAGIC_FRAGMENT_DIR)/r \
|
||||
$(MAGIC_FRAGMENT_DIR)/revision \
|
||||
$(MAGIC_FRAGMENT_DIR)/ringdove \
|
||||
$(MAGIC_FRAGMENT_DIR)/riff \
|
||||
$(MAGIC_FRAGMENT_DIR)/ringdove \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpi \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpm \
|
||||
$(MAGIC_FRAGMENT_DIR)/rpmsg \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/rst \
|
||||
$(MAGIC_FRAGMENT_DIR)/rtf \
|
||||
$(MAGIC_FRAGMENT_DIR)/ruby \
|
||||
$(MAGIC_FRAGMENT_DIR)/rust \
|
||||
$(MAGIC_FRAGMENT_DIR)/sc \
|
||||
@@ -620,8 +629,8 @@ $(MAGIC_FRAGMENT_DIR)/vmware \
|
||||
$(MAGIC_FRAGMENT_DIR)/vorbis \
|
||||
$(MAGIC_FRAGMENT_DIR)/vxl \
|
||||
$(MAGIC_FRAGMENT_DIR)/warc \
|
||||
$(MAGIC_FRAGMENT_DIR)/web \
|
||||
$(MAGIC_FRAGMENT_DIR)/weak \
|
||||
$(MAGIC_FRAGMENT_DIR)/web \
|
||||
$(MAGIC_FRAGMENT_DIR)/webassembly \
|
||||
$(MAGIC_FRAGMENT_DIR)/windows \
|
||||
$(MAGIC_FRAGMENT_DIR)/wireless \
|
||||
@@ -717,6 +726,7 @@ ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -779,11 +789,11 @@ install-strip:
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(am__rm_f) $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@@ -891,3 +901,10 @@ ${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP)
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
+49
-28
@@ -1,9 +1,11 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
# Common wrapper for a few potentially missing GNU and other programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
scriptversion=2024-12-03.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
# shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells
|
||||
|
||||
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <[email protected]>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -54,18 +56,20 @@ Options:
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
aclocal autoconf autogen autoheader autom4te automake autoreconf
|
||||
bison flex help2man lex makeinfo perl yacc
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <[email protected]>."
|
||||
Report bugs to <[email protected]>.
|
||||
GNU Automake home page: <https://www.gnu.org/software/automake/>.
|
||||
General help using GNU software: <https://www.gnu.org/gethelp/>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
echo "missing (GNU Automake) $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
@@ -108,7 +112,7 @@ gnu_software_URL=https://www.gnu.org/software
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
aclocal|automake|autoreconf)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
@@ -123,6 +127,9 @@ program_details ()
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
*)
|
||||
:
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -137,48 +144,55 @@ give_advice ()
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
autoheader_deps="'acconfig.h'"
|
||||
automake_deps="'Makefile.am'"
|
||||
aclocal_deps="'acinclude.m4'"
|
||||
case $normalized_program in
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified $aclocal_deps or"
|
||||
echo "$configure_deps."
|
||||
;;
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
echo "You should only need it if you modified $configure_deps."
|
||||
;;
|
||||
autogen*)
|
||||
echo "You should only need it if you modified a '.def' or '.tpl' file."
|
||||
echo "You may want to install the GNU AutoGen package:"
|
||||
echo "<$gnu_software_URL/autogen/>"
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "You should only need it if you modified $autoheader_deps or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "You should only need it if you modified $automake_deps or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
autoreconf*)
|
||||
echo "You should only need it if you modified $aclocal_deps or"
|
||||
echo "$automake_deps or $autoheader_deps or $automake_deps or"
|
||||
echo "$configure_deps."
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
@@ -189,6 +203,12 @@ give_advice ()
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
perl*)
|
||||
echo "You should only need it to run GNU Autoconf, GNU Automake, "
|
||||
echo " assorted other tools, or if you modified a Perl source file."
|
||||
echo "You may want to install the Perl 5 language interpreter:"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
@@ -197,6 +217,7 @@ give_advice ()
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
program_details "$normalized_program"
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
@@ -207,7 +228,7 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -69,6 +69,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -203,8 +205,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -294,6 +298,7 @@ ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -355,8 +360,8 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@@ -447,3 +452,10 @@ uninstall-am:
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
@@ -127,14 +127,14 @@ _setparam.argtypes = [magic_t, c_int, c_void_p]
|
||||
class Magic(object):
|
||||
def __init__(self, ms):
|
||||
self._magic_t = ms
|
||||
self._close = _close
|
||||
self._close = _close
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Closes the magic database and deallocates any resources used.
|
||||
"""
|
||||
if _close:
|
||||
_close(self._magic_t)
|
||||
if self._close:
|
||||
self._close(self._magic_t)
|
||||
|
||||
@staticmethod
|
||||
def __tostr(s):
|
||||
|
||||
@@ -10,7 +10,8 @@ AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
|
||||
libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
encoding.c compress.c is_csv.c is_json.c is_simh.c is_tar.c readelf.c \
|
||||
print.c fsmagic.c funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h \
|
||||
swap.c swap.h
|
||||
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
|
||||
if MINGW
|
||||
MINGWLIBS = -lgnurx -lshlwapi
|
||||
@@ -19,7 +20,7 @@ MINGWLIBS =
|
||||
endif
|
||||
libmagic_la_LIBADD = -lm $(LTLIBOBJS) $(MINGWLIBS)
|
||||
|
||||
file_SOURCES = file.c seccomp.c
|
||||
file_SOURCES = file.c seccomp.c landlock.c
|
||||
file_LDADD = libmagic.la -lm
|
||||
CLEANFILES = magic.h
|
||||
EXTRA_DIST = magic.h.in cdf.mk BNF memtest.c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -72,6 +72,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -129,10 +131,9 @@ am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
|
||||
}
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
@@ -140,7 +141,7 @@ libmagic_la_DEPENDENCIES = $(LTLIBOBJS) $(am__DEPENDENCIES_1)
|
||||
am_libmagic_la_OBJECTS = buffer.lo magic.lo apprentice.lo softmagic.lo \
|
||||
ascmagic.lo encoding.lo compress.lo is_csv.lo is_json.lo \
|
||||
is_simh.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo \
|
||||
apptype.lo der.lo cdf.lo cdf_time.lo readcdf.lo
|
||||
apptype.lo der.lo cdf.lo cdf_time.lo readcdf.lo swap.lo
|
||||
libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
@@ -149,7 +150,7 @@ am__v_lt_1 =
|
||||
libmagic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libmagic_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_file_OBJECTS = file.$(OBJEXT) seccomp.$(OBJEXT)
|
||||
am_file_OBJECTS = file.$(OBJEXT) seccomp.$(OBJEXT) landlock.$(OBJEXT)
|
||||
file_OBJECTS = $(am_file_OBJECTS)
|
||||
file_DEPENDENCIES = libmagic.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
@@ -182,9 +183,10 @@ am__depfiles_remade = $(DEPDIR)/asctime_r.Plo $(DEPDIR)/asprintf.Plo \
|
||||
./$(DEPDIR)/fsmagic.Plo ./$(DEPDIR)/funcs.Plo \
|
||||
./$(DEPDIR)/is_csv.Plo ./$(DEPDIR)/is_json.Plo \
|
||||
./$(DEPDIR)/is_simh.Plo ./$(DEPDIR)/is_tar.Plo \
|
||||
./$(DEPDIR)/magic.Plo ./$(DEPDIR)/print.Plo \
|
||||
./$(DEPDIR)/readcdf.Plo ./$(DEPDIR)/readelf.Plo \
|
||||
./$(DEPDIR)/seccomp.Po ./$(DEPDIR)/softmagic.Plo
|
||||
./$(DEPDIR)/landlock.Po ./$(DEPDIR)/magic.Plo \
|
||||
./$(DEPDIR)/print.Plo ./$(DEPDIR)/readcdf.Plo \
|
||||
./$(DEPDIR)/readelf.Plo ./$(DEPDIR)/seccomp.Po \
|
||||
./$(DEPDIR)/softmagic.Plo ./$(DEPDIR)/swap.Plo
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@@ -315,8 +317,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -367,13 +371,14 @@ AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
|
||||
libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
|
||||
encoding.c compress.c is_csv.c is_json.c is_simh.c is_tar.c readelf.c \
|
||||
print.c fsmagic.c funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
|
||||
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h \
|
||||
swap.c swap.h
|
||||
|
||||
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
|
||||
@MINGW_FALSE@MINGWLIBS =
|
||||
@MINGW_TRUE@MINGWLIBS = -lgnurx -lshlwapi
|
||||
libmagic_la_LIBADD = -lm $(LTLIBOBJS) $(MINGWLIBS)
|
||||
file_SOURCES = file.c seccomp.c
|
||||
file_SOURCES = file.c seccomp.c landlock.c
|
||||
file_LDADD = libmagic.la -lm
|
||||
CLEANFILES = magic.h
|
||||
EXTRA_DIST = magic.h.in cdf.mk BNF memtest.c
|
||||
@@ -452,16 +457,11 @@ uninstall-binPROGRAMS:
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
cd "$(DESTDIR)$(bindir)" && $(am__rm_f) $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
$(am__rm_f) $(bin_PROGRAMS)
|
||||
test -z "$(EXEEXT)" || $(am__rm_f) $(bin_PROGRAMS:$(EXEEXT)=)
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@@ -488,15 +488,13 @@ uninstall-libLTLIBRARIES:
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
-$(am__rm_f) $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
echo rm -f $${locs}; \
|
||||
$(am__rm_f) $${locs}
|
||||
|
||||
libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES) $(EXTRA_libmagic_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libmagic_la_LINK) -rpath $(libdir) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
|
||||
@@ -541,16 +539,18 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_json.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_simh.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_tar.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/landlock.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/magic.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readcdf.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seccomp.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
@: >>$@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
@@ -656,6 +656,7 @@ cscopelist-am: $(am__tagged_files)
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -723,23 +724,23 @@ install-strip:
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
-$(am__rm_f) $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
-$(am__rm_f) $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(DEPDIR)/asctime_r.Plo
|
||||
-rm -f $(DEPDIR)/asctime_r.Plo
|
||||
-rm -f $(DEPDIR)/asprintf.Plo
|
||||
-rm -f $(DEPDIR)/ctime_r.Plo
|
||||
-rm -f $(DEPDIR)/dprintf.Plo
|
||||
@@ -769,12 +770,14 @@ distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/is_json.Plo
|
||||
-rm -f ./$(DEPDIR)/is_simh.Plo
|
||||
-rm -f ./$(DEPDIR)/is_tar.Plo
|
||||
-rm -f ./$(DEPDIR)/landlock.Po
|
||||
-rm -f ./$(DEPDIR)/magic.Plo
|
||||
-rm -f ./$(DEPDIR)/print.Plo
|
||||
-rm -f ./$(DEPDIR)/readcdf.Plo
|
||||
-rm -f ./$(DEPDIR)/readelf.Plo
|
||||
-rm -f ./$(DEPDIR)/seccomp.Po
|
||||
-rm -f ./$(DEPDIR)/softmagic.Plo
|
||||
-rm -f ./$(DEPDIR)/swap.Plo
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
@@ -820,7 +823,7 @@ install-ps-am:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(DEPDIR)/asctime_r.Plo
|
||||
-rm -f $(DEPDIR)/asctime_r.Plo
|
||||
-rm -f $(DEPDIR)/asprintf.Plo
|
||||
-rm -f $(DEPDIR)/ctime_r.Plo
|
||||
-rm -f $(DEPDIR)/dprintf.Plo
|
||||
@@ -850,12 +853,14 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/is_json.Plo
|
||||
-rm -f ./$(DEPDIR)/is_simh.Plo
|
||||
-rm -f ./$(DEPDIR)/is_tar.Plo
|
||||
-rm -f ./$(DEPDIR)/landlock.Po
|
||||
-rm -f ./$(DEPDIR)/magic.Plo
|
||||
-rm -f ./$(DEPDIR)/print.Plo
|
||||
-rm -f ./$(DEPDIR)/readcdf.Plo
|
||||
-rm -f ./$(DEPDIR)/readelf.Plo
|
||||
-rm -f ./$(DEPDIR)/seccomp.Po
|
||||
-rm -f ./$(DEPDIR)/softmagic.Plo
|
||||
-rm -f ./$(DEPDIR)/swap.Plo
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@@ -903,3 +908,10 @@ magic.h: ${HDR}
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
+51
-113
@@ -32,10 +32,11 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.369 2025/10/08 16:40:52 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.376 2026/05/09 22:44:32 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
#include "swap.h"
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@@ -50,12 +51,6 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.369 2025/10/08 16:40:52 christos Exp $")
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_BSWAP_H
|
||||
#include <sys/bswap.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define EATAB {while (*l && isascii(CAST(unsigned char, *l)) && \
|
||||
@@ -117,7 +112,7 @@ file_private int hextoint(int);
|
||||
file_private const char *getstr(struct magic_set *, struct magic *, const char *,
|
||||
int);
|
||||
file_private int parse(struct magic_set *, struct magic_entry *, const char *,
|
||||
const char *, size_t, int);
|
||||
const char *, size_t, size_t, int);
|
||||
file_private void eatsize(const char **);
|
||||
file_private int apprentice_1(struct magic_set *, const char *, int);
|
||||
file_private ssize_t apprentice_magic_strength_1(const struct magic *);
|
||||
@@ -131,20 +126,6 @@ file_private void mlist_free(struct mlist *);
|
||||
file_private void byteswap(struct magic *, uint32_t);
|
||||
file_private void bs1(struct magic *);
|
||||
|
||||
#if defined(HAVE_BYTESWAP_H)
|
||||
#define swap2(x) bswap_16(x)
|
||||
#define swap4(x) bswap_32(x)
|
||||
#define swap8(x) bswap_64(x)
|
||||
#elif defined(HAVE_SYS_BSWAP_H)
|
||||
#define swap2(x) bswap16(x)
|
||||
#define swap4(x) bswap32(x)
|
||||
#define swap8(x) bswap64(x)
|
||||
#else
|
||||
file_private uint16_t swap2(uint16_t);
|
||||
file_private uint32_t swap4(uint32_t);
|
||||
file_private uint64_t swap8(uint64_t);
|
||||
#endif
|
||||
|
||||
file_private char *mkdbname(struct magic_set *, const char *, int);
|
||||
file_private struct magic_map *apprentice_buf(struct magic_set *, struct magic *,
|
||||
size_t);
|
||||
@@ -285,6 +266,8 @@ static const struct type_tbl_s type_tbl[] = {
|
||||
{ XX("clear"), FILE_CLEAR, FILE_FMT_NONE },
|
||||
{ XX("der"), FILE_DER, FILE_FMT_STR },
|
||||
{ XX("guid"), FILE_GUID, FILE_FMT_STR },
|
||||
{ XX("leguid"), FILE_LEGUID, FILE_FMT_STR },
|
||||
{ XX("beguid"), FILE_BEGUID, FILE_FMT_STR },
|
||||
{ XX("offset"), FILE_OFFSET, FILE_FMT_QUAD },
|
||||
{ XX("bevarint"), FILE_BEVARINT, FILE_FMT_STR },
|
||||
{ XX("levarint"), FILE_LEVARINT, FILE_FMT_STR },
|
||||
@@ -926,6 +909,8 @@ typesize(int type)
|
||||
case FILE_LEVARINT:
|
||||
return 8;
|
||||
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
case FILE_GUID:
|
||||
return 16;
|
||||
|
||||
@@ -989,6 +974,8 @@ apprentice_magic_strength_1(const struct magic *m)
|
||||
case FILE_BEVARINT:
|
||||
case FILE_LEVARINT:
|
||||
case FILE_GUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
case FILE_BEID3:
|
||||
case FILE_LEID3:
|
||||
case FILE_OFFSET:
|
||||
@@ -1251,6 +1238,8 @@ set_test_type(struct magic *mstart, struct magic *m)
|
||||
case FILE_LEVARINT:
|
||||
case FILE_DER:
|
||||
case FILE_GUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
case FILE_OFFSET:
|
||||
case FILE_MSDOSDATE:
|
||||
case FILE_BEMSDOSDATE:
|
||||
@@ -1401,7 +1390,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
again:
|
||||
switch (parse(ms, &me, fn, line, lineno, action)) {
|
||||
switch (parse(ms, &me, fn, line, llen, lineno, action)) {
|
||||
case 0:
|
||||
continue;
|
||||
case 1:
|
||||
@@ -1488,12 +1477,18 @@ file_private int
|
||||
coalesce_entries(struct magic_set *ms, struct magic_entry *me, uint32_t nme,
|
||||
struct magic **ma, uint32_t *nma)
|
||||
{
|
||||
uint32_t i, mentrycount = 0;
|
||||
uint32_t i;
|
||||
size_t mentrycount = 0;
|
||||
size_t slen;
|
||||
|
||||
for (i = 0; i < nme; i++)
|
||||
mentrycount += me[i].cont_count;
|
||||
|
||||
if (mentrycount > UINT32_MAX / sizeof(**ma)) {
|
||||
file_error(ms, 0, "too many magic entries (%zu)", mentrycount);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mentrycount == 0) {
|
||||
*ma = NULL;
|
||||
*nma = 0;
|
||||
@@ -1727,6 +1722,8 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
|
||||
case FILE_CLEAR:
|
||||
case FILE_DER:
|
||||
case FILE_GUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
case FILE_OCTAL:
|
||||
break;
|
||||
default:
|
||||
@@ -1789,16 +1786,6 @@ string_modifier_check(struct magic_set *ms, struct magic *m)
|
||||
CHAR_COMPACT_OPTIONAL_WHITESPACE);
|
||||
return -1;
|
||||
}
|
||||
if ((m->str_flags & STRING_IGNORE_LOWERCASE) != 0) {
|
||||
file_magwarn(ms, "'/%c' not allowed on regex\n",
|
||||
CHAR_IGNORE_LOWERCASE);
|
||||
return -1;
|
||||
}
|
||||
if ((m->str_flags & STRING_IGNORE_UPPERCASE) != 0) {
|
||||
file_magwarn(ms, "'/%c' not allowed on regex\n",
|
||||
CHAR_IGNORE_UPPERCASE);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
file_magwarn(ms, "coding error: m->type=%d\n",
|
||||
@@ -2051,14 +2038,14 @@ out:
|
||||
*/
|
||||
file_private int
|
||||
parse(struct magic_set *ms, struct magic_entry *me, const char *file,
|
||||
const char *line, size_t lineno, int action)
|
||||
const char *line, size_t llen, size_t lineno, int action)
|
||||
{
|
||||
#ifdef ENABLE_CONDITIONALS
|
||||
static uint32_t last_cont_level = 0;
|
||||
#endif
|
||||
size_t i;
|
||||
struct magic *m;
|
||||
const char *l = line;
|
||||
const char *l = line, *el = line + llen;
|
||||
char *t;
|
||||
int op;
|
||||
uint32_t cont_level;
|
||||
@@ -2070,6 +2057,8 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *file,
|
||||
* Parse the offset.
|
||||
*/
|
||||
while (*l == '>') {
|
||||
if (l >= el)
|
||||
return -1;
|
||||
++l; /* step over */
|
||||
cont_level++;
|
||||
}
|
||||
@@ -2615,7 +2604,7 @@ parse_ext(struct magic_set *ms, struct magic_entry *me, const char *line,
|
||||
{
|
||||
return parse_extra(ms, me, line, len,
|
||||
CAST(off_t, offsetof(struct magic, ext)),
|
||||
sizeof(me->mp[me->cont_count - 1].ext), "EXTENSION", ",!+-/@?_$&~",
|
||||
sizeof(me->mp[me->cont_count - 1].ext), "EXTENSION", ",!+-/@?_$&~.",
|
||||
0);
|
||||
/* & for b&w */
|
||||
/* ~ for journal~ */
|
||||
@@ -2912,8 +2901,8 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
||||
}
|
||||
if (m->type == FILE_REGEX) {
|
||||
file_regex_t rx;
|
||||
int rc =
|
||||
file_regcomp(ms, &rx, m->value.s, REG_EXTENDED);
|
||||
int rc = file_regcomp(ms, &rx, m->value.s,
|
||||
REG_EXTENDED | REGEX_ICASE(m));
|
||||
if (rc == 0) {
|
||||
file_regfree(&rx);
|
||||
}
|
||||
@@ -2947,6 +2936,8 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
||||
if (errno == 0)
|
||||
*p = ep;
|
||||
return 0;
|
||||
case FILE_BEGUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_GUID:
|
||||
if (file_parse_guid(*p, m->value.guid) == -1) {
|
||||
file_magwarn(ms, "Error parsing guid `%s'", *p);
|
||||
@@ -3184,11 +3175,15 @@ getstr(struct magic_set *ms, struct magic *m, const char *s, int warn)
|
||||
--s;
|
||||
out:
|
||||
*p = '\0';
|
||||
if (CAST(size_t, (p - origp)) > sizeof(m->value.s))
|
||||
return NULL;
|
||||
m->vallen = CAST(unsigned char, (p - origp));
|
||||
if (m->type == FILE_PSTRING) {
|
||||
size_t l = file_pstring_length_size(ms, m);
|
||||
if (l == FILE_BADSIZE)
|
||||
return NULL;
|
||||
if (m->vallen + l > sizeof(m->value.s))
|
||||
return NULL;
|
||||
m->vallen += CAST(unsigned char, l);
|
||||
}
|
||||
return s;
|
||||
@@ -3422,7 +3417,7 @@ check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
|
||||
|
||||
ptr = CAST(uint32_t *, map->p);
|
||||
if (*ptr != MAGICNO) {
|
||||
if (swap4(*ptr) != MAGICNO) {
|
||||
if (file_swap4(*ptr) != MAGICNO) {
|
||||
file_error(ms, 0, "bad magic in `%s'", dbname);
|
||||
return -1;
|
||||
}
|
||||
@@ -3430,7 +3425,7 @@ check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
|
||||
} else
|
||||
needsbyteswap = 0;
|
||||
if (needsbyteswap)
|
||||
version = swap4(ptr[1]);
|
||||
version = file_swap4(ptr[1]);
|
||||
else
|
||||
version = ptr[1];
|
||||
if (version != VERSIONNO) {
|
||||
@@ -3443,9 +3438,14 @@ check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
|
||||
nentries = 0;
|
||||
for (i = 0; i < MAGIC_SETS; i++) {
|
||||
if (needsbyteswap)
|
||||
map->nmagic[i] = swap4(ptr[i + 2]);
|
||||
map->nmagic[i] = file_swap4(ptr[i + 2]);
|
||||
else
|
||||
map->nmagic[i] = ptr[i + 2];
|
||||
if (map->nmagic[i] > entries) {
|
||||
file_error(ms, 0, "nmagic[%u] too large in `%s'", i,
|
||||
dbname);
|
||||
return -1;
|
||||
}
|
||||
if (i != MAGIC_SETS - 1)
|
||||
map->magic[i + 1] = map->magic[i] + map->nmagic[i];
|
||||
nentries += map->nmagic[i];
|
||||
@@ -3576,69 +3576,6 @@ byteswap(struct magic *magic, uint32_t nmagic)
|
||||
bs1(&magic[i]);
|
||||
}
|
||||
|
||||
#if !defined(HAVE_BYTESWAP_H) && !defined(HAVE_SYS_BSWAP_H)
|
||||
/*
|
||||
* swap a short
|
||||
*/
|
||||
file_private uint16_t
|
||||
swap2(uint16_t sv)
|
||||
{
|
||||
uint16_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
d[0] = s[1];
|
||||
d[1] = s[0];
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* swap an int
|
||||
*/
|
||||
file_private uint32_t
|
||||
swap4(uint32_t sv)
|
||||
{
|
||||
uint32_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
d[0] = s[3];
|
||||
d[1] = s[2];
|
||||
d[2] = s[1];
|
||||
d[3] = s[0];
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* swap a quad
|
||||
*/
|
||||
file_private uint64_t
|
||||
swap8(uint64_t sv)
|
||||
{
|
||||
uint64_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
# if 0
|
||||
d[0] = s[3];
|
||||
d[1] = s[2];
|
||||
d[2] = s[1];
|
||||
d[3] = s[0];
|
||||
d[4] = s[7];
|
||||
d[5] = s[6];
|
||||
d[6] = s[5];
|
||||
d[7] = s[4];
|
||||
# else
|
||||
d[0] = s[7];
|
||||
d[1] = s[6];
|
||||
d[2] = s[5];
|
||||
d[3] = s[4];
|
||||
d[4] = s[3];
|
||||
d[5] = s[2];
|
||||
d[6] = s[1];
|
||||
d[7] = s[0];
|
||||
# endif
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
file_protected uintmax_t
|
||||
file_varint2uintmax_t(const unsigned char *us, int t, size_t *l)
|
||||
{
|
||||
@@ -3675,16 +3612,16 @@ file_varint2uintmax_t(const unsigned char *us, int t, size_t *l)
|
||||
file_private void
|
||||
bs1(struct magic *m)
|
||||
{
|
||||
m->flag = swap2(m->flag);
|
||||
m->offset = swap4(CAST(uint32_t, m->offset));
|
||||
m->in_offset = swap4(CAST(uint32_t, m->in_offset));
|
||||
m->lineno = swap4(CAST(uint32_t, m->lineno));
|
||||
m->flag = file_swap2(m->flag);
|
||||
m->offset = file_swap4(CAST(uint32_t, m->offset));
|
||||
m->in_offset = file_swap4(CAST(uint32_t, m->in_offset));
|
||||
m->lineno = file_swap4(CAST(uint32_t, m->lineno));
|
||||
if (IS_STRING(m->type)) {
|
||||
m->str_range = swap4(m->str_range);
|
||||
m->str_flags = swap4(m->str_flags);
|
||||
m->str_range = file_swap4(m->str_range);
|
||||
m->str_flags = file_swap4(m->str_flags);
|
||||
} else {
|
||||
m->value.q = swap8(m->value.q);
|
||||
m->num_mask = swap8(m->num_mask);
|
||||
m->value.q = file_swap8(m->value.q);
|
||||
m->num_mask = file_swap8(m->num_mask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3707,6 +3644,7 @@ file_pstring_length_size(struct magic_set *ms, const struct magic *m)
|
||||
return FILE_BADSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
file_protected size_t
|
||||
file_pstring_get_length(struct magic_set *ms, const struct magic *m,
|
||||
const char *ss)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.116 2023/05/21 16:08:50 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: ascmagic.c,v 1.118 2026/06/02 19:58:38 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -142,6 +142,9 @@ file_ascmagic_with_encoding(struct magic_set *ms, const struct buffer *b,
|
||||
/* Convert ubuf to UTF-8 and try text soft magic */
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
if (ulen > SIZE_MAX / 6) {
|
||||
goto done;
|
||||
}
|
||||
mlen = ulen * 6;
|
||||
if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
|
||||
file_oomem(ms, mlen);
|
||||
@@ -205,6 +208,9 @@ file_ascmagic_with_encoding(struct magic_set *ms, const struct buffer *b,
|
||||
has_backspace = 1;
|
||||
}
|
||||
|
||||
if (seen_cr && n_cr == 0 && n_crlf == 0)
|
||||
n_cr++;
|
||||
|
||||
if (strcmp(type, "binary") == 0) {
|
||||
rv = 0;
|
||||
goto done;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/*-
|
||||
* Copyright (c) 2008 Christos Zoulas
|
||||
/*- * Copyright (c) 2008 Christos Zoulas
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -35,7 +34,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.126 2026/02/09 17:10:42 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: cdf.c,v 1.129 2026/06/02 17:57:22 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@@ -491,6 +490,11 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
|
||||
}
|
||||
|
||||
sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
|
||||
#define CDF_SAT_LIMIT (16 * 1024 * 1024)
|
||||
if (ss != 0 && sat->sat_len > CDF_SAT_LIMIT / ss) {
|
||||
errno = EFTYPE;
|
||||
return -1;
|
||||
}
|
||||
DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
|
||||
sat->sat_len, ss));
|
||||
if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
|
||||
@@ -1196,6 +1200,8 @@ cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
|
||||
const uint16_t *np;
|
||||
|
||||
for (nr = 0;; nr++) {
|
||||
if (b + sizeof(reclen) > eb)
|
||||
break;
|
||||
memcpy(&reclen, b, sizeof(reclen));
|
||||
reclen = CDF_TOLE2(reclen);
|
||||
if (reclen == 0)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: cdf_time.c,v 1.25 2024/11/25 21:24:59 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: cdf_time.c,v 1.26 2026/05/09 22:08:32 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@@ -120,6 +120,9 @@ cdf_timestamp_to_timespec(struct timespec *ts, cdf_timestamp_t t)
|
||||
/* XXX: Approx */
|
||||
tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
|
||||
|
||||
if (tm.tm_year > 9999)
|
||||
goto out;
|
||||
|
||||
rdays = cdf_getdays(tm.tm_year);
|
||||
t -= rdays - 1;
|
||||
tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
|
||||
@@ -135,11 +138,12 @@ cdf_timestamp_to_timespec(struct timespec *ts, cdf_timestamp_t t)
|
||||
#endif
|
||||
tm.tm_year -= 1900;
|
||||
ts->tv_sec = mktime(&tm);
|
||||
if (ts->tv_sec == -1) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (ts->tv_sec == -1)
|
||||
goto out;
|
||||
return 0;
|
||||
out:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
file_protected int
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.158 2024/11/10 16:52:27 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: compress.c,v 1.162 2026/05/17 17:10:25 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@@ -125,12 +125,11 @@ static const char *zlib_args[] = { "python", "-c", zlibcode, NULL };
|
||||
static int
|
||||
zlibcmp(const unsigned char *buf)
|
||||
{
|
||||
unsigned short x = 1;
|
||||
unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
|
||||
unsigned short x;
|
||||
|
||||
if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
|
||||
return 0;
|
||||
if (s[0] != 1) /* endianness test */
|
||||
if (file_bigendian()) /* endianness test */
|
||||
x = buf[0] | (buf[1] << 8);
|
||||
else
|
||||
x = buf[1] | (buf[0] << 8);
|
||||
@@ -859,7 +858,7 @@ uncompresslrzip(const unsigned char *old, unsigned char **newch,
|
||||
goto out0;
|
||||
}
|
||||
lrzip_config_env(lr);
|
||||
in = fmemopen(RCAST(void *, old), bytes_max, "r");
|
||||
in = fmemopen(RCAST(void *, old), *n, "r");
|
||||
if (in == NULL) {
|
||||
res = makeerror(newch, n, "unable to construct input file");
|
||||
goto out1;
|
||||
@@ -868,6 +867,7 @@ uncompresslrzip(const unsigned char *old, unsigned char **newch,
|
||||
res = makeerror(newch, n, "unable to add input file");
|
||||
goto out2;
|
||||
}
|
||||
free(*newch);
|
||||
*newch = calloc(*n = 2 * bytes_max, 1);
|
||||
if (*newch == NULL) {
|
||||
res = makeerror(newch, n, "unable to allocate output buffer");
|
||||
@@ -1190,9 +1190,9 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, int nofork,
|
||||
|
||||
posix_spawn_file_actions_destroy(&fa);
|
||||
|
||||
if (status == -1) {
|
||||
if (status != 0) {
|
||||
return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
|
||||
compr[method].argv[0], strerror(errno));
|
||||
compr[method].argv[0], strerror(status));
|
||||
}
|
||||
#else
|
||||
/* For processes with large mapped virtual sizes, vfork
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: der.c,v 1.28 2024/11/25 22:31:53 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: der.c,v 1.29 2026/06/02 16:56:40 christos Exp $")
|
||||
#endif
|
||||
#else
|
||||
#define SIZE_T_FORMAT "z"
|
||||
@@ -150,7 +150,7 @@ gettag(const uint8_t *c, size_t *p, size_t l)
|
||||
{
|
||||
uint32_t tag;
|
||||
|
||||
if (*p >= l)
|
||||
if (c == NULL || *p >= l)
|
||||
return DER_BAD;
|
||||
|
||||
tag = c[(*p)++] & 0x1f;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.44 2024/12/26 18:41:27 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: encoding.c,v 1.45 2026/06/02 17:19:02 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -83,6 +83,8 @@ file_encoding(struct magic_set *ms, const struct buffer *b,
|
||||
file_unichar_t *udefbuf;
|
||||
size_t udeflen;
|
||||
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
if (ubuf == NULL)
|
||||
ubuf = &udefbuf;
|
||||
if (ulen == NULL)
|
||||
|
||||
+19
-4
@@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.217 2024/09/29 16:49:25 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: file.c,v 1.222 2026/05/14 18:54:27 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
|
||||
size_t i, j, wid, nw;
|
||||
int action = 0, didsomefiles = 0, errflg = 0;
|
||||
int flags = 0, e = 0;
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
#if defined(HAVE_LIBSECCOMP) || defined(HAVE_LINUX_LANDLOCK_H)
|
||||
int sandbox = 1;
|
||||
#endif
|
||||
struct magic_set *magic = NULL;
|
||||
@@ -335,6 +335,9 @@ main(int argc, char *argv[])
|
||||
magicfile);
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
(void)fprintf(stdout, "seccomp support included\n");
|
||||
#endif
|
||||
#ifdef HAVE_LINUX_LANDLOCK_H
|
||||
(void)fprintf(stdout, "Landlock support included\n");
|
||||
#endif
|
||||
return 0;
|
||||
case 'z':
|
||||
@@ -364,8 +367,13 @@ main(int argc, char *argv[])
|
||||
if (e)
|
||||
return e;
|
||||
|
||||
#ifdef HAVE_LINUX_LANDLOCK_H
|
||||
if (sandbox && enable_landlock(flags, action) == -1)
|
||||
file_err(EXIT_FAILURE, "Landlock initialisation failed");
|
||||
#endif /* HAVE_LINUX_LANDLOCK_H */
|
||||
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
if (sandbox && enable_sandbox() == -1)
|
||||
if (sandbox && enable_sandbox(flags, action) == -1)
|
||||
file_err(EXIT_FAILURE, "SECCOMP initialisation failed");
|
||||
if (sandbox)
|
||||
flags |= MAGIC_NO_COMPRESS_FORK;
|
||||
@@ -466,6 +474,8 @@ file_private void
|
||||
setparam(const char *p)
|
||||
{
|
||||
size_t i;
|
||||
ssize_t mpar;
|
||||
int par;
|
||||
char *s;
|
||||
|
||||
if ((s = CCAST(char *, strchr(p, '='))) == NULL)
|
||||
@@ -474,7 +484,12 @@ setparam(const char *p)
|
||||
for (i = 0; i < __arraycount(pm); i++) {
|
||||
if (strncmp(p, pm[i].name, s - p) != 0)
|
||||
continue;
|
||||
pm[i].value = atoi(s + 1);
|
||||
par = atoi(s + 1);
|
||||
mpar = magic_getmaxparam(pm[i].tag);
|
||||
if (par < 0 || par > mpar)
|
||||
file_err(EXIT_FAILURE, "Out of bounds value %d for %s",
|
||||
par, pm[i].name);
|
||||
pm[i].value = par;
|
||||
pm[i].set = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
+24
-15
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
/*
|
||||
* file.h - definitions for file(1) program
|
||||
* @(#)$File: file.h,v 1.262 2025/07/23 18:52:08 christos Exp $
|
||||
* @(#)$File: file.h,v 1.267 2026/05/17 17:10:25 christos Exp $
|
||||
*/
|
||||
|
||||
#ifndef __file_h__
|
||||
@@ -179,7 +179,7 @@
|
||||
#define MAXstring 128 /* max len of "string" types */
|
||||
|
||||
#define MAGICNO 0xF11E041C
|
||||
#define VERSIONNO 20
|
||||
#define VERSIONNO 21
|
||||
#define FILE_MAGICSIZE 432
|
||||
|
||||
#define FILE_GUID_SIZE sizeof("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
|
||||
@@ -292,17 +292,19 @@ struct magic {
|
||||
#define FILE_CLEAR 47
|
||||
#define FILE_DER 48
|
||||
#define FILE_GUID 49
|
||||
#define FILE_OFFSET 50
|
||||
#define FILE_BEVARINT 51
|
||||
#define FILE_LEVARINT 52
|
||||
#define FILE_MSDOSDATE 53
|
||||
#define FILE_LEMSDOSDATE 54
|
||||
#define FILE_BEMSDOSDATE 55
|
||||
#define FILE_MSDOSTIME 56
|
||||
#define FILE_LEMSDOSTIME 57
|
||||
#define FILE_BEMSDOSTIME 58
|
||||
#define FILE_OCTAL 59
|
||||
#define FILE_NAMES_SIZE 60 /* size of array to contain all names */
|
||||
#define FILE_LEGUID 50
|
||||
#define FILE_BEGUID 51
|
||||
#define FILE_OFFSET 52
|
||||
#define FILE_BEVARINT 53
|
||||
#define FILE_LEVARINT 54
|
||||
#define FILE_MSDOSDATE 55
|
||||
#define FILE_LEMSDOSDATE 56
|
||||
#define FILE_BEMSDOSDATE 57
|
||||
#define FILE_MSDOSTIME 58
|
||||
#define FILE_LEMSDOSTIME 59
|
||||
#define FILE_BEMSDOSTIME 60
|
||||
#define FILE_OCTAL 61
|
||||
#define FILE_NAMES_SIZE 62 /* size of array to contain all names */
|
||||
|
||||
#define IS_STRING(t) \
|
||||
((t) == FILE_STRING || \
|
||||
@@ -427,6 +429,7 @@ struct magic {
|
||||
#define CHAR_PSTRING_4_LE 'l'
|
||||
#define CHAR_PSTRING_LENGTH_INCLUDES_ITSELF 'J'
|
||||
#define STRING_IGNORE_CASE (STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
|
||||
#define REGEX_ICASE(m) (((m)->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0)
|
||||
#define STRING_DEFAULT_RANGE 100
|
||||
|
||||
#define INDIRECT_RELATIVE BIT(0)
|
||||
@@ -557,7 +560,8 @@ file_protected int file_separator(struct magic_set *);
|
||||
file_protected char *file_copystr(char *, size_t, size_t, const char *);
|
||||
file_protected int file_checkfmt(char *, size_t, const char *);
|
||||
file_protected size_t file_printedlen(const struct magic_set *);
|
||||
file_protected int file_print_guid(char *, size_t, const uint64_t *);
|
||||
file_protected int file_print_leguid(char *, size_t, const uint64_t *);
|
||||
file_protected int file_print_beguid(char *, size_t, const uint64_t *);
|
||||
file_protected int file_parse_guid(const char *, uint64_t *);
|
||||
file_protected int file_replace(struct magic_set *, const char *, const char *);
|
||||
file_protected int file_printf(struct magic_set *, const char *, ...)
|
||||
@@ -593,6 +597,7 @@ file_protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
file_protected uintmax_t file_varint2uintmax_t(const unsigned char *, int,
|
||||
size_t *);
|
||||
|
||||
file_protected int file_bigendian(void);
|
||||
file_protected void file_badread(struct magic_set *);
|
||||
file_protected void file_badseek(struct magic_set *);
|
||||
file_protected void file_oomem(struct magic_set *, size_t);
|
||||
@@ -697,7 +702,11 @@ const char *fmtcheck(const char *, const char *)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSECCOMP
|
||||
int enable_sandbox(void);
|
||||
int enable_sandbox(int, int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_LANDLOCK_H
|
||||
int enable_landlock(int, int);
|
||||
#endif
|
||||
|
||||
file_protected const char *file_getprogname(void);
|
||||
|
||||
+62
-21
@@ -27,10 +27,11 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.148 2026/01/10 16:18:18 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: funcs.c,v 1.153 2026/05/25 14:07:05 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
#include "swap.h"
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
@@ -51,6 +52,18 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.148 2026/01/10 16:18:18 christos Exp $")
|
||||
#define SIZE_MAX ((size_t)~0)
|
||||
#endif
|
||||
|
||||
file_protected int
|
||||
file_bigendian(void)
|
||||
{
|
||||
union {
|
||||
unsigned short x;
|
||||
unsigned char s[sizeof(unsigned short)];
|
||||
} u;
|
||||
|
||||
u.x = 1;
|
||||
return u.s[0] != 1;
|
||||
}
|
||||
|
||||
file_protected char *
|
||||
file_copystr(char *buf, size_t blen, size_t width, const char *str)
|
||||
{
|
||||
@@ -77,8 +90,11 @@ file_checkfield(char *msg, size_t mlen, const char *what, const char **pp)
|
||||
const char *p = *pp;
|
||||
int fw = 0;
|
||||
|
||||
while (*p && isdigit((unsigned char)*p))
|
||||
while (*p && isdigit((unsigned char)*p)) {
|
||||
fw = fw * 10 + (*p++ - '0');
|
||||
if (fw > 1024)
|
||||
break;
|
||||
}
|
||||
|
||||
*pp = p;
|
||||
|
||||
@@ -653,24 +669,23 @@ file_protected int
|
||||
file_replace(struct magic_set *ms, const char *pat, const char *rep)
|
||||
{
|
||||
file_regex_t rx;
|
||||
int rc, rv = -1;
|
||||
int nm;
|
||||
regmatch_t rm;
|
||||
|
||||
rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
|
||||
if (rc == 0) {
|
||||
regmatch_t rm;
|
||||
int nm = 0;
|
||||
while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
|
||||
ms->o.buf[rm.rm_so] = '\0';
|
||||
if (file_printf(ms, "%s%s", rep,
|
||||
rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
|
||||
goto out;
|
||||
nm++;
|
||||
}
|
||||
rv = nm;
|
||||
nm = file_regcomp(ms, &rx, pat, REG_EXTENDED);
|
||||
if (nm != 0)
|
||||
return -1;
|
||||
|
||||
while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
|
||||
ms->o.buf[rm.rm_so] = '\0';
|
||||
if (file_printf(ms, "%s%s", rep,
|
||||
rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
|
||||
goto out;
|
||||
nm++;
|
||||
}
|
||||
out:
|
||||
file_regfree(&rx);
|
||||
return rv;
|
||||
return nm;
|
||||
}
|
||||
|
||||
file_private int
|
||||
@@ -931,15 +946,19 @@ file_parse_guid(const char *s, uint64_t *guid)
|
||||
!getxvalue(&g->data4[6], s + 8, 2) ||
|
||||
!getxvalue(&g->data4[7], s + 10, 2))
|
||||
return -1;
|
||||
|
||||
if (file_bigendian()) {
|
||||
g->data1 = file_swap4(g->data1);
|
||||
g->data2 = file_swap2(g->data2);
|
||||
g->data3 = file_swap2(g->data3);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_protected int
|
||||
file_print_guid(char *str, size_t len, const uint64_t *guid)
|
||||
file_private int
|
||||
file_print_guid(char *str, size_t len, const struct guid *g)
|
||||
{
|
||||
const struct guid *g = CAST(const struct guid *,
|
||||
CAST(const void *, guid));
|
||||
|
||||
#ifndef WIN32
|
||||
return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
|
||||
"%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
|
||||
@@ -955,6 +974,26 @@ file_print_guid(char *str, size_t len, const uint64_t *guid)
|
||||
#endif
|
||||
}
|
||||
|
||||
file_protected int
|
||||
file_print_leguid(char *str, size_t len, const uint64_t *guid)
|
||||
{
|
||||
const struct guid *g = CAST(const struct guid *,
|
||||
CAST(const void *, guid));
|
||||
return file_print_guid(str, len, g);
|
||||
}
|
||||
|
||||
file_protected int
|
||||
file_print_beguid(char *str, size_t len, const uint64_t *guid)
|
||||
{
|
||||
const struct guid *g = CAST(const struct guid *,
|
||||
CAST(const void *, guid));
|
||||
struct guid gg = *g;
|
||||
gg.data1 = file_swap4(gg.data1);
|
||||
gg.data2 = file_swap2(gg.data2);
|
||||
gg.data3 = file_swap2(gg.data3);
|
||||
return file_print_guid(str, len, &gg);
|
||||
}
|
||||
|
||||
file_protected int
|
||||
file_pipe_closexec(int *fds)
|
||||
{
|
||||
@@ -992,6 +1031,8 @@ file_strtrim(char *str)
|
||||
last = str;
|
||||
while (*last)
|
||||
last++;
|
||||
if (last == str)
|
||||
return str;
|
||||
--last;
|
||||
while (isspace(CAST(unsigned char, *last)))
|
||||
last--;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: is_csv.c,v 1.15 2024/05/18 15:16:13 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: is_csv.c,v 1.16 2026/06/02 17:50:54 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@@ -104,7 +104,7 @@ csv_parse(const unsigned char *uc, const unsigned char *ue)
|
||||
nf++;
|
||||
break;
|
||||
case '\n':
|
||||
DPRINTF("%zu %zu %zu\n", nl, nf, tf);
|
||||
DPRINTF("nl=%zu nf=%zu tf=%zu\n", nl, nf, tf);
|
||||
nl++;
|
||||
#if CSV_LINES
|
||||
if (nl == CSV_LINES)
|
||||
@@ -126,7 +126,8 @@ csv_parse(const unsigned char *uc, const unsigned char *ue)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tf > 1 && nl >= 2;
|
||||
DPRINTF("tf=%zu>1 nl=%zu>=2\n", tf, nl);
|
||||
return tf >= 1 && nl >= 2;
|
||||
}
|
||||
|
||||
#ifndef TEST
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.50 2022/12/26 17:31:14 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: is_tar.c,v 1.51 2026/06/02 17:05:51 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
@@ -158,14 +158,12 @@ from_oct(const char *where, size_t digs)
|
||||
{
|
||||
int value;
|
||||
|
||||
if (digs == 0)
|
||||
return -1;
|
||||
|
||||
while (isspace(CAST(unsigned char, *where))) { /* Skip spaces */
|
||||
while (digs > 0 && isspace(CAST(unsigned char, *where))) { /* Skip spaces */
|
||||
where++;
|
||||
if (digs-- == 0)
|
||||
return -1; /* All blank field */
|
||||
digs--;
|
||||
}
|
||||
if (digs == 0)
|
||||
return -1; /* All blank field */
|
||||
value = 0;
|
||||
while (digs > 0 && isodigit(*where)) { /* Scan til non-octal */
|
||||
value = (value << 3) | (*where++ - '0');
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* Landlock sandbox: read anywhere, write only in $TMPDIR. */
|
||||
#include "file.h"
|
||||
|
||||
#if HAVE_LINUX_LANDLOCK_H
|
||||
#include "magic.h"
|
||||
#include <linux/landlock.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* glibc only got Landlock wrappers in 2.40, so call via syscall(2). */
|
||||
#ifndef landlock_create_ruleset
|
||||
static inline int
|
||||
landlock_create_ruleset(const struct landlock_ruleset_attr *attr,
|
||||
size_t size, uint32_t flags)
|
||||
{
|
||||
return CAST(int, syscall(__NR_landlock_create_ruleset, attr, size,
|
||||
flags));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef landlock_add_rule
|
||||
static inline int
|
||||
landlock_add_rule(int ruleset_fd, enum landlock_rule_type rule_type,
|
||||
const void *rule_attr, uint32_t flags)
|
||||
{
|
||||
return CAST(int, syscall(__NR_landlock_add_rule, ruleset_fd,
|
||||
rule_type, rule_attr, flags));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef landlock_restrict_self
|
||||
static inline int
|
||||
landlock_restrict_self(int ruleset_fd, uint32_t flags)
|
||||
{
|
||||
return CAST(int, syscall(__NR_landlock_restrict_self, ruleset_fd,
|
||||
flags));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* A missing path (e.g. unset $TMPDIR) is not fatal, just skipped. */
|
||||
static int
|
||||
landlock_allow_path(int ruleset_fd, const char *path, uint64_t allowed)
|
||||
{
|
||||
struct landlock_path_beneath_attr pb;
|
||||
int rv;
|
||||
|
||||
pb.allowed_access = allowed;
|
||||
pb.parent_fd = open(path, O_PATH | O_CLOEXEC);
|
||||
if (pb.parent_fd == -1)
|
||||
return errno == ENOENT ? 0 : -1;
|
||||
rv = landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, &pb, 0);
|
||||
(void)close(pb.parent_fd);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
enable_landlock(int flags, int action)
|
||||
{
|
||||
struct landlock_ruleset_attr attr;
|
||||
struct stat sb;
|
||||
int ruleset_fd, abi, needs_write;
|
||||
const char *tmpdir;
|
||||
|
||||
(void)flags;
|
||||
|
||||
/* Magic build modes write outside /tmp; just skip Landlock
|
||||
for those. seccomp still applies. */
|
||||
if (action == FILE_COMPILE || action == FILE_CHECK ||
|
||||
action == FILE_LIST)
|
||||
return 0;
|
||||
|
||||
/* Pipe input gets copied to a tempfile in /tmp. */
|
||||
needs_write = fstat(STDIN_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode);
|
||||
|
||||
abi = CAST(int, syscall(__NR_landlock_create_ruleset, NULL, 0,
|
||||
LANDLOCK_CREATE_RULESET_VERSION));
|
||||
if (abi < 1)
|
||||
return 0;
|
||||
|
||||
(void)memset(&attr, 0, sizeof(attr));
|
||||
attr.handled_access_fs =
|
||||
LANDLOCK_ACCESS_FS_EXECUTE |
|
||||
LANDLOCK_ACCESS_FS_WRITE_FILE |
|
||||
LANDLOCK_ACCESS_FS_READ_FILE |
|
||||
LANDLOCK_ACCESS_FS_READ_DIR |
|
||||
LANDLOCK_ACCESS_FS_REMOVE_DIR |
|
||||
LANDLOCK_ACCESS_FS_REMOVE_FILE |
|
||||
LANDLOCK_ACCESS_FS_MAKE_CHAR |
|
||||
LANDLOCK_ACCESS_FS_MAKE_DIR |
|
||||
LANDLOCK_ACCESS_FS_MAKE_REG |
|
||||
LANDLOCK_ACCESS_FS_MAKE_SOCK |
|
||||
LANDLOCK_ACCESS_FS_MAKE_FIFO |
|
||||
LANDLOCK_ACCESS_FS_MAKE_BLOCK |
|
||||
LANDLOCK_ACCESS_FS_MAKE_SYM;
|
||||
#ifdef LANDLOCK_ACCESS_FS_REFER
|
||||
if (abi >= 2)
|
||||
attr.handled_access_fs |= LANDLOCK_ACCESS_FS_REFER;
|
||||
#endif
|
||||
#ifdef LANDLOCK_ACCESS_FS_TRUNCATE
|
||||
if (abi >= 3)
|
||||
attr.handled_access_fs |= LANDLOCK_ACCESS_FS_TRUNCATE;
|
||||
#endif
|
||||
#ifdef LANDLOCK_ACCESS_NET_BIND_TCP
|
||||
if (abi >= 4) {
|
||||
attr.handled_access_net =
|
||||
LANDLOCK_ACCESS_NET_BIND_TCP |
|
||||
LANDLOCK_ACCESS_NET_CONNECT_TCP;
|
||||
}
|
||||
#endif
|
||||
|
||||
ruleset_fd = landlock_create_ruleset(&attr, sizeof(attr), 0);
|
||||
if (ruleset_fd == -1)
|
||||
return -1;
|
||||
|
||||
if (landlock_allow_path(ruleset_fd, "/",
|
||||
LANDLOCK_ACCESS_FS_READ_FILE | LANDLOCK_ACCESS_FS_READ_DIR) == -1)
|
||||
goto fail;
|
||||
|
||||
if (needs_write) {
|
||||
uint64_t tmp_access =
|
||||
LANDLOCK_ACCESS_FS_READ_FILE |
|
||||
LANDLOCK_ACCESS_FS_READ_DIR |
|
||||
LANDLOCK_ACCESS_FS_WRITE_FILE |
|
||||
LANDLOCK_ACCESS_FS_MAKE_REG |
|
||||
LANDLOCK_ACCESS_FS_REMOVE_FILE;
|
||||
#ifdef LANDLOCK_ACCESS_FS_TRUNCATE
|
||||
if (abi >= 3)
|
||||
tmp_access |= LANDLOCK_ACCESS_FS_TRUNCATE;
|
||||
#endif
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (tmpdir == NULL || *tmpdir == '\0')
|
||||
tmpdir = "/tmp";
|
||||
if (landlock_allow_path(ruleset_fd, tmpdir, tmp_access) == -1)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
|
||||
goto fail;
|
||||
if (landlock_restrict_self(ruleset_fd, 0) == -1)
|
||||
goto fail;
|
||||
|
||||
(void)close(ruleset_fd);
|
||||
return 0;
|
||||
fail:
|
||||
(void)close(ruleset_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LINUX_LANDLOCK_H */
|
||||
+37
-10
@@ -33,7 +33,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: magic.c,v 1.125 2026/01/19 18:53:58 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: magic.c,v 1.128 2026/05/09 22:34:30 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -72,7 +72,7 @@ FILE_RCSID("@(#)$File: magic.c,v 1.125 2026/01/19 18:53:58 christos Exp $")
|
||||
file_private void close_and_restore(const struct magic_set *, const char *, int,
|
||||
const struct stat *);
|
||||
file_private int unreadable_info(struct magic_set *, mode_t, const char *);
|
||||
file_private const char* get_default_magic(void);
|
||||
file_private const char *get_default_magic(void);
|
||||
#ifndef COMPILE_ONLY
|
||||
file_private const char *file_or_fd(struct magic_set *, const char *, int);
|
||||
#endif
|
||||
@@ -176,15 +176,11 @@ get_default_magic(void)
|
||||
{
|
||||
static const char hmagic[] = "/.magic/magic.mgc";
|
||||
static char *default_magic;
|
||||
char *home, *hmagicpath;
|
||||
char *home, *hmagicpath, *tmp_magic;
|
||||
|
||||
#ifndef WIN32
|
||||
struct stat st;
|
||||
|
||||
if (default_magic) {
|
||||
free(default_magic);
|
||||
default_magic = NULL;
|
||||
}
|
||||
if ((home = getenv("HOME")) == NULL)
|
||||
return MAGIC;
|
||||
|
||||
@@ -205,9 +201,12 @@ get_default_magic(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (asprintf(&default_magic, "%s%c%s", hmagicpath, PATHSEP, MAGIC) < 0)
|
||||
if (asprintf(&tmp_magic, "%s%c%s", hmagicpath, PATHSEP, MAGIC) < 0)
|
||||
goto out;
|
||||
free(hmagicpath);
|
||||
hmagicpath = default_magic;
|
||||
default_magic = tmp_magic;
|
||||
free(hmagicpath);
|
||||
return default_magic;
|
||||
out:
|
||||
default_magic = NULL;
|
||||
@@ -245,7 +244,9 @@ out:
|
||||
_w32_get_magic_relative_to(&hmagicpath, _w32_dll_instance);
|
||||
|
||||
/* Avoid MAGIC constant - it likely points to a file within MSys tree */
|
||||
tmp_magic = default_magic;
|
||||
default_magic = hmagicpath;
|
||||
free(tmp_magic);
|
||||
return default_magic;
|
||||
#endif
|
||||
}
|
||||
@@ -609,11 +610,35 @@ magic_version(void)
|
||||
return MAGIC_VERSION;
|
||||
}
|
||||
|
||||
file_public ssize_t
|
||||
magic_getmaxparam(int param)
|
||||
{
|
||||
switch (param) {
|
||||
case MAGIC_PARAM_INDIR_MAX:
|
||||
case MAGIC_PARAM_NAME_MAX:
|
||||
case MAGIC_PARAM_ELF_PHNUM_MAX:
|
||||
case MAGIC_PARAM_ELF_SHNUM_MAX:
|
||||
case MAGIC_PARAM_ELF_SHSIZE_MAX:
|
||||
case MAGIC_PARAM_ELF_NOTES_MAX:
|
||||
case MAGIC_PARAM_REGEX_MAX:
|
||||
return 0xffff;
|
||||
case MAGIC_PARAM_BYTES_MAX:
|
||||
case MAGIC_PARAM_ENCODING_MAX:
|
||||
case MAGIC_PARAM_MAGWARN_MAX:
|
||||
return 0x7fffffff;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
file_public int
|
||||
magic_setparam(struct magic_set *ms, int param, const void *val)
|
||||
{
|
||||
if (ms == NULL)
|
||||
if (ms == NULL || val == NULL) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
const size_t v = *CAST(const size_t *, val);
|
||||
switch (param) {
|
||||
case MAGIC_PARAM_INDIR_MAX:
|
||||
@@ -655,8 +680,10 @@ magic_setparam(struct magic_set *ms, int param, const void *val)
|
||||
file_public int
|
||||
magic_getparam(struct magic_set *ms, int param, void *val)
|
||||
{
|
||||
if (ms == NULL)
|
||||
if (ms == NULL || val == NULL) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
switch (param) {
|
||||
case MAGIC_PARAM_INDIR_MAX:
|
||||
*CAST(size_t *, val) = ms->indir_max;
|
||||
|
||||
@@ -159,6 +159,7 @@ int magic_errno(magic_t);
|
||||
|
||||
int magic_setparam(magic_t, int, const void *);
|
||||
int magic_getparam(magic_t, int, void *);
|
||||
ssize_t magic_getmaxparam(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: print.c,v 1.110 2025/03/20 17:46:50 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: print.c,v 1.111 2026/04/19 19:56:49 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include <string.h>
|
||||
@@ -227,12 +227,17 @@ file_mdump(struct magic *m)
|
||||
case FILE_DER:
|
||||
(void) fprintf(stderr, "'%s'", m->value.s);
|
||||
break;
|
||||
case FILE_LEGUID:
|
||||
case FILE_GUID:
|
||||
(void) file_print_guid(tbuf, sizeof(tbuf),
|
||||
(void) file_print_leguid(tbuf, sizeof(tbuf),
|
||||
m->value.guid);
|
||||
(void) fprintf(stderr, "%s", tbuf);
|
||||
break;
|
||||
case FILE_BEGUID:
|
||||
(void) file_print_beguid(tbuf, sizeof(tbuf),
|
||||
m->value.guid);
|
||||
(void) fprintf(stderr, "%s", tbuf);
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf(stderr, "*bad type %d*", m->type);
|
||||
break;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.81 2026/02/04 14:56:28 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readcdf.c,v 1.82 2026/06/02 17:33:48 christos Exp $")
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
@@ -77,7 +77,7 @@ static const struct cv {
|
||||
} clsid2mime[] = {
|
||||
{
|
||||
{ 0x00000000000c1084ULL, 0x46000000000000c0ULL },
|
||||
"x-msi",
|
||||
"vnd.ms-msi",
|
||||
},
|
||||
{ { 0, 0 },
|
||||
NULL,
|
||||
@@ -85,7 +85,7 @@ static const struct cv {
|
||||
}, clsid2desc[] = {
|
||||
{
|
||||
{ 0x00000000000c1084ULL, 0x46000000000000c0ULL },
|
||||
"MSI Installer",
|
||||
"Microsoft Installer",
|
||||
},
|
||||
{ { 0, 0 },
|
||||
NULL,
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.204 2025/06/27 16:57:44 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: readelf.c,v 1.206 2026/04/24 19:14:02 christos Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef BUILTIN_ELF
|
||||
@@ -882,9 +882,11 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
argoff = 4 + 4 + 17;
|
||||
else
|
||||
argoff = 4 + 4 + 8 + 17;
|
||||
if (elf_printf(ms, ", from '%.80s'", nbuf + doff +
|
||||
argoff) == -1)
|
||||
return -1;
|
||||
if (doff + argoff + 81 <= size) {
|
||||
if (elf_printf(ms, ", from '%.80s'",
|
||||
nbuf + doff + argoff) == -1)
|
||||
return -1;
|
||||
}
|
||||
pidoff = argoff + 81 + 2;
|
||||
if (doff + pidoff + 4 <= size) {
|
||||
if (elf_printf(ms, ", pid=%u",
|
||||
@@ -1839,7 +1841,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
|
||||
continue;
|
||||
if (bufsize && nbuf[0]) {
|
||||
nbuf[bufsize - 1] = '\0';
|
||||
str = CAST(const char *, nbuf);
|
||||
str = RCAST(const char *, nbuf);
|
||||
} else
|
||||
str = "*empty*";
|
||||
strlcpy(interp, str, sizeof(interp));
|
||||
|
||||
+66
-10
@@ -27,10 +27,11 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: seccomp.c,v 1.36 2026/02/06 14:04:20 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: seccomp.c,v 1.37 2026/05/11 16:06:03 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#if HAVE_LIBSECCOMP
|
||||
#include "magic.h"
|
||||
#include <seccomp.h> /* libseccomp */
|
||||
#include <sys/prctl.h> /* prctl */
|
||||
#include <sys/socket.h>
|
||||
@@ -40,6 +41,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.36 2026/02/06 14:04:20 christos Exp $")
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define DENY_RULE(call) \
|
||||
do \
|
||||
@@ -51,6 +53,12 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.36 2026/02/06 14:04:20 christos Exp $")
|
||||
if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(call), 0) == -1) \
|
||||
goto out; \
|
||||
while (/*CONSTCOND*/0)
|
||||
/* ENOSYS makes glibc try an older syscall instead of dying. */
|
||||
#define ERRNO_RULE(call) \
|
||||
do \
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(ENOSYS), SCMP_SYS(call), 0) \
|
||||
== -1) goto out; \
|
||||
while (/*CONSTCOND*/0)
|
||||
|
||||
#define ALLOW_IOCTL_RULE(param) \
|
||||
do \
|
||||
@@ -63,11 +71,19 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.36 2026/02/06 14:04:20 christos Exp $")
|
||||
static scmp_filter_ctx ctx;
|
||||
|
||||
int
|
||||
enable_sandbox(void)
|
||||
enable_sandbox(int flags, int action)
|
||||
{
|
||||
struct stat sb;
|
||||
int needs_write;
|
||||
|
||||
/* Writes are needed when building the magic file (-C, -c, -l)
|
||||
or when stdin is a pipe and we copy it to a tempfile. */
|
||||
needs_write = (action == FILE_COMPILE || action == FILE_CHECK ||
|
||||
action == FILE_LIST);
|
||||
if (!needs_write && fstat(STDIN_FILENO, &sb) == 0 &&
|
||||
S_ISFIFO(sb.st_mode))
|
||||
needs_write = 1;
|
||||
|
||||
// prevent child processes from getting more priv e.g. via setuid,
|
||||
// capabilities, ...
|
||||
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) == -1)
|
||||
return -1;
|
||||
|
||||
@@ -76,7 +92,6 @@ enable_sandbox(void)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
// initialize the filter
|
||||
ctx = seccomp_init(SCMP_ACT_KILL);
|
||||
if (ctx == NULL)
|
||||
return -1;
|
||||
@@ -138,8 +153,31 @@ enable_sandbox(void)
|
||||
#ifdef __NR_newfstatat
|
||||
ALLOW_RULE(newfstatat);
|
||||
#endif
|
||||
ALLOW_RULE(open);
|
||||
ALLOW_RULE(openat);
|
||||
|
||||
/* Read-only opens are always fine. Writes are allowed when we
|
||||
need them, otherwise return EACCES instead of killing. */
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) == -1)
|
||||
goto out;
|
||||
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 1,
|
||||
SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY | O_RDWR, 0)) == -1)
|
||||
goto out;
|
||||
{
|
||||
uint32_t act = needs_write ? SCMP_ACT_ALLOW
|
||||
: SCMP_ACT_ERRNO(EACCES);
|
||||
if (seccomp_rule_add(ctx, act, SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_WRONLY, O_WRONLY)) == -1)
|
||||
goto out;
|
||||
if (seccomp_rule_add(ctx, act, SCMP_SYS(open), 1,
|
||||
SCMP_CMP(1, SCMP_CMP_MASKED_EQ, O_RDWR, O_RDWR)) == -1)
|
||||
goto out;
|
||||
if (seccomp_rule_add(ctx, act, SCMP_SYS(openat), 1,
|
||||
SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_WRONLY, O_WRONLY)) == -1)
|
||||
goto out;
|
||||
if (seccomp_rule_add(ctx, act, SCMP_SYS(openat), 1,
|
||||
SCMP_CMP(2, SCMP_CMP_MASKED_EQ, O_RDWR, O_RDWR)) == -1)
|
||||
goto out;
|
||||
}
|
||||
ALLOW_RULE(pread64);
|
||||
ALLOW_RULE(read);
|
||||
ALLOW_RULE(readlink);
|
||||
@@ -155,12 +193,30 @@ enable_sandbox(void)
|
||||
ALLOW_RULE(statx);
|
||||
ALLOW_RULE(stat64);
|
||||
ALLOW_RULE(sysinfo);
|
||||
ALLOW_RULE(umask); // Used in file_pipe2file()
|
||||
ALLOW_RULE(unlink);
|
||||
ALLOW_RULE(utimes);
|
||||
if (needs_write) {
|
||||
ALLOW_RULE(umask); /* used in file_pipe2file() */
|
||||
ALLOW_RULE(unlinkat); /* used in file_pipe2file() */
|
||||
#ifdef __NR_unlink
|
||||
ALLOW_RULE(unlink);
|
||||
#endif
|
||||
}
|
||||
if (flags & MAGIC_PRESERVE_ATIME) {
|
||||
/* glibc 2.28+ uses utimes() via utimensat. */
|
||||
ALLOW_RULE(utimensat);
|
||||
#ifdef __NR_utimes
|
||||
ALLOW_RULE(utimes);
|
||||
#endif
|
||||
}
|
||||
/* Always allow writes. The kernel checks the fd, and restricting
|
||||
here would just break stdout/stderr and the tempfile. */
|
||||
ALLOW_RULE(write);
|
||||
ALLOW_RULE(writev);
|
||||
|
||||
/* Newer variants we don't use. ENOSYS lets glibc fall back. */
|
||||
ERRNO_RULE(openat2);
|
||||
ERRNO_RULE(faccessat2);
|
||||
ERRNO_RULE(close_range);
|
||||
|
||||
|
||||
#if 0
|
||||
// needed by valgrind
|
||||
|
||||
+115
-77
@@ -32,7 +32,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.359 2025/06/08 14:42:11 christos Exp $")
|
||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.370 2026/06/02 17:16:59 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -49,15 +49,15 @@ file_private int match(struct magic_set *, struct magic *, file_regex_t **, size
|
||||
const struct buffer *, size_t, int, int, int, uint16_t *,
|
||||
uint16_t *, int *, int *, int *, int *, int *);
|
||||
file_private int mget(struct magic_set *, struct magic *, const struct buffer *,
|
||||
const unsigned char *, size_t,
|
||||
size_t, unsigned int, int, int, int, uint16_t *,
|
||||
const struct buffer *, size_t, unsigned int, int, int, int, uint16_t *,
|
||||
uint16_t *, int *, int *, int *, int *, int *);
|
||||
file_private int msetoffset(struct magic_set *, struct magic *, struct buffer *,
|
||||
const struct buffer *, size_t, unsigned int);
|
||||
file_private int magiccheck(struct magic_set *, struct magic *, file_regex_t **);
|
||||
file_private int magiccheck(struct magic_set *, struct magic *,
|
||||
file_regex_t **);
|
||||
file_private int mprint(struct magic_set *, struct magic *);
|
||||
file_private int moffset(struct magic_set *, struct magic *,
|
||||
const struct buffer *, size_t, int32_t *);
|
||||
size_t, size_t, int32_t *);
|
||||
file_private void mdebug(uint32_t, const char *, size_t);
|
||||
file_private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
|
||||
const unsigned char *, uint32_t, size_t, struct magic *);
|
||||
@@ -69,7 +69,6 @@ file_private int cvt_16(union VALUETYPE *, const struct magic *);
|
||||
file_private int cvt_32(union VALUETYPE *, const struct magic *);
|
||||
file_private int cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
#define OFFSET_OOB(n, o, i) ((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
|
||||
#define BE64(p) ( \
|
||||
(CAST(uint64_t, (p)[0])<<56)| \
|
||||
(CAST(uint64_t, (p)[1])<<48)| \
|
||||
@@ -110,6 +109,16 @@ file_private int cvt_64(union VALUETYPE *, const struct magic *);
|
||||
CAST(intmax_t, CAST(int##v##_t, p)) : \
|
||||
CAST(intmax_t, CAST(uint##v##_t, p)))
|
||||
|
||||
static inline int
|
||||
offset_oob(size_t n, intmax_t o, size_t i)
|
||||
{
|
||||
if (o < 0)
|
||||
return 1;
|
||||
if ((uintmax_t)o > n)
|
||||
return 1;
|
||||
return i > n - (uintmax_t)o;
|
||||
}
|
||||
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -218,6 +227,7 @@ match(struct magic_set *ms, struct magic *magic, file_regex_t **magic_rxcomp,
|
||||
struct buffer bb;
|
||||
int print = (ms->flags & MAGIC_NODESC) == 0;
|
||||
|
||||
(void)memset(&bb, 0, sizeof(bb));
|
||||
/*
|
||||
* returnval can be 0 if a match is found, but there was no
|
||||
* annotation to be printed.
|
||||
@@ -244,19 +254,23 @@ match(struct magic_set *ms, struct magic *magic, file_regex_t **magic_rxcomp,
|
||||
flush:
|
||||
/* Skip sub-tests */
|
||||
while (magindex < nmagic - 1 &&
|
||||
magic[magindex + 1].cont_level != 0)
|
||||
magic[magindex + 1].cont_level != 0) {
|
||||
magindex++;
|
||||
}
|
||||
cont_level = 0;
|
||||
continue; /* Skip to next top-level test*/
|
||||
}
|
||||
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
|
||||
goto flush;
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1) {
|
||||
if (b->elen == FILE_BADSIZE)
|
||||
continue;
|
||||
else
|
||||
goto flush;
|
||||
}
|
||||
ms->line = m->lineno;
|
||||
|
||||
/* if main entry matches, print it... */
|
||||
switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
|
||||
bb.flen, offset, cont_level,
|
||||
switch (mget(ms, m, b, &bb, offset, cont_level,
|
||||
mode, text, flip, indir_count, name_count,
|
||||
printed_something, need_separator, firstline, returnval,
|
||||
found_match))
|
||||
@@ -319,7 +333,8 @@ flush:
|
||||
}
|
||||
}
|
||||
|
||||
switch (moffset(ms, m, &bb, offset, &ms->c.li[cont_level].off)) {
|
||||
switch (moffset(ms, m, bb.flen, offset,
|
||||
&ms->c.li[cont_level].off)) {
|
||||
case -1:
|
||||
case 0:
|
||||
goto flush;
|
||||
@@ -346,8 +361,13 @@ flush:
|
||||
*/
|
||||
cont_level = m->cont_level;
|
||||
}
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
|
||||
goto flush;
|
||||
if (msetoffset(ms, m, &bb, b, offset, cont_level)
|
||||
== -1) {
|
||||
if (b->elen == FILE_BADSIZE)
|
||||
continue;
|
||||
else
|
||||
goto flush;
|
||||
}
|
||||
if (m->flag & OFFADD) {
|
||||
if (cont_level == 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
@@ -367,8 +387,7 @@ flush:
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
switch (mget(ms, m, b, CAST(const unsigned char *,
|
||||
bb.fbuf), bb.flen, offset,
|
||||
switch (mget(ms, m, b, &bb, offset,
|
||||
cont_level, mode, text, flip, indir_count,
|
||||
name_count, printed_something, need_separator,
|
||||
firstline, returnval, found_match)) {
|
||||
@@ -450,7 +469,7 @@ flush:
|
||||
*need_separator = 1;
|
||||
}
|
||||
|
||||
switch (moffset(ms, m, &bb, offset,
|
||||
switch (moffset(ms, m, bb.flen, offset,
|
||||
&ms->c.li[cont_level].off)) {
|
||||
case -1:
|
||||
case 0:
|
||||
@@ -489,19 +508,18 @@ file_private int
|
||||
check_fmt(struct magic_set *ms, const char *fmt)
|
||||
{
|
||||
file_regex_t rx;
|
||||
int rc, rv = -1;
|
||||
int rc;
|
||||
const char* pat = "%[-0-9\\.]*s";
|
||||
|
||||
if (strchr(fmt, '%') == NULL)
|
||||
return 0;
|
||||
|
||||
rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
|
||||
if (rc == 0) {
|
||||
rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
|
||||
rv = !rc;
|
||||
}
|
||||
if (rc != 0)
|
||||
return -1;
|
||||
rc = !file_regexec(ms, &rx, fmt, 0, 0, 0);
|
||||
file_regfree(&rx);
|
||||
return rv;
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_STRNDUP) || defined(__aiws__) || defined(_AIX)
|
||||
@@ -768,6 +786,9 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
char *cp, *scp;
|
||||
int rval;
|
||||
|
||||
if (ms->search.s == NULL)
|
||||
break;
|
||||
|
||||
cp = strndup(RCAST(const char *, ms->search.s),
|
||||
ms->search.rm_len);
|
||||
if (cp == NULL) {
|
||||
@@ -802,7 +823,13 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
return -1;
|
||||
break;
|
||||
case FILE_GUID:
|
||||
(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
|
||||
case FILE_LEGUID:
|
||||
(void) file_print_leguid(buf, sizeof(buf), ms->ms_value.guid);
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
case FILE_BEGUID:
|
||||
(void) file_print_beguid(buf, sizeof(buf), ms->ms_value.guid);
|
||||
if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
|
||||
return -1;
|
||||
break;
|
||||
@@ -833,11 +860,11 @@ mprint(struct magic_set *ms, struct magic *m)
|
||||
}
|
||||
|
||||
file_private int
|
||||
moffset(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
moffset(struct magic_set *ms, struct magic *m, size_t nbytes,
|
||||
size_t offset, int32_t *op)
|
||||
{
|
||||
size_t nbytes = b->flen;
|
||||
int32_t o;
|
||||
size_t vlen;
|
||||
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
@@ -930,18 +957,15 @@ moffset(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
if ((m->str_flags & REGEX_OFFSET_START) != 0)
|
||||
o = CAST(int32_t, ms->search.offset - offset);
|
||||
else
|
||||
o = CAST(int32_t,
|
||||
(ms->search.offset + ms->search.rm_len - offset));
|
||||
/* Why is regex and search different? */
|
||||
vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ?
|
||||
ms->search.rm_len : 0;
|
||||
o = CAST(int32_t, ms->search.offset + vlen - offset);
|
||||
break;
|
||||
|
||||
case FILE_SEARCH:
|
||||
if ((m->str_flags & REGEX_OFFSET_START) != 0)
|
||||
o = CAST(int32_t, ms->search.offset - offset);
|
||||
else
|
||||
o = CAST(int32_t, (ms->search.offset + m->vallen - offset));
|
||||
vlen = (m->str_flags & REGEX_OFFSET_START) == 0 ? m->vallen : 0;
|
||||
o = CAST(int32_t, ms->search.offset + vlen - offset);
|
||||
break;
|
||||
|
||||
case FILE_CLEAR:
|
||||
@@ -965,6 +989,8 @@ moffset(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
}
|
||||
break;
|
||||
|
||||
case FILE_BEGUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_GUID:
|
||||
o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
|
||||
break;
|
||||
@@ -1326,6 +1352,8 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
case FILE_USE:
|
||||
case FILE_DER:
|
||||
case FILE_GUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
return 1;
|
||||
default:
|
||||
file_magerror(ms, "invalid type %d in mconvert()", m->type);
|
||||
@@ -1562,6 +1590,8 @@ msetoffset(struct magic_set *ms, struct magic *m, struct buffer *bb,
|
||||
return -1;
|
||||
}
|
||||
if (b->fd == -1) {
|
||||
if (CAST(size_t, m->offset) > b->flen)
|
||||
return -1;
|
||||
ms->eoffset = ms->offset =
|
||||
CAST(int32_t, b->flen - m->offset);
|
||||
} else {
|
||||
@@ -1580,8 +1610,7 @@ normal:
|
||||
ms->offset = offset;
|
||||
ms->eoffset = 0;
|
||||
} else {
|
||||
if (b->fd != -1)
|
||||
ms->offset = ms->eoffset + offset;
|
||||
ms->offset = ms->eoffset + offset;
|
||||
}
|
||||
}
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
@@ -1618,13 +1647,13 @@ restore_cont(struct magic_set *ms, struct cont *c)
|
||||
|
||||
file_private int
|
||||
mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
const unsigned char *s, size_t nbytes, size_t o, unsigned int cont_level,
|
||||
const struct buffer *bb, size_t o, unsigned int cont_level,
|
||||
int mode, int text, int flip, uint16_t *indir_count, uint16_t *name_count,
|
||||
int *printed_something, int *need_separator, int *firstline, int *returnval,
|
||||
int *found_match)
|
||||
{
|
||||
uint32_t eoffset, offset = ms->offset;
|
||||
struct buffer bb;
|
||||
struct buffer sbb;
|
||||
intmax_t lhs;
|
||||
file_pushbuf_t *pb;
|
||||
int rv, oneed_separator, in_type, nfound_match;
|
||||
@@ -1632,6 +1661,8 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
struct mlist ml, *mlp;
|
||||
struct cont c;
|
||||
const unsigned char *s = CAST(const unsigned char *, bb->fbuf);
|
||||
size_t nbytes = bb->flen;
|
||||
|
||||
if (*indir_count >= ms->indir_max) {
|
||||
file_error(ms, 0, "indirect count (%hu) exceeded",
|
||||
@@ -1667,68 +1698,71 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
intmax_t off = m->in_offset;
|
||||
const int sgn = m->in_op & FILE_OPSIGNED;
|
||||
if (m->in_op & FILE_OPINDIRECT) {
|
||||
|
||||
uint8_t *hb = CCAST(uint8_t *, s + offset + off);
|
||||
uint8_t *hb;
|
||||
uint16_t hs;
|
||||
uint32_t hl;
|
||||
int op;
|
||||
|
||||
if (offset_oob(nbytes, offset + off, 0))
|
||||
return 0;
|
||||
hb = CCAST(uint8_t *, s + offset + off);
|
||||
switch (op = cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 1))
|
||||
if (offset_oob(nbytes, offset + off, 1))
|
||||
return 0;
|
||||
off = SEXT(sgn,8,hb[0]);
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
if (offset_oob(nbytes, offset + off, 2))
|
||||
return 0;
|
||||
memcpy(&hs, hb, sizeof(hs));
|
||||
off = SEXT(sgn,16,hs);
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
if (offset_oob(nbytes, offset + off, 2))
|
||||
return 0;
|
||||
off = SEXT(sgn,16,BE16(hb));
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
if (offset_oob(nbytes, offset + off, 2))
|
||||
return 0;
|
||||
off = SEXT(sgn,16,LE16(hb));
|
||||
break;
|
||||
case FILE_LONG:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
if (offset_oob(nbytes, offset + off, 4))
|
||||
return 0;
|
||||
memcpy(&hl, hb, sizeof(hl));
|
||||
off = SEXT(sgn,32,hl);
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
if (offset_oob(nbytes, offset + off, 4))
|
||||
return 0;
|
||||
off = SEXT(sgn,32,BE32(hb));
|
||||
break;
|
||||
case FILE_LEID3:
|
||||
case FILE_LELONG:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
if (offset_oob(nbytes, offset + off, 4))
|
||||
return 0;
|
||||
off = SEXT(sgn,32,LE32(hb));
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
if (offset_oob(nbytes, offset + off, 4))
|
||||
return 0;
|
||||
off = SEXT(sgn,32,ME32(hb));
|
||||
break;
|
||||
case FILE_BEQUAD:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 8))
|
||||
if (offset_oob(nbytes, offset + off, 8))
|
||||
return 0;
|
||||
off = SEXT(sgn,64,BE64(hb));
|
||||
break;
|
||||
case FILE_LEQUAD:
|
||||
if (OFFSET_OOB(nbytes, offset + off, 8))
|
||||
if (offset_oob(nbytes, offset + off, 8))
|
||||
return 0;
|
||||
off = SEXT(sgn,64,LE64(hb));
|
||||
break;
|
||||
case FILE_OCTAL:
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
if (offset_oob(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
|
||||
break;
|
||||
@@ -1742,32 +1776,32 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
}
|
||||
switch (in_type = cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
if (offset_oob(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
if (offset_oob(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p->hs)), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
if (offset_oob(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p->hs)), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
if (offset_oob(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,16,p->h), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
if (offset_oob(nbytes, offset, 4))
|
||||
return 0;
|
||||
lhs = BE32(p->hl);
|
||||
if (in_type == FILE_BEID3)
|
||||
@@ -1777,7 +1811,7 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
if (offset_oob(nbytes, offset, 4))
|
||||
return 0;
|
||||
lhs = LE32(p->hl);
|
||||
if (in_type == FILE_LEID3)
|
||||
@@ -1786,31 +1820,31 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
return 0;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
if (offset_oob(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,32,ME32(p->hl)), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
if (offset_oob(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_LEQUAD:
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
if (offset_oob(nbytes, offset, 8))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p->hq)), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_BEQUAD:
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
if (offset_oob(nbytes, offset, 8))
|
||||
return 0;
|
||||
if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p->hq)), off))
|
||||
return 0;
|
||||
break;
|
||||
case FILE_OCTAL:
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
if (offset_oob(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
if(do_ops(ms, m, &offset,
|
||||
SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
|
||||
@@ -1855,14 +1889,14 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
if (offset_oob(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
if (offset_oob(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1881,19 +1915,21 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
if (offset_oob(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
if (offset_oob(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_LEGUID:
|
||||
case FILE_BEGUID:
|
||||
case FILE_GUID:
|
||||
if (OFFSET_OOB(nbytes, offset, 16))
|
||||
if (offset_oob(nbytes, offset, 16))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1901,7 +1937,7 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
case FILE_OCTAL:
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
if (offset_oob(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1923,22 +1959,22 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
return -1;
|
||||
|
||||
(*indir_count)++;
|
||||
bb = *b;
|
||||
bb.fbuf = s + offset;
|
||||
bb.flen = nbytes - offset;
|
||||
bb.ebuf = NULL;
|
||||
bb.elen = 0;
|
||||
sbb = *b;
|
||||
sbb.fbuf = s + offset;
|
||||
sbb.flen = nbytes - offset;
|
||||
sbb.ebuf = NULL;
|
||||
sbb.elen = 0;
|
||||
rv = -1;
|
||||
for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
|
||||
mlp = mlp->next)
|
||||
{
|
||||
if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
|
||||
mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
|
||||
mlp->nmagic, &sbb, 0, BINTEST, text, 0, indir_count,
|
||||
name_count, printed_something, need_separator,
|
||||
firstline, NULL, NULL)) != 0)
|
||||
break;
|
||||
}
|
||||
buffer_fini(&bb);
|
||||
buffer_fini(&sbb);
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
@@ -2122,7 +2158,7 @@ alloc_regex(struct magic_set *ms, struct magic *m)
|
||||
}
|
||||
|
||||
rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
|
||||
((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
|
||||
REGEX_ICASE(m));
|
||||
if (rc == 0)
|
||||
return rx;
|
||||
|
||||
@@ -2405,6 +2441,8 @@ magiccheck(struct magic_set *ms, struct magic *m, file_regex_t **m_cache)
|
||||
return 0;
|
||||
}
|
||||
return matched;
|
||||
case FILE_BEGUID:
|
||||
case FILE_LEGUID:
|
||||
case FILE_GUID:
|
||||
l = 0;
|
||||
v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
* Software written by Ian F. Darwin and others;
|
||||
* maintained 1995-present by Christos Zoulas and others.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
FILE_RCSID("@(#)$File: swap.c,v 1.1 2026/04/19 19:56:49 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "swap.h"
|
||||
|
||||
#if !defined(HAVE_BYTESWAP_H) && !defined(HAVE_SYS_BSWAP_H)
|
||||
/*
|
||||
* swap a short
|
||||
*/
|
||||
file_protected uint16_t
|
||||
file_swap2(uint16_t sv)
|
||||
{
|
||||
uint16_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
d[0] = s[1];
|
||||
d[1] = s[0];
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* swap an int
|
||||
*/
|
||||
file_protected uint32_t
|
||||
file_swap4(uint32_t sv)
|
||||
{
|
||||
uint32_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
d[0] = s[3];
|
||||
d[1] = s[2];
|
||||
d[2] = s[1];
|
||||
d[3] = s[0];
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* swap a quad
|
||||
*/
|
||||
file_protected uint64_t
|
||||
file_swap8(uint64_t sv)
|
||||
{
|
||||
uint64_t rv;
|
||||
uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
|
||||
uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
|
||||
# if 0
|
||||
d[0] = s[3];
|
||||
d[1] = s[2];
|
||||
d[2] = s[1];
|
||||
d[3] = s[0];
|
||||
d[4] = s[7];
|
||||
d[5] = s[6];
|
||||
d[6] = s[5];
|
||||
d[7] = s[4];
|
||||
# else
|
||||
d[0] = s[7];
|
||||
d[1] = s[6];
|
||||
d[2] = s[5];
|
||||
d[3] = s[4];
|
||||
d[4] = s[3];
|
||||
d[5] = s[2];
|
||||
d[6] = s[1];
|
||||
d[7] = s[0];
|
||||
# endif
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
* Software written by Ian F. Darwin and others;
|
||||
* maintained 1995-present by Christos Zoulas and others.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_BSWAP_H
|
||||
#include <sys/bswap.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_BYTESWAP_H)
|
||||
#define file_swap2(x) bswap_16(x)
|
||||
#define file_swap4(x) bswap_32(x)
|
||||
#define file_swap8(x) bswap_64(x)
|
||||
#elif defined(HAVE_SYS_BSWAP_H)
|
||||
#define file_swap2(x) bswap16(x)
|
||||
#define file_swap4(x) bswap32(x)
|
||||
#define file_swap8(x) bswap64(x)
|
||||
#else
|
||||
file_protected uint16_t file_swap2(uint16_t);
|
||||
file_protected uint32_t file_swap4(uint32_t);
|
||||
file_protected uint64_t file_swap8(uint64_t);
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.18 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -69,6 +69,8 @@ am__make_running_with_option = \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
am__rm_f = rm -f $(am__rm_f_notfound)
|
||||
am__rm_rf = rm -rf $(am__rm_f_notfound)
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
@@ -250,8 +252,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__rm_f_notfound = @am__rm_f_notfound@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
am__xargs_n = @am__xargs_n@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
@@ -536,13 +540,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
$(am__rm_f) $(check_PROGRAMS)
|
||||
test -z "$(EXEEXT)" || $(am__rm_f) $(check_PROGRAMS:$(EXEEXT)=)
|
||||
|
||||
test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES)
|
||||
@rm -f test$(EXEEXT)
|
||||
@@ -558,7 +557,7 @@ distclean-compile:
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
@: >>$@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
@@ -657,6 +656,7 @@ cscopelist-am: $(am__tagged_files)
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -720,8 +720,8 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@@ -732,7 +732,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/test-test.Po
|
||||
-rm -f ./$(DEPDIR)/test-test.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
@@ -778,7 +778,7 @@ install-ps-am:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f ./$(DEPDIR)/test-test.Po
|
||||
-rm -f ./$(DEPDIR)/test-test.Po
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@@ -844,3 +844,10 @@ check-local:
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
# Tell GNU make to disable its built-in pattern rules.
|
||||
%:: %,v
|
||||
%:: RCS/%,v
|
||||
%:: RCS/%
|
||||
%:: s.%
|
||||
%:: SCCS/s.%
|
||||
@@ -1 +1 @@
|
||||
Binary G-code Version 1, CRC32 checksum
|
||||
Binary G-code Version 1, CRC32 checksum
|
||||
@@ -1 +1 @@
|
||||
EFI Signature List, SHA256, total size: 76 bytes
|
||||
EFI Signature List, SHA256, total size: 76 bytes
|
||||
@@ -115,6 +115,12 @@
|
||||
/* Define to 1 if you have the 'zstd' library (-lzstd). */
|
||||
/* #undef HAVE_LIBZSTD */
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/landlock.h> header file. */
|
||||
/* #undef HAVE_LINUX_LANDLOCK_H */
|
||||
|
||||
/* Define to 1 if you have the 'localtime_r' function. */
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
|
||||
@@ -336,7 +342,7 @@
|
||||
#define PACKAGE_NAME "file"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "file 5.47"
|
||||
#define PACKAGE_STRING "file 5.48"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "file"
|
||||
@@ -345,7 +351,7 @@
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "5.47"
|
||||
#define PACKAGE_VERSION "5.48"
|
||||
|
||||
/* Define to 1 if all of the C89 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
@@ -448,7 +454,7 @@
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "5.47"
|
||||
#define VERSION "5.48"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
|
||||
Reference in new issue
Block a user