git: d58218761eeb - stable/14 - MFV: file 5.47.

From: Xin LI <delphij_at_FreeBSD.org>
Date: Sat, 20 Jun 2026 03:25:57 UTC
The branch stable/14 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=d58218761eeb4e7a2a375b7d2ed80c31a311f3fd

commit d58218761eeb4e7a2a375b7d2ed80c31a311f3fd
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2026-06-03 04:54:25 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-06-20 03:25:44 +0000

    MFV: file 5.47.
    
    (cherry picked from commit e949ce9dc0e6fff26e83904f1008b76d36ba0a37)
    
    file: normalize .result files to ensure trailing newline on install
    
    Some upstream result files introduced in file 5.47 (e.g., bgcode.result)
    lack a trailing newline, causing the contrib_file_tests ATF test to
    fail with "cmp: EOF on bgcode.result".  Generate normalized copies
    of the expected results and install those instead.
    
    Fixes:          e949ce9dc0e6fff26e83904f1008b76d36ba0a37
    
    (cherry picked from commit f7c0bd206fe4f3a956b3ecb4dc11a7386b85fa22)
---
 contrib/file/ChangeLog                             |  33 ++++
 contrib/file/config.sub                            |   2 +-
 contrib/file/configure                             |  20 +-
 contrib/file/configure.ac                          |   2 +-
 contrib/file/doc/file.man                          |   8 +-
 contrib/file/doc/magic.man                         |  30 ++-
 contrib/file/magic/Magdir/amigaos                  |  10 +-
 contrib/file/magic/Magdir/animation                |  33 ++--
 contrib/file/magic/Magdir/apache                   |  20 +-
 contrib/file/magic/Magdir/archive                  | 217 ++++++++++++++-------
 contrib/file/magic/Magdir/audio                    |  14 +-
 contrib/file/magic/Magdir/bgcode                   |   9 +
 contrib/file/magic/Magdir/blender                  |  19 +-
 contrib/file/magic/Magdir/bytecode                 |  15 +-
 contrib/file/magic/Magdir/c-lang                   |  42 ++--
 contrib/file/magic/Magdir/cisco                    |   7 +-
 contrib/file/magic/Magdir/commands                 |  62 ++++--
 contrib/file/magic/Magdir/console                  |  92 ++++++++-
 contrib/file/magic/Magdir/creativeassembly         |  26 +++
 contrib/file/magic/Magdir/database                 | 102 +++++++++-
 contrib/file/magic/Magdir/filesystems              |  31 ++-
 contrib/file/magic/Magdir/firmware                 | 145 +++++++++++++-
 contrib/file/magic/Magdir/fonts                    |  14 +-
 contrib/file/magic/Magdir/games                    |  64 +++++-
 contrib/file/magic/Magdir/gguf                     |  23 +++
 contrib/file/magic/Magdir/ibm370                   |   8 +-
 contrib/file/magic/Magdir/images                   |  47 ++++-
 contrib/file/magic/Magdir/intel                    |   6 +-
 contrib/file/magic/Magdir/linux                    |  32 ++-
 contrib/file/magic/Magdir/lua                      |   3 +-
 contrib/file/magic/Magdir/mail.news                |   4 +-
 contrib/file/magic/Magdir/measure                  |   9 +-
 contrib/file/magic/Magdir/msdos                    |  63 ++----
 contrib/file/magic/Magdir/msooxml                  |  22 ++-
 contrib/file/magic/Magdir/music                    |  45 ++++-
 contrib/file/magic/Magdir/os2                      |  30 ++-
 contrib/file/magic/Magdir/pdf                      |   4 +-
 contrib/file/magic/Magdir/pgp                      |  73 ++++++-
 contrib/file/magic/Magdir/python                   |  29 ++-
 contrib/file/magic/Magdir/r                        |  86 ++++++++
 contrib/file/magic/Magdir/riff                     |  12 +-
 contrib/file/magic/Magdir/rtf                      |   7 +-
 contrib/file/magic/Magdir/sf3                      | 112 +++++++++++
 contrib/file/magic/Magdir/sgml                     |  27 ++-
 contrib/file/magic/Magdir/sniffer                  |   9 +-
 contrib/file/magic/Magdir/sql                      |  21 +-
 contrib/file/magic/Magdir/syd                      |  37 ++++
 contrib/file/magic/Magdir/tapebackup               |  29 +++
 contrib/file/magic/Magdir/tex                      |  17 +-
 contrib/file/magic/Magdir/ti-8x                    |   7 +-
 contrib/file/magic/Magdir/varied.script            |  23 ++-
 contrib/file/magic/Magdir/virtual                  |   6 +-
 contrib/file/magic/Magdir/webassembly              |   9 +-
 contrib/file/magic/Magdir/windows                  |  42 ++--
 contrib/file/magic/Magdir/xilinx                   |  24 +--
 contrib/file/magic/Magdir/xwindows                 |   9 +-
 contrib/file/magic/Magdir/zip                      |   9 +-
 contrib/file/magic/Makefile.am                     |   9 +-
 contrib/file/magic/Makefile.in                     |   9 +-
 contrib/file/python/magic.py                       |   4 +-
 contrib/file/src/apprentice.c                      |  61 ++++--
 contrib/file/src/apptype.c                         |   9 +-
 contrib/file/src/buffer.c                          |   6 +-
 contrib/file/src/cdf.c                             |  12 +-
 contrib/file/src/cdf.h                             |   1 +
 contrib/file/src/encoding.c                        |  10 +-
 contrib/file/src/file.h                            |  13 +-
 contrib/file/src/funcs.c                           | 103 +++++++---
 contrib/file/src/is_simh.c                         |  16 +-
 contrib/file/src/magic.c                           |  46 ++---
 contrib/file/src/print.c                           |   8 +-
 contrib/file/src/readcdf.c                         |  62 ++++--
 contrib/file/src/readelf.c                         | 203 ++++++++++---------
 contrib/file/src/seccomp.c                         |  19 +-
 contrib/file/src/softmagic.c                       |  82 ++++++--
 contrib/file/tests/Makefile.am                     |  27 ++-
 contrib/file/tests/Makefile.in                     |  27 ++-
 contrib/file/tests/arj.result                      |   2 +-
 contrib/file/tests/bgcode.result                   |   1 +
 contrib/file/tests/bgcode.testfile                 | Bin 0 -> 1430943 bytes
 .../file/tests/efi-signature-list-sha256.result    |   1 +
 .../file/tests/efi-signature-list-sha256.testfile  | Bin 0 -> 76 bytes
 lib/libmagic/config.h                              |   6 +-
 usr.bin/file/tests/Makefile                        |  13 +-
 84 files changed, 2054 insertions(+), 597 deletions(-)

diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog
index d2dfbc14b77f..e7ce3347eff4 100644
--- a/contrib/file/ChangeLog
+++ b/contrib/file/ChangeLog
@@ -1,3 +1,36 @@
+2026-02-26  11:32  Christos Zoulas <christos@zoulas.com>
+
+	* release 5.47
+
+2026-02-04  09:54  Christos Zoulas <christos@zoulas.com>
+	* Better multi-compound document identification by following the
+	  order of the directories entries. (Thomas Ledoux)
+
+2026-01-19  14:00  Christos Zoulas <christos@zoulas.com>
+	* if stat fails, don't attempt to restore times (Steven Grubb)
+
+2025-05-28  15:20  Christos Zoulas <christos@zoulas.com>
+
+	PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
+	when fd is not available.
+
+2025-05-28  12:50  Christos Zoulas <christos@zoulas.com>
+
+	* PR/655: jsummers: Obey str_flags in strings like we do for search
+	  and regex
+	* PR/659: Pitzl: Apply MAGIC_CONTINUE to annotations; i.e. print
+	  only the first, unless -k is specified.
+	
+2024-12-19  14:44  Christos Zoulas <christos@zoulas.com>
+
+	* PR/592: allow + in format strings
+	* PR/592: signed operations should be done in signed context
+
+2024-12-05  13:50 Christos Zoulas <christos@zoulas.com>
+
+	* PR/578: jsummers: Don't crash on cygwin when tm_mon == -1
+	* PR/579: net147: Fix stack overrun.
+
 2024-11-27  14:44  Christos Zoulas <christos@zoulas.com>
 
 	* release 5.46
diff --git a/contrib/file/config.sub b/contrib/file/config.sub
index f6564f2885d4..83c4149b2293 100755
--- a/contrib/file/config.sub
+++ b/contrib/file/config.sub
@@ -1724,7 +1724,7 @@ case $os in
 	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
 	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
 	     | hiux* | abug | nacl* | netware* | windows* \
-	     | os9* | macos* | osx* | ios* \
+	     | os9* | macos* | osx* | ios* | illumos* \
 	     | mpw* | magic* | mmixware* | mon960* | lnews* \
 	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
 	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
diff --git a/contrib/file/configure b/contrib/file/configure
index cdcdd746f562..3b72db770082 100755
--- a/contrib/file/configure
+++ b/contrib/file/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for file 5.46.
+# Generated by GNU Autoconf 2.72 for file 5.47.
 #
 # Report bugs to <christos@astron.com>.
 #
@@ -614,8 +614,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.46'
-PACKAGE_STRING='file 5.46'
+PACKAGE_VERSION='5.47'
+PACKAGE_STRING='file 5.47'
 PACKAGE_BUGREPORT='christos@astron.com'
 PACKAGE_URL=''
 
@@ -1370,7 +1370,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.46 to adapt to many kinds of systems.
+'configure' configures file 5.47 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1441,7 +1441,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of file 5.46:";;
+     short | recursive ) echo "Configuration of file 5.47:";;
    esac
   cat <<\_ACEOF
 
@@ -1567,7 +1567,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.46
+file configure 5.47
 generated by GNU Autoconf 2.72
 
 Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2153,7 +2153,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.46, which was
+It was created by file $as_me 5.47, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3452,7 +3452,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.46'
+ VERSION='5.47'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -16880,7 +16880,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.46, which was
+This file was extended by file $as_me 5.47, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16948,7 +16948,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.46
+file config.status 5.47
 configured by $0, generated by GNU Autoconf 2.72,
   with options \\"\$ac_cs_config\\"
 
