summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:52:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:52:52 +0000
commit424f663819ec59abc4edab03a667845835e57ac1 (patch)
tree63b79645aaee07c3de90e4b70dd8d6371faa1747 /debian/patches
parentAdding upstream version 1:5.44. (diff)
downloadfile-debian/1%5.44-3.tar.xz
file-debian/1%5.44-3.zip
Adding debian version 1:5.44-3.debian/1%5.44-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/1672082456.FILE5_44-5-g813b3304.pr-410-pandrew-add-bitcoin-and-leveldb-support.patch37
-rw-r--r--debian/patches/1672518248.FILE5_44-9-gdc71304b.pyzip-improvements-fc-stegerman.patch23
-rw-r--r--debian/patches/1673481589.FILE5_44-14-gbb955ca3.jar-manifest-signature-file-pkcs-7-signed-data-fc-stegerman.patch31
-rw-r--r--debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch103
-rw-r--r--debian/patches/1673482012.FILE5_44-16-gb29519e7.detect-android-apk-files-fc-stegerman.patch73
-rw-r--r--debian/patches/1673482186.FILE5_44-17-g4c8ee2e7.detect-smali-files-fc-stegerman.patch16
-rw-r--r--debian/patches/1673482234.FILE5_44-18-g9fa5e784.detect-android-art-baseline-profiles-found-in-apk-files.patch32
-rw-r--r--debian/patches/1673482275.FILE5_44-19-g4341ed61.detect-android-package-resource-table-arsc-fc-stegerman.patch30
-rw-r--r--debian/patches/1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch47
-rw-r--r--debian/patches/1674058221.FILE5_44-23-gbaf1f4b4.add-mime-type-to-html-fc-stegerman.patch15
-rw-r--r--debian/patches/1674058358.FILE5_44-24-gc4361a10.improve-detection-of-apk-files-if-we-find-a-manifest-file-at-least-say.patch109
-rw-r--r--debian/patches/1674400026.FILE5_44-29-g1e4b7389.increase-strength-to-beat-targa-fc-stegerman.patch17
-rw-r--r--debian/patches/local.don-t-include-libs-in-build.patch17
-rw-r--r--debian/patches/local.extra-magic.patch15
-rw-r--r--debian/patches/local.manpage-seccomp-is-disabled.patch18
-rw-r--r--debian/patches/local.support-local-definitions-in-etc-magic.patch92
-rw-r--r--debian/patches/series25
-rw-r--r--debian/patches/upstream.disable.att3b.patch43
-rw-r--r--debian/patches/upstream.mute-debug-warning.patch25
19 files changed, 768 insertions, 0 deletions
diff --git a/debian/patches/1672082456.FILE5_44-5-g813b3304.pr-410-pandrew-add-bitcoin-and-leveldb-support.patch b/debian/patches/1672082456.FILE5_44-5-g813b3304.pr-410-pandrew-add-bitcoin-and-leveldb-support.patch
new file mode 100644
index 0000000..67bb590
--- /dev/null
+++ b/debian/patches/1672082456.FILE5_44-5-g813b3304.pr-410-pandrew-add-bitcoin-and-leveldb-support.patch
@@ -0,0 +1,37 @@
+Subject: PR/410: pandrew: Add bitcoin and leveldb support
+Origin: FILE5_44-5-g813b3304 <https://github.com/file/file/commit/FILE5_44-5-g813b3304>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Mon Dec 26 19:20:56 2022 +0000
+
+--- a/magic/Magdir/crypto
++++ b/magic/Magdir/crypto
+@@ -3,3 +3,29 @@
+ # $File: crypto,v 1.2 2021/03/27 20:15:53 christos Exp $
+ # crypto: file(1) magic for crypto formats
+ #
++# Bitcoin block files
++0 lelong 0xD9B4BEF9 Bitcoin
++>(4.l+40) lelong 0xD9B4BEF9 reverse block
++>>4 lelong x \b, size %u
++# normal block below
++>0 default x block
++>>4 lelong x \b, size %u
++>>8 lelong&0xE0000000 0x20000000
++>>>8 lelong x \b, BIP9 0x%x
++>>8 lelong&0xE0000000 !0x20000000
++>>>8 lelong x \b, version 0x%x
++>>76 ledate x \b, %s UTC
++# VarInt counter
++>>88 ubyte <0xfd \b, txcount %u
++>>88 ubyte 0xfd
++>>>89 leshort x \b, txcount %u
++>>88 ubyte 0xfe
++>>>89 lelong x \b, txcount %u
++>>88 ubyte 0xff
++>>>89 lequad x \b, txcount %llu
++!:ext dat
++# option to find more blocks in the file
++#>>(4.l+8) indirect x ;
++
++# LevelDB
++-8 lequad 0xdb4775248b80fb57 LevelDB table data
diff --git a/debian/patches/1672518248.FILE5_44-9-gdc71304b.pyzip-improvements-fc-stegerman.patch b/debian/patches/1672518248.FILE5_44-9-gdc71304b.pyzip-improvements-fc-stegerman.patch
new file mode 100644
index 0000000..cef7d42
--- /dev/null
+++ b/debian/patches/1672518248.FILE5_44-9-gdc71304b.pyzip-improvements-fc-stegerman.patch
@@ -0,0 +1,23 @@
+Subject: Pyzip improvements (FC Stegerman)
+Origin: FILE5_44-9-gdc71304b <https://github.com/file/file/commit/FILE5_44-9-gdc71304b>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Sat Dec 31 20:24:08 2022 +0000
+
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1876,9 +1876,14 @@
+ # https://en.wikipedia.org/wiki/ZIP_(file_format)#End_of_central_directory_record_(EOCD)
+ # by Michal Gorny <mgorny@gentoo.org>
+ -2 uleshort 0
+->&-22 string PK\005\006 Zip archive, with extra data prepended
++>&-22 string PK\005\006
++# without #!
++>>0 string !#! Zip archive, with extra data prepended
+ !:mime application/zip
+ !:ext zip/cbz
++# with #!
++>>0 string/w #!\ a
++>>>&-1 string/T x %s script executable (Zip archive)
+
+ # ACE archive (from http://www.wotsit.org/download.asp?f=ace)
+ # by Stefan `Sec` Zehl <sec@42.org>
diff --git a/debian/patches/1673481589.FILE5_44-14-gbb955ca3.jar-manifest-signature-file-pkcs-7-signed-data-fc-stegerman.patch b/debian/patches/1673481589.FILE5_44-14-gbb955ca3.jar-manifest-signature-file-pkcs-7-signed-data-fc-stegerman.patch
new file mode 100644
index 0000000..44537f9
--- /dev/null
+++ b/debian/patches/1673481589.FILE5_44-14-gbb955ca3.jar-manifest-signature-file-pkcs-7-signed-data-fc-stegerman.patch
@@ -0,0 +1,31 @@
+Subject: JAR Manifest & Signature File, PKCS#7 Signed Data (FC Stegerman)
+Origin: FILE5_44-14-gbb955ca3 <https://github.com/file/file/commit/FILE5_44-14-gbb955ca3>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Wed Jan 11 23:59:49 2023 +0000
+
+--- a/magic/Magdir/der
++++ b/magic/Magdir/der
+@@ -137,3 +137,10 @@
+ >>>>&0 der seq
+ >>>>>&0 der obj_id3=550403
+ >>>>>&0 der utf8_str=x \b, Subject=%s
++
++# PKCS#7 Signed Data (e.g. JAR Signature Block File)
++# OID 1.2.840.113549.1.7.2 (2a864886f70d010702)
++# Reference: https://www.rfc-editor.org/rfc/rfc2315
++0 der seq
++>&0 der obj_id9=2a864886f70d010702 DER Encoded PKCS#7 Signed Data
++!:ext RSA/DSA/EC
+--- a/magic/Magdir/java
++++ b/magic/Magdir/java
+@@ -43,3 +43,10 @@
+ >6 leshort >0x00 \b, version %d
+ >4 leshort x \b.%d
+ !:mime application/x-java-image
++
++# JAR Manifest & Signature File
++# Reference: https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html
++0 string/t Manifest-Version:\x201.0 JAR Manifest
++!:ext MF
++0 string/t Signature-Version:\x201.0 JAR Signature File
++!:ext SF
diff --git a/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch b/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch
new file mode 100644
index 0000000..f0b5529
--- /dev/null
+++ b/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch
@@ -0,0 +1,103 @@
+Subject: Improve JavaScript detection (FC Stegerman)
+Origin: FILE5_44-15-ga2756aa5 <https://github.com/file/file/commit/FILE5_44-15-ga2756aa5>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Jan 12 00:02:16 2023 +0000
+
+--- a/magic/Magdir/javascript
++++ b/magic/Magdir/javascript
+@@ -3,18 +3,68 @@
+ # $File: javascript,v 1.4 2022/09/02 08:08:17 christos Exp $
+ # javascript: magic for javascript and node.js scripts.
+ #
+-0 string/w #!/bin/node Node.js script text executable
++0 string/tw #!/bin/node Node.js script executable
+ !:mime application/javascript
+-0 string/w #!/usr/bin/node Node.js script text executable
++0 string/tw #!/usr/bin/node Node.js script executable
+ !:mime application/javascript
+-0 string/w #!/bin/nodejs Node.js script text executable
++0 string/tw #!/bin/nodejs Node.js script executable
+ !:mime application/javascript
+-0 string/w #!/usr/bin/nodejs Node.js script text executable
+-!:mime application/javascript
+-0 string #!/usr/bin/env\ node Node.js script text executable
+-!:mime application/javascript
+-0 string #!/usr/bin/env\ nodejs Node.js script text executable
++0 string/tw #!/usr/bin/nodejs Node.js script executable
+ !:mime application/javascript
++0 string/t #!/usr/bin/env\ node Node.js script executable
++!:mime application/javascript
++0 string/t #!/usr/bin/env\ nodejs Node.js script executable
++!:mime application/javascript
++
++# JavaScript
++# The strength is increased to beat the C++ & HTML rules
++0 search "use\x20strict" JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 search 'use\x20strict' JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex module(\\.|\\[["'])exports.*= JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \^(const|var|let).*=.*require\\( JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \^export\x20(function|class|default|const|var|let|async)\x20 JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \\((async\x20)?function[(\x20] JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \^(import|export).*\x20from\x20 JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \^(import|export)\x20["']\\./ JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex \^require\\(["'] JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++0 regex typeof.*[!=]== JavaScript source
++!:strength +30
++!:mime application/javascript
++!:ext js
++
++# React Native minified JavaScript
++0 search/128 __BUNDLE_START_TIME__= React Native minified JavaScript
++!:strength +30
++!:mime application/javascript
++!:ext bundle/jsbundle
++
+ # Hermes by Facebook https://hermesengine.dev/
+ # https://github.com/facebook/hermes/blob/master/include/hermes/\
+ # BCGen/HBC/BytecodeFileFormat.h#L24
+--- a/magic/Magdir/sgml
++++ b/magic/Magdir/sgml
+@@ -50,6 +50,16 @@
+ !:mime text/html
+ !:strength + 5
+
++# avoid misdetection as JavaScript
++0 string/cWt \<!doctype\ html HTML document text
++!:mime text/html
++0 string/ct \<html> HTML document text
++!:mime text/html
++0 string/ct \<!--
++>&0 search/4096/cWt \<!doctype\ html HTML document text
++>&0 search/4096/ct \<html> HTML document text
++!:mime text/html
++
+ # SVG document
+ # https://www.w3.org/TR/SVG/single-page.html
+ 0 search/4096/cWbt \<!doctype\ svg SVG XML document
diff --git a/debian/patches/1673482012.FILE5_44-16-gb29519e7.detect-android-apk-files-fc-stegerman.patch b/debian/patches/1673482012.FILE5_44-16-gb29519e7.detect-android-apk-files-fc-stegerman.patch
new file mode 100644
index 0000000..89b1408
--- /dev/null
+++ b/debian/patches/1673482012.FILE5_44-16-gb29519e7.detect-android-apk-files-fc-stegerman.patch
@@ -0,0 +1,73 @@
+Subject: Detect Android APK files (FC Stegerman)
+Origin: FILE5_44-16-gb29519e7 <https://github.com/file/file/commit/FILE5_44-16-gb29519e7>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Jan 12 00:06:52 2023 +0000
+
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1505,6 +1505,65 @@
+ !:mime application/zip
+ !:ext zip/cbz
+
++# Android APK file (Zip archive)
++0 string PK\003\004
++!:strength +1
++# Starts with AndroidManifest.xml (file name length = 19)
++>26 uleshort 19
++>>30 string AndroidManifest.xml Android package (APK), with AndroidManifest.xml
++>>>-22 string PK\005\006
++>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++# Starts with META-INF/com/android/build/gradle/app-metadata.properties
++>26 uleshort 57
++>>30 string META-INF/com/android/build/gradle/
++>>>&0 string app-metadata.properties Android package (APK), with gradle app-metadata.properties
++>>>>-22 string PK\005\006
++>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++# Starts with classes.dex (file name length = 11)
++>26 uleshort 11
++>>30 string classes.dex Android package (APK), with classes.dex
++>>>-22 string PK\005\006
++>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++# Starts with META-INF/MANIFEST.MF (file name length = 20)
++# NB: checks for resources.arsc or drawables 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
++>>>>-22 string PK\005\006
++>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++>>>-512 default x
++# Contains drawables (near the end, in the central directory)
++>>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
++>>>>>-22 string PK\005\006
++>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++# 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
++>>&0 string \x21\x08\x21\x02
++>>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
++>>>>&0 string \x00\x00 Android package (APK), with zipflinger virtual entry
++>>>>>-22 string PK\005\006
++>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++# APK Signing Block
++>0 default x
++>>-22 string PK\005\006
++>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 Android package (APK), with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++
+ # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+ 0 string PK\005\006 Zip archive data (empty)
+ !:mime application/zip
diff --git a/debian/patches/1673482186.FILE5_44-17-g4c8ee2e7.detect-smali-files-fc-stegerman.patch b/debian/patches/1673482186.FILE5_44-17-g4c8ee2e7.detect-smali-files-fc-stegerman.patch
new file mode 100644
index 0000000..96b069d
--- /dev/null
+++ b/debian/patches/1673482186.FILE5_44-17-g4c8ee2e7.detect-smali-files-fc-stegerman.patch
@@ -0,0 +1,16 @@
+Subject: Detect .smali files (FC Stegerman)
+Origin: FILE5_44-17-g4c8ee2e7 <https://github.com/file/file/commit/FILE5_44-17-g4c8ee2e7>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Jan 12 00:09:46 2023 +0000
+
+--- a/magic/Magdir/android
++++ b/magic/Magdir/android
+@@ -207,3 +207,8 @@
+ >8 string >000 dex section version: %s,
+ >12 lelong >0 number of dex files: %d,
+ >16 lelong >0 verifier deps size: %d
++
++# Disassembled DEX files
++0 string/t .class\x20
++>&0 regex/512 \^\\.super\x20L.*;$ disassembled Android DEX Java class (smali/baksmali)
++!:ext smali
diff --git a/debian/patches/1673482234.FILE5_44-18-g9fa5e784.detect-android-art-baseline-profiles-found-in-apk-files.patch b/debian/patches/1673482234.FILE5_44-18-g9fa5e784.detect-android-art-baseline-profiles-found-in-apk-files.patch
new file mode 100644
index 0000000..7a9d585
--- /dev/null
+++ b/debian/patches/1673482234.FILE5_44-18-g9fa5e784.detect-android-art-baseline-profiles-found-in-apk-files.patch
@@ -0,0 +1,32 @@
+Subject: Detect Android ART (baseline) profiles found in APK files. (FC Stegerman)
+Origin: FILE5_44-18-g9fa5e784 <https://github.com/file/file/commit/FILE5_44-18-g9fa5e784>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Jan 12 00:10:34 2023 +0000
+
+--- a/magic/Magdir/android
++++ b/magic/Magdir/android
+@@ -212,3 +212,24 @@
+ 0 string/t .class\x20
+ >&0 regex/512 \^\\.super\x20L.*;$ disassembled Android DEX Java class (smali/baksmali)
+ !:ext smali
++
++# Android ART (baseline) profile + metadata: baseline.prof, baseline.profm
++# Reference: https://android.googlesource.com/platform/frameworks/support/\
++# +/refs/heads/androidx-main/profileinstaller/profileinstaller/\
++# src/main/java/androidx/profileinstaller/ProfileTranscoder.java
++# Reference: https://android.googlesource.com/platform/frameworks/support/\
++# +/refs/heads/androidx-main/profileinstaller/profileinstaller/\
++# src/main/java/androidx/profileinstaller/ProfileVersion.java
++0 string pro\x00
++>0 regex pro\x000[0-9][0-9]\x00 Android ART profile
++!:ext prof
++>>4 string 001\x00 \b, version 001 N
++>>4 string 005\x00 \b, version 005 O
++>>4 string 009\x00 \b, version 009 O MR1
++>>4 string 010\x00 \b, version 010 P
++>>4 string 015\x00 \b, version 015 S
++0 string prm\x00
++>0 regex prm\x000[0-9][0-9]\x00 Android ART profile metadata
++!:ext profm
++>>4 string 001\x00 \b, version 001 N
++>>4 string 002\x00 \b, version 002
diff --git a/debian/patches/1673482275.FILE5_44-19-g4341ed61.detect-android-package-resource-table-arsc-fc-stegerman.patch b/debian/patches/1673482275.FILE5_44-19-g4341ed61.detect-android-package-resource-table-arsc-fc-stegerman.patch
new file mode 100644
index 0000000..2184e42
--- /dev/null
+++ b/debian/patches/1673482275.FILE5_44-19-g4341ed61.detect-android-package-resource-table-arsc-fc-stegerman.patch
@@ -0,0 +1,30 @@
+Subject: Detect Android package resource table (ARSC) (FC Stegerman)
+Origin: FILE5_44-19-g4341ed61 <https://github.com/file/file/commit/FILE5_44-19-g4341ed61>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Jan 12 00:11:15 2023 +0000
+
+--- a/magic/Magdir/android
++++ b/magic/Magdir/android
+@@ -233,3 +233,22 @@
+ !:ext profm
+ >>4 string 001\x00 \b, version 001 N
+ >>4 string 002\x00 \b, version 002
++
++# Android package resource table (ARSC): resources.arsc
++# Reference: https://android.googlesource.com/platform/tools/base/\
++# +/refs/heads/mirror-goog-studio-main/apkparser/binary-resources/\
++# src/main/java/com/google/devrel/gmscore/tools/apk/arsc
++# 00: resource table type = 0x0002 (2) + header size = 12 (2)
++# 04: chunk size (4, skipped)
++# 08: #packages (4)
++0 ulelong 0x000c0002 Android package resource table (ARSC)
++!:ext arsc
++>8 ulelong !1 \b, %d packages
++# 12: string pool type = 0x0001 (2) + header size = 28 (2)
++# 16: chunk size (4, skipped)
++# 20: #strings (4), #styles (4), flags (4)
++>12 ulelong 0x001c0001
++>>20 ulelong !0 \b, %d string(s)
++>>24 ulelong !0 \b, %d style(s)
++>>28 ulelong &1 \b, sorted
++>>28 ulelong &256 \b, utf8
diff --git a/debian/patches/1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch b/debian/patches/1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch
new file mode 100644
index 0000000..256f66f
--- /dev/null
+++ b/debian/patches/1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch
@@ -0,0 +1,47 @@
+Subject: Improve APK detection (FC Stegerman)
+Origin: FILE5_44-22-g6d565d82 <https://github.com/file/file/commit/FILE5_44-22-g6d565d82>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Sat Jan 14 19:43:33 2023 +0000
+
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1531,7 +1531,7 @@
+ !:mime application/vnd.android.package-archive
+ !:ext apk
+ # Starts with META-INF/MANIFEST.MF (file name length = 20)
+-# NB: checks for resources.arsc or drawables as well to avoid matching JAR files
++# 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)
+@@ -1540,13 +1540,27 @@
+ >>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !:mime application/vnd.android.package-archive
+ !:ext apk
+->>>-512 default x
+-# Contains drawables (near the end, in the central directory)
+->>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
++>>>-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
+ >>>>>-22 string PK\005\006
+ >>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !:mime application/vnd.android.package-archive
+ !:ext apk
++>>>>-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
++>>>>>>-22 string PK\005\006
++>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
++>>>>>-512 default x
++# Contains drawables (near the end, in the central directory)
++>>>>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
++>>>>>>>-22 string PK\005\006
++>>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
++!:mime application/vnd.android.package-archive
++!:ext apk
+ # 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
diff --git a/debian/patches/1674058221.FILE5_44-23-gbaf1f4b4.add-mime-type-to-html-fc-stegerman.patch b/debian/patches/1674058221.FILE5_44-23-gbaf1f4b4.add-mime-type-to-html-fc-stegerman.patch
new file mode 100644
index 0000000..ac253fa
--- /dev/null
+++ b/debian/patches/1674058221.FILE5_44-23-gbaf1f4b4.add-mime-type-to-html-fc-stegerman.patch
@@ -0,0 +1,15 @@
+Subject: Add mime type to html (FC Stegerman)
+Origin: FILE5_44-23-gbaf1f4b4 <https://github.com/file/file/commit/FILE5_44-23-gbaf1f4b4>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Wed Jan 18 16:10:21 2023 +0000
+
+--- a/magic/Magdir/sgml
++++ b/magic/Magdir/sgml
+@@ -57,6 +57,7 @@
+ !:mime text/html
+ 0 string/ct \<!--
+ >&0 search/4096/cWt \<!doctype\ html HTML document text
++!:mime text/html
+ >&0 search/4096/ct \<html> HTML document text
+ !:mime text/html
+
diff --git a/debian/patches/1674058358.FILE5_44-24-gc4361a10.improve-detection-of-apk-files-if-we-find-a-manifest-file-at-least-say.patch b/debian/patches/1674058358.FILE5_44-24-gc4361a10.improve-detection-of-apk-files-if-we-find-a-manifest-file-at-least-say.patch
new file mode 100644
index 0000000..1e934be
--- /dev/null
+++ b/debian/patches/1674058358.FILE5_44-24-gc4361a10.improve-detection-of-apk-files-if-we-find-a-manifest-file-at-least-say.patch
@@ -0,0 +1,109 @@
+Subject: Improve detection of APK files; if we find a manifest file, at least say (...)
+Origin: FILE5_44-24-gc4361a10 <https://github.com/file/file/commit/FILE5_44-24-gc4361a10>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Wed Jan 18 16:12:38 2023 +0000
+
+ improve detection of APK files; if we find a manifest file, at least say
+ that it is a jar file (FC Stegerman)
+
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1511,66 +1511,70 @@
+ # Starts with AndroidManifest.xml (file name length = 19)
+ >26 uleshort 19
+ >>30 string AndroidManifest.xml Android package (APK), with AndroidManifest.xml
+->>>-22 string PK\005\006
+->>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+ # Starts with META-INF/com/android/build/gradle/app-metadata.properties
+ >26 uleshort 57
+ >>30 string META-INF/com/android/build/gradle/
+ >>>&0 string app-metadata.properties Android package (APK), with gradle app-metadata.properties
+->>>>-22 string PK\005\006
+->>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+ # Starts with classes.dex (file name length = 11)
+ >26 uleshort 11
+ >>30 string classes.dex Android package (APK), with classes.dex
+->>>-22 string PK\005\006
+->>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+ # 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
+->>>>-22 string PK\005\006
+->>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+->>>>>-22 string PK\005\006
+->>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+->>>>>>-22 string PK\005\006
+->>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+->>>>>>>-22 string PK\005\006
+->>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+ # 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
+ >>&0 string \x21\x08\x21\x02
+ >>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
+ >>>>&0 string \x00\x00 Android package (APK), with zipflinger virtual entry
+->>>>>-22 string PK\005\006
+->>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+ !: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
+ # APK Signing Block
+ >0 default x
+ >>-22 string PK\005\006
+@@ -1795,9 +1799,10 @@
+ >>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
+ !:mime application/zip
+
+-# Java Jar files
++# Java Jar files (see also APK files above)
+ >(26.s+30) leshort 0xcafe Java archive data (JAR)
+ !:mime application/java-archive
++!:ext jar
+
+ # iOS App
+ >(26.s+30) leshort !0xcafe
diff --git a/debian/patches/1674400026.FILE5_44-29-g1e4b7389.increase-strength-to-beat-targa-fc-stegerman.patch b/debian/patches/1674400026.FILE5_44-29-g1e4b7389.increase-strength-to-beat-targa-fc-stegerman.patch
new file mode 100644
index 0000000..d5231fd
--- /dev/null
+++ b/debian/patches/1674400026.FILE5_44-29-g1e4b7389.increase-strength-to-beat-targa-fc-stegerman.patch
@@ -0,0 +1,17 @@
+Subject: Increase strength to beat targa (FC Stegerman)
+Origin: FILE5_44-29-g1e4b7389 <https://github.com/file/file/commit/FILE5_44-29-g1e4b7389>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Sun Jan 22 15:07:06 2023 +0000
+
+--- a/magic/Magdir/android
++++ b/magic/Magdir/android
+@@ -180,7 +180,9 @@
+ # In include/androidfw/ResourceTypes.h:
+ # RES_XML_TYPE = 0x0003 followed by the size of the header (ResXMLTree_header),
+ # which is 8 bytes (2 bytes type + 2 bytes header size + 4 bytes size).
++# The strength is increased to avoid misidentifying as Targa image data
+ 0 lelong 0x00080003 Android binary XML
++!:strength +1
+
+ # Android cryptfs footer
+ # From https://android.googlesource.com/\
diff --git a/debian/patches/local.don-t-include-libs-in-build.patch b/debian/patches/local.don-t-include-libs-in-build.patch
new file mode 100644
index 0000000..fa33e3e
--- /dev/null
+++ b/debian/patches/local.don-t-include-libs-in-build.patch
@@ -0,0 +1,17 @@
+Description: Don't include libs in build
+Author: Michael Piefel <piefel@debian.org>
+Last-Update: 2016-06-27
+
+ (Reason for this is not at all clear -CB)
+
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -501,7 +501,7 @@
+
+ file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES)
+ @rm -f file$(EXEEXT)
+- $(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
++ $(AM_V_CCLD)$(LINK) $(file_OBJECTS) $(file_LDADD)
+
+ mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
diff --git a/debian/patches/local.extra-magic.patch b/debian/patches/local.extra-magic.patch
new file mode 100644
index 0000000..b38154f
--- /dev/null
+++ b/debian/patches/local.extra-magic.patch
@@ -0,0 +1,15 @@
+Subject: Extra magic file, to be upstreamed
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2018-07-18
+Forwarded: not-yet
+
+--- a/magic/Makefile.am
++++ b/magic/Makefile.am
+@@ -10,6 +10,7 @@
+ MAGIC_FRAGMENTS = \
+ $(MAGIC_DIR)/Header \
+ $(MAGIC_DIR)/Localstuff \
++$(MAGIC_FRAGMENT_DIR)/../../debian/debian-extra-magic \
+ $(MAGIC_FRAGMENT_DIR)/acorn \
+ $(MAGIC_FRAGMENT_DIR)/adi \
+ $(MAGIC_FRAGMENT_DIR)/adventure \
diff --git a/debian/patches/local.manpage-seccomp-is-disabled.patch b/debian/patches/local.manpage-seccomp-is-disabled.patch
new file mode 100644
index 0000000..b94c154
--- /dev/null
+++ b/debian/patches/local.manpage-seccomp-is-disabled.patch
@@ -0,0 +1,18 @@
+Subject: Clarify manpage: seccomp is disabled for the time being
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2019-01-11
+Bug-Debian: https://bugs.debian.org/917930
+
+--- a/doc/file.man
++++ b/doc/file.man
+@@ -387,6 +387,10 @@
+ .Fl z
+ option is specified and the built-in decompressors are not available.
+ On systems where sandboxing is not available, this option has no effect.
++.Pp
++.Em Note:
++This Debian version of file was built without seccomp support, so this option
++has no effect.
+ .It Fl v , Fl Fl version
+ Print the version of the program and exit.
+ .It Fl z , Fl Fl uncompress
diff --git a/debian/patches/local.support-local-definitions-in-etc-magic.patch b/debian/patches/local.support-local-definitions-in-etc-magic.patch
new file mode 100644
index 0000000..f26768a
--- /dev/null
+++ b/debian/patches/local.support-local-definitions-in-etc-magic.patch
@@ -0,0 +1,92 @@
+Description: Support local definitions in /etc/magic
+Author:
+ Michael Piefel <piefel@debian.org>,
+ Judit Foglszinger <fgrfgr@freenet.de>
+Forwarded: no
+Last-Update: 2016-06-27
+
+--- a/magic/Header
++++ b/magic/Header
+@@ -1,5 +1,6 @@
+ # Magic data for file(1) command.
+-# Format is described in magic(files), where:
+-# files is 5 on V7 and BSD, 4 on SV, and ?? on SVID.
++# Format is described in in magic(5).
+ # Don't edit this file, edit /etc/magic or send your magic improvements
+-# to the maintainers, at file@astron.com
++# to the upstream maintainers, at file@astron.com
++# or send your suggested inclusions
++# as a wishlist bug against the file package (using the reportbug utility).
+--- /dev/null
++++ b/magic/magic.local
+@@ -0,0 +1,3 @@
++# Magic local data for file(1) command.
++# Insert here your local magic data. Format is described in magic(5).
++
+--- a/src/apprentice.c
++++ b/src/apprentice.c
+@@ -496,7 +496,7 @@
+ #ifndef COMPILE_ONLY
+ map = apprentice_map(ms, fn);
+ if (map == NULL) {
+- if (ms->flags & MAGIC_CHECK)
++ if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
+ file_magwarn(NULL, "using regular magic file `%s'", fn);
+ map = apprentice_load(ms, fn, action);
+ if (map == NULL)
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -4,7 +4,7 @@
+
+ bin_PROGRAMS = file
+
+-AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
++AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
+ AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
+
+ libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -360,7 +360,7 @@
+ MAGIC = $(pkgdatadir)/magic
+ lib_LTLIBRARIES = libmagic.la
+ nodist_include_HEADERS = magic.h
+-AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
++AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
+ AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
+ libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
+ encoding.c compress.c is_csv.c is_json.c is_tar.c readelf.c print.c \
+--- a/doc/file.man
++++ b/doc/file.man
+@@ -59,7 +59,7 @@
+ Exceptions are well-known file formats (core files, tar archives)
+ that are known to contain binary data.
+ When modifying magic files or the program itself, make sure to
+-.Em preserve these keywords .
++.Em "preserve these keywords" .
+ Users depend on knowing that all the readable files in a directory
+ have the word
+ .Dq text
+@@ -102,7 +102,8 @@
+ has been applied by extension to data files.
+ Any file with some invariant identifier at a small fixed
+ offset into the file can usually be described in this way.
+-The information identifying these files is read from the compiled
++The information identifying these files is read from /etc/magic
++and the compiled
+ magic file
+ .Pa __MAGIC__.mgc ,
+ or the files in the directory
+@@ -572,12 +573,6 @@
+ The order of entries in the magic file is significant.
+ Depending on what system you are using, the order that
+ they are put together may be incorrect.
+-If your old
+-.Nm
+-command uses a magic file,
+-keep the old magic file around for comparison purposes
+-(rename it to
+-.Pa __MAGIC__.orig ) .
+ .Sh HISTORY
+ There has been a
+ .Nm
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6648216
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,25 @@
+# reverted upstream commits
+
+# cherry-picked commits. Keep in upstream's chronological order
+1672082456.FILE5_44-5-g813b3304.pr-410-pandrew-add-bitcoin-and-leveldb-support.patch
+1672518248.FILE5_44-9-gdc71304b.pyzip-improvements-fc-stegerman.patch
+1673481589.FILE5_44-14-gbb955ca3.jar-manifest-signature-file-pkcs-7-signed-data-fc-stegerman.patch
+1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch
+1673482012.FILE5_44-16-gb29519e7.detect-android-apk-files-fc-stegerman.patch
+1673482186.FILE5_44-17-g4c8ee2e7.detect-smali-files-fc-stegerman.patch
+1673482234.FILE5_44-18-g9fa5e784.detect-android-art-baseline-profiles-found-in-apk-files.patch
+1673482275.FILE5_44-19-g4341ed61.detect-android-package-resource-table-arsc-fc-stegerman.patch
+1673725413.FILE5_44-22-g6d565d82.improve-apk-detection-fc-stegerman.patch
+1674058221.FILE5_44-23-gbaf1f4b4.add-mime-type-to-html-fc-stegerman.patch
+1674058358.FILE5_44-24-gc4361a10.improve-detection-of-apk-files-if-we-find-a-manifest-file-at-least-say.patch
+1674400026.FILE5_44-29-g1e4b7389.increase-strength-to-beat-targa-fc-stegerman.patch
+
+# patches that should go upstream
+upstream.disable.att3b.patch
+upstream.mute-debug-warning.patch
+
+# local modifications
+local.support-local-definitions-in-etc-magic.patch
+local.don-t-include-libs-in-build.patch
+local.extra-magic.patch
+local.manpage-seccomp-is-disabled.patch
diff --git a/debian/patches/upstream.disable.att3b.patch b/debian/patches/upstream.disable.att3b.patch
new file mode 100644
index 0000000..4e0c61b
--- /dev/null
+++ b/debian/patches/upstream.disable.att3b.patch
@@ -0,0 +1,43 @@
+Subject: Disable att3b/WE32K executables like 3B20
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2019-12-19
+Bug-Debian: https://bugs.debian.org/913867
+Forwarded: Not yet
+
+--- a/magic/Magdir/att3b
++++ b/magic/Magdir/att3b
+@@ -18,20 +18,20 @@
+ #
+ # WE32K
+ #
+-0 beshort 0560 WE32000 COFF
+->18 beshort ^00000020 object
+->18 beshort &00000020 executable
+->12 belong >0 not stripped
+->18 beshort ^00010000 N/A on 3b2/300 w/paging
+->18 beshort &00020000 32100 required
+->18 beshort &00040000 and MAU hardware required
+->20 beshort 0407 (impure)
+->20 beshort 0410 (pure)
+->20 beshort 0413 (demand paged)
+->20 beshort 0443 (target shared library)
+->22 beshort >0 - version %d
+-0 beshort 0561 WE32000 COFF executable (TV)
+->12 belong >0 not stripped
++#0 beshort 0560 WE32000 COFF
++#>18 beshort ^00000020 object
++#>18 beshort &00000020 executable
++#>12 belong >0 not stripped
++#>18 beshort ^00010000 N/A on 3b2/300 w/paging
++#>18 beshort &00020000 32100 required
++#>18 beshort &00040000 and MAU hardware required
++#>20 beshort 0407 (impure)
++#>20 beshort 0410 (pure)
++#>20 beshort 0413 (demand paged)
++#>20 beshort 0443 (target shared library)
++#>22 beshort >0 - version %d
++#0 beshort 0561 WE32000 COFF executable (TV)
++#>12 belong >0 not stripped
+ #>18 beshort &00020000 - 32100 required
+ #>18 beshort &00040000 and MAU hardware required
+ #>22 beshort >0 - version %d
diff --git a/debian/patches/upstream.mute-debug-warning.patch b/debian/patches/upstream.mute-debug-warning.patch
new file mode 100644
index 0000000..34d4c21
--- /dev/null
+++ b/debian/patches/upstream.mute-debug-warning.patch
@@ -0,0 +1,25 @@
+Subject: Disable debug messages
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2022-12-20
+Forwarded: https://mailman.astron.com/pipermail/file/2022-December/001018.html
+
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -1461,7 +1461,7 @@
+ // On purpose not INTMAX_MAX
+ if (lhs >= UINT_MAX || lhs <= INT_MIN ||
+ off >= UINT_MAX || off <= INT_MIN) {
+- fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
++/* fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off); */
+ return 1;
+ }
+
+@@ -1497,7 +1497,7 @@
+ if (m->in_op & FILE_OPINVERSE)
+ offset = ~offset;
+ if (offset >= UINT_MAX) {
+- fprintf(stderr, "offset overflow %jd\n", offset);
++/* fprintf(stderr, "offset overflow %jd\n", offset); */
+ return 1;
+ }
+ *rv = CAST(uint32_t, offset);