SHA256
1
0
forked from pool/file

18 Commits

Author SHA256 Message Date
dced9256c4 Accepting request 1302713 from Base:System
- Add patch file-5.46-tcgets2.patch from https://bugs.astron.com/view.php?id=678
  but disable hunk 1 to avoid conflict with file-seccomp-ppc.patch
  This should fix bug boo#1249071 
- Modify patch file-seccomp-ppc.patch that is use <asm/termbits.h>
  on all architectures

OBS-URL: https://build.opensuse.org/request/show/1302713
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=143
2025-09-05 19:42:40 +00:00
fa86c6d21b Extend changelog about change in file-seccomp-ppc.patch
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=296
2025-09-04 10:34:27 +00:00
6f2e529915 Fix bug boo#1249071
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=295
2025-09-04 09:37:39 +00:00
2b520e2621 Accepting request 1279982 from Base:System
- Add file-zipdata.patch
  * Fix "Some zip files are misclassified as data"
    see https://bugs.astron.com/view.php?id=571
    based on 60b2032b96 (forwarded request 1279890 from munix9)

OBS-URL: https://build.opensuse.org/request/show/1279982
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=142
2025-05-27 16:48:53 +00:00
9f3bcae407 - Add file-zipdata.patch
* Fix "Some zip files are misclassified as data"
    see https://bugs.astron.com/view.php?id=571
    based on 60b2032b96

OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=293
2025-05-26 06:44:45 +00:00
9541c6c815 Accepting request 1256270 from Base:System
- baselibs.conf: drop it

- Change patch file-seccomp.patch
  * Remove the dumb prctl allow rule as for glibc malloc the prctl
    PR_SET_VMA with flag PR_SET_VMA_ANON_NAME is already allowed
- Require at build zlib-devel to enable direct uncompresion of
  zip'ed files as well

- Add patch file-seccomp-ppc.patch
  * Minimal patch to work around of wrong provide of used TCGETS