diff --git a/contrib/file/configure.ac b/contrib/file/configure.ac
index 58a5f63657bb..f48ccc36a470 100644
--- a/contrib/file/configure.ac
+++ b/contrib/file/configure.ac
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.46],[christos@astron.com])
+AC_INIT([file],[5.47],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
diff --git a/contrib/file/doc/file.man b/contrib/file/doc/file.man
index a09ec0705817..96efc0c03233 100644
--- a/contrib/file/doc/file.man
+++ b/contrib/file/doc/file.man
@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.151 2024/04/07 21:27:35 christos Exp $
-.Dd April 7, 2024
+.\" $File: file.man,v 1.153 2025/07/23 18:52:08 christos Exp $
+.Dd June 17, 2025
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -173,7 +173,7 @@ Causes the
 command to output the file type and creator code as
 used by older MacOS versions.
 The code consists of eight letters,
-the first describing the file type, the latter the creator.
+the first four describing the file type, the latter four the creator.
 This option works properly only for file formats that have the
 apple-style output defined.
 .It Fl b , Fl Fl brief
@@ -348,7 +348,7 @@ Set various parameter limits.
 .It Li elf_shsize Ta 128MB Ta max ELF section size processed
 .It Li encoding Ta 65K Ta max number of bytes to determine encoding
 .It Li indir Ta 50 Ta recursion limit for indirect magic
-.It Li name Ta 100 Ta use count limit for name/use magic
+.It Li name Ta 150 Ta use count limit for name/use magic
 .It Li regex Ta 8K Ta length limit for regex searches
 .El
 .It Fl r , Fl Fl raw
diff --git a/contrib/file/doc/magic.man b/contrib/file/doc/magic.man
index 6916b7b211d7..b2ae54844606 100644
--- a/contrib/file/doc/magic.man
+++ b/contrib/file/doc/magic.man
@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.110 2024/11/27 15:37:00 christos Exp $
-.Dd November 27, 2024
+.\" $File: magic.man,v 1.115 2025/11/24 15:45:00 christos Exp $
+.Dd November 24, 2025
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -73,7 +73,8 @@ A 64-bit double precision IEEE floating point number in this machine's native by
 .It Dv string
 A string of bytes.
 The string type specification can be optionally followed by a /<width> 
-option and optionally followed by a set of flags /[bCcftTtWw]*.
+option and optionally followed by a set of flags [bCcftTtWw]*.
+Slash characters can be used to separate options for readability.
 The width limits the number of characters to be copied.
 Zero means all characters.
 The following flags are supported:
@@ -85,24 +86,31 @@ 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)
 .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
 characters in the target.
+(not valid for regex)
 To do a complete case insensitive match, specify both
 .Dq c
 and
 .Dq C .
 .It f
 Require that the matched string is a full word, not a partial word match.
+.It s
+Don't include the match length in the offset computation.
+(only valid for search and regex)
 .It T
 Trim the string, i.e. leading and trailing whitespace
+is deleted before the string is printed.
 .It t
 Force text file test.
 .It W
 Compact whitespace in the target, which must
 contain at least one whitespace character.
+(not valid for regex)
 If the magic has
 .Dv n
 consecutive blanks, the target needs at least
@@ -110,7 +118,7 @@ consecutive blanks, the target needs at least
 consecutive blanks to match.
 .It w
 Treat every blank in the magic as an optional blank.
-is deleted before the string is printed.
+(not valid for regex)
 .El
 .It Dv pstring
 A Pascal-style string where the first byte/short/int is interpreted as the
@@ -221,10 +229,10 @@ than UTC.
 An eight-byte value in little-endian byte order,
 interpreted as a Windows-style date.
 .It Dv lemsdosdate
-A two-byte value in big-endian byte order,
+A two-byte value in little-endian byte order,
 interpreted as FAT/DOS-style date.
 .It Dv lemsdostime
-A two-byte value in big-endian byte order,
+A two-byte value in little-endian byte order,
 interpreted as FAT/DOS-style time.
 .It Dv lestring16
 A two-byte unicode (UCS16) string in little-endian byte order.
@@ -253,7 +261,8 @@ magic entry, like a subroutine call.
 Named instance direct magic offsets are relative to the offset of the
 previous matched entry, but indirect offsets are relative to the beginning
 of the file as usual.
-Named magic entries always match.
+Named magic entries return true if there was a match in the evaluation
+of the entry, or if there was a previous existing match.
 .It Dv use
 Recursively call the named magic starting from the current offset.
 If the name of the referenced begins with a
@@ -459,11 +468,12 @@ matching a file, binary patterns are tried first; if no match is
 found, and the file looks like text, then its encoding is determined
 and the text patterns are tried.
 .Pp
-The numeric types may optionally be followed by
-.Dv \*[Am]
+The numeric types may optionally be followed by an operand
 and a numeric value,
-to specify that the value is to be AND'ed with the
+to specify that the value is to be modified according to the operand and the
 numeric value before any comparisons are done.
+The following operands are supported:
+.Dv \*[Am], \*[Ba], \*[ua], +, -, \&*, /, %.
 Prepending a
 .Dv u
 to the type indicates that ordered comparisons should be unsigned.
diff --git a/contrib/file/magic/Magdir/amigaos b/contrib/file/magic/Magdir/amigaos
index fdd947fdf7f5..1b8cacaf08ec 100644
--- a/contrib/file/magic/Magdir/amigaos
+++ b/contrib/file/magic/Magdir/amigaos
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: amigaos,v 1.20 2021/09/20 00:42:19 christos Exp $
+# $File: amigaos,v 1.23 2026/02/05 18:49:06 christos Exp $
 # amigaos:  file(1) magic for AmigaOS binary formats:
 
 #
@@ -36,7 +36,6 @@
 0	string		COSO\0		Hippel-COSO Module sound file
 # Too simple (short, pure ASCII, deep), MPi
 #26	string		V.3		Brian Postma's Soundmon Module sound file v3
-#26	string		BPSM		Brian Postma's Soundmon Module sound file v3
 #26	string		V.2		Brian Postma's Soundmon Module sound file v2
 
 # The following are from: "Stefan A. Haubenthal" <polluks@web.de>
@@ -195,8 +194,7 @@
 0	string		LZX		LZX compressed archive (Amiga)
 
 # From: Przemek Kramarczyk <pkramarczyk@gmail.com>
-0	string 		.KEY		AmigaDOS script
-0	string 		.key		AmigaDOS script
+0	string/c	.key		AmigaDOS script
 
 # AMOS Basic file formats
 # https://www.exotica.org.uk/wiki/AMOS_file_formats
@@ -216,3 +214,7 @@
 >12	regex		.{8}			\b, type %s
 0	string		AmBs			AMOS Basic memory banks
 >4	beshort		x			\b, %d banks
+
+
+# https://github.com/alb42/Leu/blob/master/TCDReaderUnit.pas
+3	string		TURBOCALC		TurboCalc spreadsheet
diff --git a/contrib/file/magic/Magdir/animation b/contrib/file/magic/Magdir/animation
index 0df435290a3a..4a73e72d8557 100644
--- a/contrib/file/magic/Magdir/animation
+++ b/contrib/file/magic/Magdir/animation
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.98 2024/09/01 15:51:51 christos Exp $
+# $File: animation,v 1.101 2025/05/28 19:54:08 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -542,20 +542,23 @@
 >>2	byte&0xF0	!0xF0		MPEG ADTS, layer III, v1
 !:strength +20
 !:mime	audio/mpeg
->>>2	byte&0xF0	0x10		\b, 32 kbps
->>>2	byte&0xF0	0x20		\b, 40 kbps
->>>2	byte&0xF0	0x30		\b, 48 kbps
->>>2	byte&0xF0	0x40		\b, 56 kbps
->>>2	byte&0xF0	0x50		\b, 64 kbps
->>>2	byte&0xF0	0x60		\b, 80 kbps
->>>2	byte&0xF0	0x70		\b, 96 kbps
->>>2	byte&0xF0	0x80		\b, 112 kbps
->>>2	byte&0xF0	0x90		\b, 128 kbps
->>>2	byte&0xF0	0xA0		\b, 160 kbps
->>>2	byte&0xF0	0xB0		\b, 192 kbps
->>>2	byte&0xF0	0xC0		\b, 224 kbps
->>>2	byte&0xF0	0xD0		\b, 256 kbps
->>>2	byte&0xF0	0xE0		\b, 320 kbps
+>>>2	search/100	Xing		\b, variable bitrate
+>>>2	search/100	VBRI		\b, variable bitrate
+>>>2	default		x
+>>>>2	byte&0xF0	0x10		\b, 32 kbps
+>>>>2	byte&0xF0	0x20		\b, 40 kbps
+>>>>2	byte&0xF0	0x30		\b, 48 kbps
+>>>>2	byte&0xF0	0x40		\b, 56 kbps
+>>>>2	byte&0xF0	0x50		\b, 64 kbps
+>>>>2	byte&0xF0	0x60		\b, 80 kbps
+>>>>2	byte&0xF0	0x70		\b, 96 kbps
+>>>>2	byte&0xF0	0x80		\b, 112 kbps
+>>>>2	byte&0xF0	0x90		\b, 128 kbps
+>>>>2	byte&0xF0	0xA0		\b, 160 kbps
+>>>>2	byte&0xF0	0xB0		\b, 192 kbps
+>>>>2	byte&0xF0	0xC0		\b, 224 kbps
+>>>>2	byte&0xF0	0xD0		\b, 256 kbps
+>>>>2	byte&0xF0	0xE0		\b, 320 kbps
 # timing
 >>>2	byte&0x0C	0x00		\b, 44.1 kHz
 >>>2	byte&0x0C	0x04		\b, 48 kHz
diff --git a/contrib/file/magic/Magdir/apache b/contrib/file/magic/Magdir/apache
index d896b5055127..099efb77da57 100755
--- a/contrib/file/magic/Magdir/apache
+++ b/contrib/file/magic/Magdir/apache
@@ -1,18 +1,28 @@
 
 #------------------------------------------------------------------------------
-# $File: apache,v 1.1 2017/04/11 14:52:15 christos Exp $
+# $File: apache,v 1.3 2025/05/30 13:25:13 christos Exp $
 # apache: file(1) magic for Apache Big Data formats
 
 # Avro files
-0	string		Obj		Apache Avro
->3	byte		x		version %d
+0	string		Obj\001		Apache Avro, version 1
 
 # ORC files
 # Important information is in file footer, which we can't index to :(
 0	string		ORC		Apache ORC
 
-# Parquet files
-0	string		PAR1		Apache Parquet
+# Apache arrow file format
+# MIME: https://www.iana.org/assignments/media-types/application/vnd.apache.arrow.stream
+# Description: https://arrow.apache.org/docs/format/Columnar.html
+0	string		ARROW1		Apache Arrow columnar file
+!:mime application/vnd.apache.arrow.file
+!:ext arrow/feather
+
+# Apache parquet file format
+# MIME: https://www.iana.org/assignments/media-types/application/vnd.apache.parquet
+# Description: https://parquet.apache.org/docs/file-format/
+0	string		PAR1		Apache Parquet file
+!:mime application/vnd.apache.parquet
+!:ext parquet
 
 # Hive RC files
 0	string		RCF		Apache Hive RC file