OBS-URL: https://build.opensuse.org/request/show/1256270
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=141
2025-03-31 09:38:09 +00:00
fac7592014 .
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=291
2025-03-26 14:59:07 +00:00
0ba538f3fe .
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=290
2025-03-26 14:23:20 +00:00
97d8d42b99 .
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=289
2025-03-19 09:34:53 +00:00
53a9847ddd .
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=288
2025-03-18 10:40:48 +00:00
b4c26b4e3e Fix seccomp filter for ppc64le
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=287
2025-03-18 10:36:08 +00:00
c5d650be76 Accepting request 1247564 from Base:System
- Add patch boo1237209.patch temporary
  * Fix stack overrun (boo#1237209)

OBS-URL: https://build.opensuse.org/request/show/1247564
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=140
2025-02-22 18:04:16 +00:00
4221195f95 boo#1237209
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=285
2025-02-21 07:28:39 +00:00
4ba1373984 Accepting request 1227112 from Base:System
- Update to 5.46:
  * Add OFFPOSITIVE
  * avoid leaking symbols in libmagic
  * PR/562: jsummers: Search/regex offsets are absolute to the
    beginning of the file, so adjust them by subtracting the
    offset that the "use" starts so that we don't double-count it.
  * PR/543: matshch: bump nbuf so we can get the flags into the buffer.
  * Add Android elf notes (enh)
  * Add limit for number of magic warnings allowed
  * check regex bounds (found by clusterfuzz)
- Remove patch file-5.45-type_t.dif now upstream
- Port patches
  * file-4.24-autoconf.dif
  * file-5.17-option.dif
  * file-5.18-javacheck.dif
  * file-5.19-biorad.dif
  * file-5.19-printf.dif
  * file-5.19-zip2.0.dif
  * file-5.22-elf.dif
  * file-5.28-btrfs-image.dif
  * file-5.45-type_t.dif
  * file-secure_getenv.patch
- Port patch file-5.45.dif and rename it to file-5.46.dif
  * Note that our kernel magics do not fit anymore as
    upstream now has a huge rework and extended features

OBS-URL: https://build.opensuse.org/request/show/1227112
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=139
2024-11-30 12:27:00 +00:00
759beeec49 Update to file 5.46
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=283
2024-11-28 11:30:17 +00:00
0b7b1ceaf6 Accepting request 1222654 from Base:System
- file-seccomp.patch: glibc uses getrandom in malloc, rseq and prctl
  in various other places, allow these syscalls in seccomp filter.

OBS-URL: https://build.opensuse.org/request/show/1222654
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/file?expand=0&rev=138
2024-11-09 19:52:41 +00:00
8712bcc924 .
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=281
2024-11-08 07:34:20 +00:00
fdbc4a0048 - file-seccomp.patch: glibc uses getrandom in malloc, rseq and prctl
in various other places, allow these syscalls in seccomp filter.

OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=280
2024-11-08 07:22:14 +00:00
24 changed files with 388 additions and 169 deletions

View File

@@ -1,7 +0,0 @@
libmagic1
requires "file-magic = <version>"
targettype 32bit provides "file-<targettype>:/usr/lib/libmagic.so.1"
file-devel
requires -file-<targettype>
requires "libmagic1-<targettype> = <version>"

22
boo1237209.patch Normal file
View File

@@ -0,0 +1,22 @@
From b3384a1fbfa1fee99986e5750ab8e700de4f24ad Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Thu, 5 Dec 2024 18:35:40 +0000
Subject: [PATCH] PR/579: net147: Fix stack overrun.
---
src/readelf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/readelf.c b/src/readelf.c
index fe4cf5413..d209d86df 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1728,7 +1728,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
Elf64_Phdr ph64;
const char *linking_style;
unsigned char nbuf[NBUFSIZE];
- char interp[128];
+ char interp[NBUFSIZE];
ssize_t bufsize;
size_t offset, align, need = 0;
int pie = 0, dynamic = 0;

View File

@@ -38,7 +38,7 @@
#include <stdint.h>
#endif
@@ -542,4 +545,5 @@ typedef struct {
@@ -573,4 +576,5 @@ typedef struct {
#define DF_1_STUB 0x04000000 /* Stub */
#define DF_1_PIE 0x08000000 /* Position Independent Executable */

View File

@@ -2,7 +2,7 @@ Index: file-5.43/src/file.c
===================================================================
--- file-5.43.orig/src/file.c
+++ file-5.43/src/file.c
@@ -263,6 +263,8 @@ main(int argc, char *argv[])
@@ -265,6 +265,8 @@ main(int argc, char *argv[])
break;
case 'e':
case OPT_EXCLUDE_QUIET:
@@ -11,7 +11,7 @@ Index: file-5.43/src/file.c
for (i = 0; i < __arraycount(nv); i++)
if (strcmp(nv[i].name, optarg) == 0)
break;
@@ -275,7 +277,7 @@ main(int argc, char *argv[])
@@ -277,7 +279,7 @@ main(int argc, char *argv[])
break;
case 'f':
@@ -20,7 +20,7 @@ Index: file-5.43/src/file.c
usage();
if (magic == NULL)
if ((magic = load(magicfile, flags)) == NULL)
@@ -285,6 +287,8 @@ main(int argc, char *argv[])
@@ -287,6 +289,8 @@ main(int argc, char *argv[])
++didsomefiles;
break;
case 'F':
@@ -29,7 +29,7 @@ Index: file-5.43/src/file.c
separator = optarg;
break;
case 'i':
@@ -297,6 +301,8 @@ main(int argc, char *argv[])
@@ -299,6 +303,8 @@ main(int argc, char *argv[])
action = FILE_LIST;
break;
case 'm':

View File

@@ -1,13 +1,17 @@
Index: magic/Magdir/cafebabe
===================================================================
--- magic/Magdir/cafebabe.orig
+++ magic/Magdir/cafebabe
@@ -17,7 +17,7 @@
### JAVA START ###
# Reference: http://en.wikipedia.org/wiki/Java_class_file
# Update: Joerg Jenderek
---
magic/Magdir/cafebabe | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- magic/Magdir/cafebabe
+++ magic/Magdir/cafebabe 2024-11-28 08:56:12.978938091 +0000
@@ -32,7 +32,7 @@
# Reference: https://opensource.apple.com/source/cctools/cctools-949.0.1/
# include/mach-o/fat.h
# include/mach/machine.h
-0 belong 0xcafebabe
+0 belong 0xcafebabe Cafe Babe
>4 ubelong >30 compiled Java class data,
!:mime application/x-java-applet
#!:mime application/java-byte-code
>4 belong 1 Mach-O universal binary with 1 architecture:
!:mime application/x-mach-binary
>>8 use mach-o \b

View File

@@ -6,7 +6,7 @@ Index: magic/Magdir/images
===================================================================
--- magic/Magdir/images.orig
+++ magic/Magdir/images
@@ -2180,6 +2180,8 @@
@@ -2378,6 +2378,8 @@
# https://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
# Samples: https://www.loci.wisc.edu/software/sample-data
14 uleshort <2

View File

@@ -6,7 +6,7 @@ Index: src/apprentice.c
===================================================================
--- src/apprentice.c.orig
+++ src/apprentice.c
@@ -2623,7 +2623,7 @@ check_format_type(const char *ptr, int t
@@ -2647,7 +2647,7 @@ check_format_type(const char *ptr, int t
}
} else
h = 0;

View File

@@ -1,18 +1,19 @@
---
magic/Magdir/archive | 5 +++++
1 file changed, 5 insertions(+)
magic/Magdir/archive | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- magic/Magdir/archive
+++ magic/Magdir/archive 2023-07-28 09:40:12.243809381 +0000
@@ -1622,6 +1622,11 @@
+++ magic/Magdir/archive 2024-11-28 08:59:31.099299217 +0000
@@ -1793,7 +1793,11 @@
0 string PK\x07\x08PK\x03\x04 Zip multi-volume archive data, at least PKZIP v2.50 to extract
!:mime application/zip
!:ext zip/cbz
-
+>30 ubelong 0x6d696d65 Zip archive data, at least v2.0 to extract
+>>34 ubelong 0x74797065 \b, mime type
+>>>38 regex application/[a-z+-]+ \b %s
+!:mime application/unknown+zip
+!:mime application/unknown+zip
+!:ext zip/cbz
# Android APK file (Zip archive)
0 string PK\003\004
!:strength +1

View File

@@ -6,7 +6,7 @@ Index: src/readelf.c
===================================================================
--- src/readelf.c.orig
+++ src/readelf.c
@@ -825,7 +825,7 @@ do_core_note(struct magic_set *ms, unsig
@@ -884,7 +884,7 @@ do_core_note(struct magic_set *ms, unsig
default:
if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
@@ -15,7 +15,7 @@ Index: src/readelf.c
unsigned char c;
/*
* Extract the program name. We assume
@@ -837,7 +837,9 @@ do_core_note(struct magic_set *ms, unsig
@@ -896,7 +896,9 @@ do_core_note(struct magic_set *ms, unsig
* If the characters aren't all printable,
* reject it.
*/

View File

@@ -17,7 +17,7 @@ Index: file-5.43/magic/Magdir/filesystems
===================================================================
--- file-5.43.orig/magic/Magdir/filesystems
+++ file-5.43/magic/Magdir/filesystems
@@ -2257,20 +2257,29 @@
@@ -2277,20 +2277,29 @@
>>0x10060 string >\0 lockproto %s)
# Russell Coker <russell@coker.com.au>

View File

@@ -1,42 +0,0 @@
---
configure.ac | 12 ++++++++++++
src/file.h | 6 ++++--
2 files changed, 16 insertions(+), 2 deletions(-)
--- src/file.h
+++ src/file.h 2023-07-28 14:37:17.000000000 +0000
@@ -159,9 +159,11 @@
/*
* Dec 31, 23:59:59 9999
* we need to make sure that we don't exceed 9999 because some libc
- * implementations like muslc crash otherwise
+ * implementations like muslc crash otherwise. If you are unlucky
+ * to be running on a system with a 32 bit time_t, then it is even less.
*/
-#define MAX_CTIME CAST(time_t, 0x3afff487cfULL)
+#define MAX_CTIME \
+ CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
#define FILE_BADSIZE CAST(size_t, ~0ul)
#define MAXDESC 64 /* max len of text description/MIME type */
--- configure.ac
+++ configure.ac 2023-07-31 06:45:39.269468700 +0000
@@ -152,6 +152,18 @@ AC_TYPE_UINT64_T
AC_TYPE_INT64_T
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
+m4_ifdef([AC_SYS_YEAR2038], [AC_SYS_YEAR2038], [
+# GNU libc only allows setting _TIME_BITS when FILE_OFFSET_BITS is also set.
+# GNU libc defines __TIMESIZE on systems where _TIME_BITS can be set.
+AS_IF([test X"$ac_cv_sys_file_offset_bits" = X"64"], [
+ AC_CHECK_DECL(__TIMESIZE, [
+ AC_DEFINE([_TIME_BITS], [64], [Number of bits in a timestamp, on hosts where this is settable.])
+ ], [], [
+AC_INCLUDES_DEFAULT
+#include <time.h>
+ ])
+ ])
+])
AC_FUNC_MMAP
AC_FUNC_FORK
AC_FUNC_MBRTOWC

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc97f51029bb0e2c9f4e3bffefdaf678f0e039ee872b9de5c002a6d09c784d82
size 1246503

View File

@@ -1,6 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iEYEABECAAYFAmTCz2IACgkQcREqsWyzOzpvCgCcDRR1icCs3FF4dXiIXCS3mykf
T5wAoI4+RrEesZEWRBl641Z1lshkK+4c
=bF1Y
-----END PGP SIGNATURE-----

39
file-5.46-tcgets2.patch Normal file
View File

@@ -0,0 +1,39 @@
From 7b23bd3f87069fcebc9173c8d1637c2a2e1a12d1 Mon Sep 17 00:00:00 2001
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Wed, 6 Aug 2025 23:11:10 +0200
Subject: [PATCH] Extend seccomp for glibc and physical terminals
New glibc implementations might also use TCGETS2 instead of TCGETS.
This happens on current Arch Linux systems. Allow TCGETS2 in seccomp
sandbox as well.
---
src/seccomp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index f05c30f9..dddb821c 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
!@@ -37,6 +37,8 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.31 2025/03/20 14:57:41 christos Exp $")
! #ifdef __powerpc64__
! // See: https://sourceware.org/bugzilla/show_bug.cgi?id=32806
! # include <asm/termbits.h>
!+#elif defined __linux__
!+# include <linux/termios.h>
! #else
! # include <termios.h>
! #endif
@@ -121,6 +123,10 @@ enable_sandbox(void)
#ifdef TCGETS
// glibc may call ioctl TCGETS on stdout on physical terminal
ALLOW_IOCTL_RULE(TCGETS);
+#endif
+#ifdef TCGETS2
+ // glibc may call ioctl TCGETS2 on stdout on physical terminal
+ ALLOW_IOCTL_RULE(TCGETS2);
#endif
ALLOW_RULE(lseek);
ALLOW_RULE(_llseek);
--
2.50.1

View File

@@ -20,56 +20,57 @@
>18 leshort 51 Stanford MIPS-X,
>18 leshort 52 Motorola Coldfire,
>18 leshort 53 Motorola M68HC12,
--- magic/Magdir/linux
+++ magic/Magdir/linux 2023-07-28 09:42:01.845813939 +0000
@@ -140,27 +140,31 @@
# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
# Linux kernel boot images (i386 arch) (Wolfram Kleff)
# URL: https://www.kernel.org/doc/Documentation/x86/boot.txt
-514 string HdrS Linux kernel
+514 string HdrS Linux
!:strength + 55
# often no extension like in linux, vmlinuz, bzimage or memdisk but sometimes
# Acronis Recovery kernel64.dat and Plop Boot Manager plpbtrom.bin
# DamnSmallLinux 1.5 damnsmll.lnx
!:ext /dat/bin/lnx
->510 leshort 0xAA55 x86 boot executable
->>518 leshort >0x1ff
->>>529 byte 0 zImage,
->>>529 byte 1 bzImage,
->>>526 lelong >0
->>>>(526.s+0x200) string >\0 version %s,
->>498 leshort 1 RO-rootFS,
->>498 leshort 0 RW-rootFS,
->>508 leshort >0 root_dev %#X,
->>502 leshort >0 swap_dev %#X,
->>504 leshort >0 RAMdisksize %u KB,
->>506 leshort 0xFFFF Normal VGA
->>506 leshort 0xFFFE Extended VGA
->>506 leshort 0xFFFD Prompt for Videomode
->>506 leshort >0 Video mode %d
+>510 leshort 0xAA55 \b/x86 Kernel
+>510 leshort <0xAA55 Kernel
+>510 leshort >0xAA55 Kernel
+>518 leshort 0x0105 \b, Setup Version 0x105, zImage
+>518 leshort >0x0105 \b, Setup Version %#x
+>518 leshort >0x1ff
+>>529 byte 0 \b, zImage
+>>529 byte 1 \b, bzImage
+>>526 lelong >0
+>>>(526.s+0x200) string >\0 \b, Version %s
+>>498 leshort 1 \b, RO-rootFS
+>>498 leshort 0 \b, RW-rootFS
+>>508 leshort >0 \b, root_dev %#X
+>>502 leshort >0 \b, swap_dev %#X
+>>504 leshort >0 \b, RAMdisksize %u KB
+>>506 leshort 0xFFFF \b, Normal VGA
+>>506 leshort 0xFFFE \b, Extended VGA
+>>506 leshort 0xFFFD \b, Prompt for Videomode
+>>506 leshort >0 \b, Video mode %d
# This also matches new kernels, which were caught above by "HdrS".
0 belong 0xb8c0078e Linux kernel
>0x1e3 string Loading version 1.3.79 or older
! Does not fit anymore !!
!--- magic/Magdir/linux
!+++ magic/Magdir/linux 2023-07-28 09:42:01.845813939 +0000
!@@ -140,27 +140,31 @@
! # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
! # Linux kernel boot images (i386 arch) (Wolfram Kleff)
! # URL: https://www.kernel.org/doc/Documentation/x86/boot.txt
!-514 string HdrS Linux kernel
!+514 string HdrS Linux
! !:strength + 55
! # often no extension like in linux, vmlinuz, bzimage or memdisk but sometimes
! # Acronis Recovery kernel64.dat and Plop Boot Manager plpbtrom.bin
! # DamnSmallLinux 1.5 damnsmll.lnx
! !:ext /dat/bin/lnx
!->510 leshort 0xAA55 x86 boot executable
!->>518 leshort >0x1ff
!->>>529 byte 0 zImage,
!->>>529 byte 1 bzImage,
!->>>526 lelong >0
!->>>>(526.s+0x200) string >\0 version %s,
!->>498 leshort 1 RO-rootFS,
!->>498 leshort 0 RW-rootFS,
!->>508 leshort >0 root_dev %#X,
!->>502 leshort >0 swap_dev %#X,
!->>504 leshort >0 RAMdisksize %u KB,
!->>506 leshort 0xFFFF Normal VGA
!->>506 leshort 0xFFFE Extended VGA
!->>506 leshort 0xFFFD Prompt for Videomode
!->>506 leshort >0 Video mode %d
!+>510 leshort 0xAA55 \b/x86 Kernel
!+>510 leshort <0xAA55 Kernel
!+>510 leshort >0xAA55 Kernel
!+>518 leshort 0x0105 \b, Setup Version 0x105, zImage
!+>518 leshort >0x0105 \b, Setup Version %#x
!+>518 leshort >0x1ff
!+>>529 byte 0 \b, zImage
!+>>529 byte 1 \b, bzImage
!+>>526 lelong >0
!+>>>(526.s+0x200) string >\0 \b, Version %s
!+>>498 leshort 1 \b, RO-rootFS
!+>>498 leshort 0 \b, RW-rootFS
!+>>508 leshort >0 \b, root_dev %#X
!+>>502 leshort >0 \b, swap_dev %#X
!+>>504 leshort >0 \b, RAMdisksize %u KB
!+>>506 leshort 0xFFFF \b, Normal VGA
!+>>506 leshort 0xFFFE \b, Extended VGA
!+>>506 leshort 0xFFFD \b, Prompt for Videomode
!+>>506 leshort >0 \b, Video mode %d
! # This also matches new kernels, which were caught above by "HdrS".
! 0 belong 0xb8c0078e Linux kernel
! >0x1e3 string Loading version 1.3.79 or older
--- magic/Magdir/msad
+++ magic/Magdir/msad 2023-07-28 09:42:01.845813939 +0000
@@ -0,0 +1,5 @@
@@ -79,20 +80,21 @@
+# This must precede the heuristic for raw G3 data
+4 string Standard\ Jet\ DB Microsoft Access Database
--- magic/Magdir/msdos
+++ magic/Magdir/msdos 2023-07-28 09:42:01.845813939 +0000
@@ -298,9 +298,9 @@
>>(0x3c.l+22) leshort&0x0200 >0 (stripped to external PDB)
>>(0x3c.l+22) leshort&0x1000 >0 system file
+++ magic/Magdir/msdos 2024-11-28 10:44:09.616373881 +0000
@@ -331,10 +331,10 @@
# Check for presence of COM Runtime descriptor
>>(0x3c.l+24) leshort 0x010b
->>>(0x3c.l+232) lelong >0 Mono/.Net assembly
+>>>(0x3c.l+232) lelong >0 \b, Mono/.Net assembly
>>>(0x3c.l+116) leshort >14
->>>>(0x3c.l+232) lelong >0 Mono/.Net assembly
+>>>>(0x3c.l+232) lelong >0 \b, Mono/.Net assembly
>>(0x3c.l+24) leshort 0x020b
->>>(0x3c.l+248) lelong >0 Mono/.Net assembly
+>>>(0x3c.l+248) lelong >0 \b, Mono/.Net assembly
>>>(0x3c.l+132) leshort >14
->>>>(0x3c.l+248) lelong >0 Mono/.Net assembly
+>>>>(0x3c.l+248) lelong >0 \b, Mono/.Net assembly
# hooray, there's a DOS extender using the PE format, with a valid PE
# executable inside (which just prints a message and exits if run in win)
@@ -1026,7 +1026,7 @@
@@ -1499,7 +1499,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
@@ -137,7 +139,7 @@
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -163,7 +163,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
@@ -165,7 +165,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
@@ -145,7 +147,7 @@
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -171,7 +170,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
@@ -173,7 +172,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
@@ -153,7 +155,7 @@
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -195,11 +193,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
@@ -197,11 +195,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
@@ -166,7 +168,7 @@
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -263,6 +261,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
@@ -265,6 +263,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
@@ -175,7 +177,7 @@
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -355,9 +355,21 @@ EXTRA_DIST = \
@@ -358,9 +358,21 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
@@ -199,7 +201,7 @@
# FIXME: Build file natively as well so that it can be used to compile
# the target's magic file; for now we bail if the local version does not match
@@ -369,19 +381,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
@@ -372,19 +384,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
FILE_COMPILE_DEP = $(FILE_COMPILE)
endif
@@ -240,7 +242,7 @@
+# @rm -fr magic
--- magic/Makefile.in
+++ magic/Makefile.in 2023-07-28 09:42:01.849813866 +0000
@@ -283,7 +283,7 @@ top_srcdir = @top_srcdir@
@@ -284,7 +284,7 @@ top_srcdir = @top_srcdir@
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
@@ -249,7 +251,7 @@
MAGIC_FRAGMENTS = \
$(MAGIC_DIR)/Header \
$(MAGIC_DIR)/Localstuff \
@@ -301,7 +301,6 @@ $(MAGIC_FRAGMENT_DIR)/animation \
@@ -302,7 +302,6 @@ $(MAGIC_FRAGMENT_DIR)/animation \
$(MAGIC_FRAGMENT_DIR)/aout \
$(MAGIC_FRAGMENT_DIR)/apache \
$(MAGIC_FRAGMENT_DIR)/apl \
@@ -257,7 +259,7 @@
$(MAGIC_FRAGMENT_DIR)/application \
$(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/apt \
@@ -383,7 +382,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
@@ -384,7 +383,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/espressif \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
@@ -265,7 +267,7 @@
$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/firmware \
$(MAGIC_FRAGMENT_DIR)/flash \
@@ -430,6 +428,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
@@ -431,6 +429,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
$(MAGIC_FRAGMENT_DIR)/java \
$(MAGIC_FRAGMENT_DIR)/javascript \
$(MAGIC_FRAGMENT_DIR)/jpeg \
@@ -274,7 +276,7 @@
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -440,7 +440,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
@@ -443,7 +443,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
@@ -282,7 +284,7 @@
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -448,7 +447,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
@@ -451,7 +450,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
@@ -290,7 +292,7 @@
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -472,11 +470,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
@@ -475,11 +473,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
@@ -303,7 +305,7 @@
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -540,6 +538,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
@@ -543,6 +541,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
@@ -312,7 +314,7 @@
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -632,10 +632,22 @@ EXTRA_DIST = \
@@ -636,10 +636,22 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
@@ -336,7 +338,7 @@
# FIXME: Build file natively as well so that it can be used to compile
# the target's magic file; for now we bail if the local version does not match
@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file${EXEEXT}
@@ -859,23 +871,25 @@ uninstall-am: uninstall-pkgdataDATA
@@ -863,23 +875,25 @@ uninstall-am: uninstall-pkgdataDATA
.PRECIOUS: Makefile

BIN
file-5.46.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

6
file-5.46.tar.gz.asc Normal file
View File

@@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCZ0c+EQAKCRBxESqxbLM7
OkFvAJ9cMVrW0aZfXPN6kqU7zi5Sgy43xQCg6WRiqMb4bQZy/F1i11rmP7+Mx7Q=
=y7Gw
-----END PGP SIGNATURE-----

25
file-seccomp-ppc.patch Normal file
View File

@@ -0,0 +1,25 @@
The glibc does not provide the real value of TCGETS as e.g.
used by tcgetattr(3). Therefore as a dirty workaround for
the correct struct termios from ppc specific includes has to
loaded before including ioctl.h. Simply to get the the final
correct value of TCGETS aka _IOR('t', 19, struct termios).
---
src/seccomp.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/seccomp.c b/src/seccomp.c
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -33,9 +33,9 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.29
#if HAVE_LIBSECCOMP
#include <seccomp.h> /* libseccomp */
#include <sys/prctl.h> /* prctl */
-#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <termios.h>
+#include <asm/termbits.h>
+#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>

34
file-seccomp.patch Normal file
View File

@@ -0,0 +1,34 @@
From 3cb58bb51d47b8e61611350324b751eaa46166a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Fri, 8 Nov 2024 08:28:12 +0100
Subject: [PATCH] Allow getrandom, rseq, and prctl for glibc malloc
glibc uses getrandom in malloc, rseq, and prctl in various other
places, allow these syscalls in seccomp filter.
```
export GLIBC_TUNABLES=glibc.mem.decorate_maps=1
make check
```
Remove the dumb prctl allow rule as for glibc malloc the prctl PR_SET_VMA
with flag PR_SET_VMA_ANON_NAME is already allowed
Signed-off-by: Werner Fink <werner@suse.de>
---
src/seccomp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -80,6 +80,8 @@ enable_sandbox(void)
if (ctx == NULL)
return -1;
+ ALLOW_RULE(getrandom);
+ ALLOW_RULE(rseq);
ALLOW_RULE(access);
ALLOW_RULE(brk);
ALLOW_RULE(close);

View File

@@ -6,7 +6,7 @@
--- file-5.42/configure.ac
+++ file-5.42/configure.ac 2022-06-13 08:34:50.347521415 +0000
@@ -130,6 +130,8 @@ if test "$enable_xzlib" != "no"; then
@@ -138,6 +138,8 @@ if test "$enable_xzlib" != "no"; then
fi
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
@@ -17,7 +17,7 @@
AC_TYPE_SIZE_T
--- file-5.42/src/file.h
+++ file-5.42/src/file.h 2022-06-13 08:34:50.347521415 +0000
@@ -726,4 +726,12 @@ static const char *rcsid(const char *p)
@@ -735,4 +735,12 @@ static const char *rcsid(const char *p)
#define __RCSID(a)
#endif

52
file-zipdata.patch Normal file
View File

@@ -0,0 +1,52 @@
From 60b2032b96fc185b37fb0f2152e834efb2edad6e Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Thu, 5 Dec 2024 19:41:12 +0000
Subject: [PATCH] PR/571: jschleus: Some zip files are misclassified as data
---
magic/Magdir/archive | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/magic/Magdir/archive b/magic/Magdir/archive
index e6ff4570a..e560523cb 100644
--- a/magic/Magdir/archive
+++ b/magic/Magdir/archive
@@ -1794,6 +1794,17 @@
!:mime application/unknown+zip
!: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
+
0 string PK\003\004
!:strength +1
# IOS/IPadOS IPA file (Zip archive)
@@ -2132,17 +2143,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)

View File

@@ -1,3 +1,81 @@
-------------------------------------------------------------------
Thu Sep 4 09:29:33 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- Add patch file-5.46-tcgets2.patch from https://bugs.astron.com/view.php?id=678
but disable hunk 1 to avoid conflict with file-seccomp-ppc.patch
This should fix bug boo#1249071
- Modify patch file-seccomp-ppc.patch that is use <asm/termbits.h>
on all architectures
-------------------------------------------------------------------
Sun May 25 06:23:18 UTC 2025 - munix9@googlemail.com
- Add file-zipdata.patch
* Fix "Some zip files are misclassified as data"
see https://bugs.astron.com/view.php?id=571
based on https://github.com/file/file/commit/60b2032b96fc185b37fb0f2152e834efb2edad6e
-------------------------------------------------------------------
Wed Mar 26 14:21:59 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- baselibs.conf: drop it
-------------------------------------------------------------------
Wed Mar 19 09:31:52 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- Change patch file-seccomp.patch
* Remove the dumb prctl allow rule as for glibc malloc the prctl
PR_SET_VMA with flag PR_SET_VMA_ANON_NAME is already allowed
- Require at build zlib-devel to enable direct uncompresion of
zip'ed files as well
-------------------------------------------------------------------
Tue Mar 18 10:40:11 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- Add patch file-seccomp-ppc.patch
* Minimal patch to work around of wrong provide of used TCGETS
-------------------------------------------------------------------
Fri Feb 21 07:27:07 UTC 2025 - Dr. Werner Fink <werner@suse.de>
- Add patch boo1237209.patch temporary
* Fix stack overrun (boo#1237209)
-------------------------------------------------------------------
Thu Nov 28 10:51:57 UTC 2024 - Dr. Werner Fink <werner@suse.de>
- Update to 5.46:
* Add OFFPOSITIVE
* avoid leaking symbols in libmagic
* PR/562: jsummers: Search/regex offsets are absolute to the
beginning of the file, so adjust them by subtracting the
offset that the "use" starts so that we don't double-count it.
* PR/543: matshch: bump nbuf so we can get the flags into the buffer.
* Add Android elf notes (enh)
* Add limit for number of magic warnings allowed
* check regex bounds (found by clusterfuzz)
- Remove patch file-5.45-type_t.dif now upstream
- Port patches
* file-4.24-autoconf.dif
* file-5.17-option.dif
* file-5.18-javacheck.dif
* file-5.19-biorad.dif
* file-5.19-printf.dif
* file-5.19-zip2.0.dif
* file-5.22-elf.dif
* file-5.28-btrfs-image.dif
* file-5.45-type_t.dif
* file-secure_getenv.patch
- Port patch file-5.45.dif and rename it to file-5.46.dif
* Note that our kernel magics do not fit anymore as
upstream now has a huge rework and extended features
-------------------------------------------------------------------
Thu Nov 7 20:11:48 UTC 2024 - Cristian Rodríguez <crrodriguez@opensuse.org>
- file-seccomp.patch: glibc uses getrandom in malloc, rseq and prctl
in various other places, allow these syscalls in seccomp filter.
-------------------------------------------------------------------
Mon Feb 26 09:11:40 UTC 2024 - Dr. Werner Fink <werner@suse.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package file
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -22,7 +22,9 @@
Name: file
BuildRequires: bash >= 4.0
BuildRequires: libtool
BuildRequires: lzlib-devel
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(liblz4)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libseccomp)
BuildRequires: pkgconfig(libzstd)
@@ -34,17 +36,16 @@ Obsoletes: file-64bit
%endif
#
# Set Version also in python-magic.spec
Version: 5.45
Version: 5.46
Release: 0
Summary: A Tool to Determine File Types
License: BSD-2-Clause
Group: Productivity/File utilities
Source0: https://www.astron.com/pub/file/file-%{version}.tar.gz
Source2: baselibs.conf
Source3: file-rpmlintrc
Source4: https://www.astron.com/pub/file/file-%{version}.tar.gz.asc
Source5: file.keyring
Patch0: file-5.45.dif
Patch0: file-5.46.dif
Patch1: file-5.19-misc.dif
Patch4: file-4.24-autoconf.dif
Patch5: file-5.14-tex.dif
@@ -63,8 +64,11 @@ Patch31: file-5.19-biorad.dif
Patch32: file-5.19-clicfs.dif
Patch37: file-secure_getenv.patch
Patch39: file-5.28-btrfs-image.dif
# PATCH-FIX-UPSTREAM: Support max time_t on 32bit
Patch42: file-5.45-type_t.dif
Patch42: boo1237209.patch
Patch43: file-seccomp.patch
Patch44: file-seccomp-ppc.patch
Patch45: file-zipdata.patch
Patch46: file-5.46-tcgets2.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir /etc
%global magicdir %{_datadir}/file
@@ -109,7 +113,6 @@ to develop applications that require the magic "file" interface.
%prep
%setup -q -n file-%{version}
%patch -P 42 -p0 -b .t_t
%patch -P 1 -p0 -b .misc
%patch -P 4 -p0 -b .conf
%patch -P 5 -p0 -b .tex
@@ -129,6 +132,11 @@ to develop applications that require the magic "file" interface.
%patch -P 37 -p1 -b .getenv
%patch -P 39 -p1 -b .btrfs
%patch -P 0 -b .0
%patch -P 42 -p1
%patch -P 43 -p1 -b .seccomp
%patch -P 44 -p1 -b .ppc
%patch -P 45 -p1 -b .zipdata
%patch -P 46 -p1 -b .tcgets2
test -s src/magic.h.in || cp -p src/magic.h src/magic.h.in
rm -fv src/magic.h
@@ -162,6 +170,8 @@ install -s dcore %{buildroot}%{_bindir}
rm -f %{buildroot}%{_libdir}/*.la
%check
# Test if prctl is still allowed by the seccomp filter.
export GLIBC_TUNABLES=glibc.mem.decorate_maps=1
# Standard checks
make check
# Check out that the binary does not bail out:
@@ -174,6 +184,7 @@ for dir in %{_bindir} /%{_lib} %{_libdir} ; do
xargs %{buildroot}%{_bindir}/file -m %{buildroot}%{_miscdir}/magic
done
unset LD_LIBRARY_PATH
unset GLIBC_TUNABLES
%post -n %libname -p /sbin/ldconfig

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-magic
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -21,7 +21,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global _miscdir %{_datadir}/misc
Name: python-magic
Version: 5.45
Version: 5.46
Release: 0
Summary: Python module to use libmagic
License: BSD-3-Clause AND BSD-4-Clause