diff --git a/contrib/file/magic/Magdir/archive b/contrib/file/magic/Magdir/archive
index b920f9930f41..3aba947078b5 100644
--- a/contrib/file/magic/Magdir/archive
+++ b/contrib/file/magic/Magdir/archive
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.207 2024/11/27 15:37:46 christos Exp $
+# $File: archive,v 1.218 2026/01/10 16:16:27 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -689,7 +689,7 @@
 # TODO: idarc says "bytes 0-2 == bytes 3-5"
 # TTComp
 # URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
-# Update: Joerg Jenderek
+# Update: Joerg Jenderek, A Iooss
 # GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
 0	string	\0\6
 # look for first keyword of Panorama database *.pan
@@ -735,8 +735,27 @@
 #>-4	ubelong		x	LAST_BYTES=%8.8x
 >-4	ubelong&0x00FFffFF	!0
 >>0	use	ttcomp
-#	display information of TTComp archive
+# match end of TTComp to reduce false positives
+# see https://mark0.net/forum/index.php?topic=848
 0	name	ttcomp
+>-2	string	\x01\xff
+>>+0	use	ttcomp-display
+>-2	string	\x80\x7f
+>>+0	use	ttcomp-display
+>-2	string	\xc0\x3f
+>>+0	use	ttcomp-display
+>-2	string	\xe0\x1f
+>>+0	use	ttcomp-display
+>-2	string	\xf0\x0f
+>>+0	use	ttcomp-display
+>-2	string	\xf8\x07
+>>+0	use	ttcomp-display
+>-2	string	\xfc\x03
+>>+0	use	ttcomp-display
+>-2	string	\xfe\x01
+>>+0	use	ttcomp-display
+# display information of TTComp archive
+0	name	ttcomp-display
 # (version 5.25) labeled the entry as "TTComp archive data"
 >0	ubyte	x	TTComp archive data
 !:mime	application/x-compress-ttcomp
@@ -746,23 +765,10 @@
 >0	ubyte	0	\b, binary
 >0	ubyte	1	\b, ASCII
 # size of the dictionary:  4~1024 bytes 5~2048 bytes 6~4096 bytes 
->1	ubyte	4	\b, 1K
->1	ubyte	5	\b, 2K
->1	ubyte	6	\b, 4K
->1	ubyte	x	dictionary
-#	https://mark0.net/forum/index.php?topic=848
-# last 3 bytes probably have only 8 possible bit sequences
-# xxxxxxxx 0000000x 11111111	____FFh
-# xxxxxxxx 10000000 01111111	__807Fh	
-# 0xxxxxxx 11000000 00111111	__C03Fh
-# 00xxxxxx 11100000 00011111	__E01Fh
-# 000xxxxx 11110000 00001111	__F00Fh
-# 0000xxxx 11111000 00000111	__F807h
-# 00000xxx 11111100 00000011	__FC03h
-# 000000xx 11111110 00000001	__FE01h
-# but for quickgif.__d 0A7DD4h
-#>-3	ubyte		x	\b, last 3 bytes 0x%2.2x
-#>-2	ubeshort	x	\b%4.4x
+>1	ubyte	4	\b, 1K dictionary
+>1	ubyte	5	\b, 2K dictionary
+>1	ubyte	6	\b, 4K dictionary
+
 # From:		Joerg Jenderek
 # URL:		https://en.wikipedia.org/wiki/Disk_Copy
 # reference:	http://nulib.com/library/FTN.e00005.htm
@@ -1231,6 +1237,8 @@
 #>0x200	ubequad	x	\b, at 0x200 %#16.16llx
 # cab_descriptor_size like: 0 (*.cab) BD5 C8B DA5 E2A E36 116C 251D 4DA9 56F0 5CC2 6E4B 777D 779E 1F7C2
 >16	ulelong	!0	\b, descriptor size %#x
+>(12.l+40)      lelong  x               ]b, %u files
+
 # TOP4
 0	string	T4\x1a TOP4 archive data
 # BatComp left out: sig looks like COM executable
@@ -1491,22 +1499,18 @@
 >>9	ubyte		!2		\b, security version %u
 # file type; 2 in main header; 0~binary 1~7-bitText 2~comment 3~directory 4~VolumeLabel 5=ChapterLabel
 >0xA	ubyte		!2		\b, file type %u
-# date+time when original archive was created in MS-DOS format via ./msdos
->0xC	ulelong		x		\b, created
->0xC	use		dos-date
-# or date and time by new internal function
-#>0xE	lemsdosdate	x		%s
-#>0xC	lemsdostime	x		%s
+# date+time when original archive was created in MS-DOS format
+>0xE	lemsdosdate	x		\b, created %s
+>0xC	lemsdostime	x		%s
+# Archive mod time, added in format v6 (ARJ 2.39c)
+>5	ubyte		>5
+>>0x10	ulelong		>0		\b, modified
+>>>0x12	lemsdosdate	x		%s
+>>>0x10	lemsdostime	x		%s
+
 # FOR DEBUGGING
 #>0x12	uleshort	x		RAW DATE %#4.4x
 #>0x10	uleshort	x		RAW TIME %#4.4x
-# date+time when archive was last modified; sometimes nil or
-# maybe wrong like in HP4DRVR.ARJ
-#>0x10	ulelong		>0		\b, modified
-#>>0x10	use		dos-date
-# or date and time by new internal function
-#>>0x12	lemsdosdate	x		%s
-#>>0x10	lemsdostime	x		%s
 # archive size (currently used only for secured archives); MAYBE?
 #>0x14	ulelong		!0		\b, file size %u
 # security envelope file position; MAYBE?
@@ -1795,6 +1799,51 @@
 !:ext zip/cbz
 
 
+# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+#   Next line excludes specialized formats:
+0	name	zipgeneric
+>4	beshort		x			Zip archive data, at least
+!:mime	application/zip
+>4	use		zipversion
+>4	beshort		x			to extract
+>8	beshort		x			\b, compression method=
+>8	use		zipcompression
+>0x161	string		WINZIP		\b, WinZIP self-extracting
+
+# Zip archives that can be either APK or JAR. Checks for resources.arsc, classes.dex, etc.
+0	name	apk_or_jar
+# Contains resources.arsc (near the end, in the central directory)
+>-512	search	resources.arsc	Android package (APK), with MANIFEST.MF and resources.arsc
+!:mime	application/vnd.android.package-archive
+!:ext	apk
+>>-22	string	PK\005\006
+>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
+>-512	default x
+# Contains classes.dex (near the end, in the central directory)
+>>-512	search	classes.dex	Android package (APK), with MANIFEST.MF and classes.dex
+!:mime	application/vnd.android.package-archive
+!:ext	apk
+>>>-22	string	PK\005\006
+>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
+>>-512	default x
+# Contains lib/armeabi (near the end, in the central directory)
+>>>-512	search	lib/armeabi	Android package (APK), with MANIFEST.MF and armeabi lib
+!:mime	application/vnd.android.package-archive
+!:ext	apk
+>>>>-22	string	PK\005\006
+>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
+>>>-512	default x
+# Contains drawables (near the end, in the central directory)
+>>>>-512	search	res/drawable	Android package (APK), with MANIFEST.MF and drawables
+!:mime	application/vnd.android.package-archive
+!:ext	apk
+>>>>>-22	string	PK\005\006
+>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
+# It may or may not be an APK file, but it's definitely a Java JAR file
+>>>>-512	default x	Java archive data (JAR)
+!:mime	application/java-archive
+!:ext	jar
+
 0	string		PK\003\004
 !:strength +1
 # IOS/IPadOS IPA file (Zip archive)
@@ -1830,40 +1879,14 @@
 >>>-22	string	PK\005\006
 >>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
 # Starts with META-INF/MANIFEST.MF (file name length = 20)
-# NB: checks for resources.arsc, classes.dex, etc. as well to avoid matching JAR files
 >26	uleshort	20
 >>30	string	META-INF/MANIFEST.MF
-# Contains resources.arsc (near the end, in the central directory)
->>>-512	search	resources.arsc	Android package (APK), with MANIFEST.MF and resources.arsc
-!:mime	application/vnd.android.package-archive
-!:ext	apk
->>>>-22	string	PK\005\006
->>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
->>>-512	default x
-# Contains classes.dex (near the end, in the central directory)
->>>>-512	search	classes.dex	Android package (APK), with MANIFEST.MF and classes.dex
-!:mime	application/vnd.android.package-archive
-!:ext	apk
->>>>>-22	string	PK\005\006
->>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
->>>>-512	default x
-# Contains lib/armeabi (near the end, in the central directory)
->>>>>-512	search	lib/armeabi	Android package (APK), with MANIFEST.MF and armeabi lib
-!:mime	application/vnd.android.package-archive
-!:ext	apk
->>>>>>-22	string	PK\005\006
->>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
->>>>>-512	default x
-# Contains drawables (near the end, in the central directory)
->>>>>>-512	search	res/drawable	Android package (APK), with MANIFEST.MF and drawables
-!:mime	application/vnd.android.package-archive
-!:ext	apk
->>>>>>>-22	string	PK\005\006
->>>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
-# It may or may not be an APK file, but it's definitely a Java JAR file
->>>>>>-512	default x	Java archive data (JAR)
-!:mime	application/java-archive
-!:ext	jar
+>>>0	use		apk_or_jar
+# Starts with META-INF/ folder (file name length = 9)
+>26	uleshort	9
+>>30	string	META-INF/
+>>>0	use		apk_or_jar
+
 # Starts with zipflinger virtual entry (28 + 104 = 132 bytes)
 # See https://github.com/obfusk/apksigcopier/blob/666f5b7/apksigcopier/__init__.py#L230
 >4	string	\x00\x00\x00\x00\x00\x00
@@ -2132,17 +2155,11 @@
 >>>>>>(-6.l)	search/9000	kmp.json	Keyman Compiled Package File
 !:mime	application/vnd.keyman.kmp+zip
 !:ext kmp
+>>>>>+4	default		x
+>>>>>>0	use		zipgeneric
 
-# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
-#   Next line excludes specialized formats:
 >>>>+4	default		x
->>>>>4	beshort		x			Zip archive data, at least
-!:mime	application/zip
->>>>>4	use		zipversion
->>>>>4	beshort		x			to extract
->>>>>8	beshort		x			\b, compression method=
->>>>>8	use		zipcompression
->>>>>0x161	string		WINZIP		\b, WinZIP self-extracting
+>>>>>0	use		zipgeneric
 
 # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
 0	string		PK\005\006	Zip archive data (empty)
@@ -2810,3 +2827,55 @@
 >>37	byte		x	\b:%02d
 >>38	byte		x	\b:%02d
 >>56	ulelong		x	\b, size: %u bytes
+
+# Stone archive file - Serpent OS moss package manager's native format
+# https://github.com/serpent-os/tools,
+# (Ikey Doherty)
+0	string	\0mos	Stone archive
+>28	belong	1	(format v%d)
+>>27	byte	1	binary package
+!:mime	application/x-stone-binary
+!:ext	stone
+>>27	byte	2	delta package
+!:mime	application/x-stone-delta
+!:ext	stone
+>>27	byte	3	repository index
+!:mime	application/x-stone-repository
+!:ext	index
+>>27	byte	4	build manifest
+!:mime	application/x-stone-manifest
+!:ext	bin
+
+# * VOS <file_name> <sequential|relative|fixed|stream> <record_size> ,
+# * [encapsulated|not_encapsulated] =
+# * [encoded|not_encoded|seq_encoded|base64_encoded]
+0	string		VOS\040	Stratus OpenVOS EFV archive
+>4	regex	[^[:space:]]+ 	\b, (%s)
+>>&0	regex	[^[:space:]]+	\b, %s
+>>>&0	regex	[^[:space:]]+	\b, record_size=%s
+>>>>&0	regex	[^[:space:]]+	\b, %s
+>>>>>&0	regex	[^[:space:]]+	\b, %s
+
+
+# https://www.vm.ibm.com/devpages/bkw/vmarc.html magic in EBCDIC
+0	string	\x7a\xc3\xc6\xc6\x40\x40\x40\x40	VM Archive
+
+# https://pbs.proxmox.com/docs/file-formats.html
+0	string	\x42\xab\x38\x07\xbe\x83\x70\xa1 Proxmox Backup Server unencrypted uncompressed blob
+
+0	string	\x31\xb9\x58\x42\x6f\xb6\xa3\x7f Proxmox Backup Server unencrypted compressed blob
+
+0	string	\x7b\x67\x85\xbe\x22\x2d\x4c\xf0 Proxmox Backup Server encrypted uncompressed blob
+
+0	string	\xe6\x59\x1b\xbf\x0b\xbf\xd8\x0b Proxmox Backup Server encrypted compressed blob
+
+0	string	\x2f\x7f\x41\xed\x91\xfd\x0f\xcd Proxmox Backup Server fixed index
+
+0	string	\x1c\x91\x4e\xa5\x19\xba\xb3\xcd Proxmox Backup Server dynamic index
+
+0	string	\xef\xac\x88\xe5\x74\x64\x95\xd5 Proxmox File Archive Format v1 / pxar
+
+0	string	\x0d\xa4\x16\xdf\x75\x6c\x0f\x73\x18\x00\x00\x00\x00\x00\x00\x00\x02 Proxmox File Archive Format v2+ / mpxar
+
+0	string	\xd2\x4e\x4a\x19\xc2\x68\x4c\x83\x10 Proxmox File Archive Format payload stream / ppxar
+
diff --git a/contrib/file/magic/Magdir/audio b/contrib/file/magic/Magdir/audio
index 991b75999608..e630663af86a 100644
--- a/contrib/file/magic/Magdir/audio
+++ b/contrib/file/magic/Magdir/audio
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.133 2024/09/04 19:07:20 christos Exp $
+# $File: audio,v 1.136 2026/01/23 17:02:27 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -957,7 +957,7 @@
 >>3		byte		4	(With no LAME header)
 >>3		byte		5	Version 2.4
 
-0		string		ADRVPACK	AProSys	module
+0		string		ADRVPACK	AProSys module
 
 # ftp://ftp.modland.com/pub/documents/format_documentation/\
 # Art%20Of%20Noise%20(.aon).txt
@@ -1199,6 +1199,13 @@
 >4	beshort		0xFEFF
 >>0	use		\^nintendo-3ds-bcwav-fields
 
+
+# QOA Quite Okay Audio format
+# https://qoaformat.org/qoa-specification.pdf
+# added by alex myczko <tar@debian.org>
+0	string	qoaf	QOA audio data
+>4	belong	x	\b, %d samples per channel
+
 # Philips DSDIFF audio format (Direct Stream Digital Interchange File Format)
 # Used for DSD audio recordings and Super Audio CD (SACD) mastering annotations
 # https://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf
@@ -1338,3 +1345,6 @@
 >50	leshort	x		\b, scaleX %d
 >52	byte	0		\b, percussive
 >52	byte	1		\b, melodic
+
+# https://pbat.ch/proj/protrekkr/
+0	string	PROTREKT	Protrekkr Module
diff --git a/contrib/file/magic/Magdir/bgcode b/contrib/file/magic/Magdir/bgcode
new file mode 100644
index 000000000000..407827916df3
--- /dev/null
+++ b/contrib/file/magic/Magdir/bgcode
@@ -0,0 +1,9 @@
+#------------------------------------------------------------------------------
+# $File: bgcode,v 1.1 2025/03/10 21:02:05 christos Exp $
+
+# BGCode
+0	string		GCDE	Binary G-code
+!:ext bgcode,bgc
+>4	ulelong		x		Version %u
+>>8 uleshort	0		\b, no checksum
+>>8 uleshort	1		\b, CRC32 checksum
diff --git a/contrib/file/magic/Magdir/blender b/contrib/file/magic/Magdir/blender
index 5a897113e092..456e3f331134 100644
--- a/contrib/file/magic/Magdir/blender
+++ b/contrib/file/magic/Magdir/blender
@@ -1,6 +1,5 @@
-
 #------------------------------------------------------------------------------
-# $File: blender,v 1.9 2022/12/21 15:53:27 christos Exp $
+# $File: blender,v 1.10 2026/01/10 14:38:14 christos Exp $
 # blender: file(1) magic for Blender 3D related files
 #
 # Native format rule v1.2. For questions use the developers list
@@ -13,13 +12,13 @@
 #		http://formats.kaitai.io/blender_blend/index.html
 # Note:		called "Blender 3D data" by TrID
 #		and gzip compressed variant handled by ./compress
-0		string	=BLENDER	Blender3D,
+0		string	=BLENDER	Blender3D
 #!:mime		application/octet-stream
 !:mime		application/x-blender
 !:ext		blend
 # no sample found with extension blender
 #!:ext		blend/blender
->7		string	=_		saved as 32-bits
+>7		string	=_		pre-v5, saved as 32-bits
 >>8		string	=v		little endian
 >>>9		byte	x		with version %c.
 >>>10		byte	x		\b%c
@@ -32,7 +31,7 @@
 >>>11		byte	x		\b%c
 >>>0x40		string	=GLOB		\b.
 >>>>0x58	beshort	x		\b%.4d
->7		string	=-		saved as 64-bits
+>7		string	=-		pre-v5, saved as 64-bits
 >>8		string	=v		little endian
 >>9		byte	x		with version %c.
 >>10		byte	x		\b%c
@@ -46,5 +45,15 @@
 >>>0x44		string	=GLOB		\b.
 >>>>0x60	beshort	x		\b%.4d
 
+# Blender 5.0+
+>7		string =17    v5+,
+>>10		byte	x		format version %c
+>>>11		byte	x		\b%c
+>>>>13		byte	x		app version %c
+>>>>>14		byte	x		\b%c
+>>>>>>15		byte	x		\b%c
+>>>>>>>16		byte	x		\b%c
+#
+
 # Scripts that run in the embedded Python interpreter
 0		string	#!BPY		Blender3D BPython script
diff --git a/contrib/file/magic/Magdir/bytecode b/contrib/file/magic/Magdir/bytecode
index dca961c26431..263f27e09c6e 100644
--- a/contrib/file/magic/Magdir/bytecode
+++ b/contrib/file/magic/Magdir/bytecode
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------
-# $File: bytecode,v 1.5 2023/02/20 16:25:05 christos Exp $
+# $File: bytecode,v 1.6 2026/02/16 14:39:53 christos Exp $
 # magic for various bytecodes
 
 # From: Mikhail Gusarov <dottedmag@dottedmag.net>
@@ -34,8 +34,15 @@
 # https://racket-lang.org/
 # https://github.com/racket/racket/blob/master/racket/src/expander/compile/write-linklet.rkt
 0	string	#~
->&0	pstring	x
->>&0	pstring	racket
+>&0	pstring x
+>>&0	pstring racket
 >>>0	string	#~	Racket bytecode
->>>>&0	pstring	x       (version %s)
+>>>>&0	pstring x	(version %s)
+
+
+# From: Marc Chantreux <mc@unistra.fr>
+# [MoarVM](https://www.moarvm.org/) bytecode file
+0	string	MOARVM\x0d\x0a	MoarVM bytecode
+!:ext	mbc
+>0x9	short	>0	\b, version %u
 
diff --git a/contrib/file/magic/Magdir/c-lang b/contrib/file/magic/Magdir/c-lang
index 6e375a06a7e6..4b203e6fddd8 100644
--- a/contrib/file/magic/Magdir/c-lang
+++ b/contrib/file/magic/Magdir/c-lang
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.32 2023/06/16 19:57:19 christos Exp $
+# $File: c-lang,v 1.38 2025/05/30 13:36:08 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 # The strength is to beat standard HTML
@@ -17,7 +17,7 @@
 >>0	regex	\^class[[:space:]]+
 >>>&0	regex 	\\{[\.\*]\\}(;)?$			\b++
 >>&0	clear	x				source text
-!:strength + 15
+!:strength + 30
 !:mime	text/x-c
 0	search/8192	pragma
 >0	regex	\^#[[:space:]]*pragma	C source text
@@ -27,8 +27,7 @@
 >>&0	regex	\^#[[:space:]]*endif$	C source text
 !:mime	text/x-c
 0	search/8192	define
->0	regex	\^#[[:space:]]*(if\|ifn)def
->>&0	regex	\^#[[:space:]]*define	C source text
+>0	regex	\^#[[:space:]]*define	C source text
 !:mime	text/x-c
 0	search/8192	char
 >0	regex	\^[[:space:]]*char(\ \\*|\\*)(.+)(=.*)?;[[:space:]]*$			C source text
@@ -58,21 +57,21 @@
 # C++
*** 4732 LINES SKIPPED ***