- Don't use setup.py test, that is now not allowed.

OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=278
This commit is contained in:
Dirk Mueller 2024-08-12 07:31:23 +00:00 committed by Git OBS Bridge
commit f8673cfbc7
33 changed files with 3601 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>python-magic</package>
</multibuild>

7
baselibs.conf Normal file
View File

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

15
file-4.20-ssd.dif Normal file
View File

@ -0,0 +1,15 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -14,3 +14,12 @@
>33 string >\0 (%s)
2 string \000\022 TeX font metric data
>33 string >\0 (%s)
+
+# XXX some MS Structured Storage Documents such as Adobe PageMaker[tm]
+# files interfere with the Microsoft Office Document and the SSD starting
+# sequence \320\317\021\340\241\261\032\341. Anyone who knows
+# more details about the scheme of such SSDs and can help to extend this to all
+# type of SSD, please let us know. E.g. how is the offset to the `Root Entry'
+# determined?
+512 search/531 R\0o\0o\0t\0\ \0E\0n\0t\0r\0y Structured Storage
+>&109 search/17 P\0a\0g\0e\0M\0a\0k\0e\0r PageMaker

12
file-4.20-xen.dif Normal file
View File

@ -0,0 +1,12 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -23,3 +23,9 @@
# determined?
512 search/531 R\0o\0o\0t\0\ \0E\0n\0t\0r\0y Structured Storage
>&109 search/17 P\0a\0g\0e\0M\0a\0k\0e\0r PageMaker
+
+# File magic for Xen, the virtual machine monitor for x86
+0 string LinuxGuestRecord Xen saved domain
+#>2 regex \(name\ [^)]*\) %s
+>20 search/256 (name (name
+>>&1 string x %s...)

10
file-4.21-scribus.dif Normal file
View File

@ -0,0 +1,10 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -29,3 +29,7 @@
#>2 regex \(name\ [^)]*\) %s
>20 search/256 (name (name
>>&1 string x %s...)
+
+# File magic for Scribus, an Open Source Desktop Publishing system
+0 string \<SCRIBUSUTF8\ Version Scribus Document
+0 string \<SCRIBUSUTF8NEW\ Version Scribus Document

9
file-4.21-xcursor.dif Normal file
View File

@ -0,0 +1,9 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -33,3 +33,6 @@
# File magic for Scribus, an Open Source Desktop Publishing system
0 string \<SCRIBUSUTF8\ Version Scribus Document
0 string \<SCRIBUSUTF8NEW\ Version Scribus Document
+
+# File magic for X11 cursor data files
+0 string Xcur\020\000 X11 cursor data

46
file-4.24-autoconf.dif Normal file
View File

@ -0,0 +1,46 @@
---
doc/Makefile.am | 6 ++++--
src/readelf.h | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
--- doc/Makefile.am
+++ doc/Makefile.am 2018-07-26 10:42:25.474794639 +0000
@@ -5,7 +5,8 @@ else
man_MAGIC = magic.4
endif
fsect = @fsect@
-man_MANS = file.1 $(man_MAGIC) libmagic.3
+#man_MANS = file.1 $(man_MAGIC) libmagic.3
+man_MANS = file.1 magic.5 libmagic.3
EXTRA_DIST = file.man magic.man libmagic.man
CLEANFILES = $(man_MANS)
@@ -17,7 +18,8 @@ file.1: Makefile file.man
-e s@__VERSION__@${VERSION}@g \
-e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@
-magic.${fsect}: Makefile magic.man
+#magic.${fsect}: Makefile magic.man
+magic.5: Makefile magic.man
@rm -f $@
sed -e s@__CSECTION__@1@g \
-e s@__FSECTION__@${fsect}@g \
--- src/readelf.h
+++ src/readelf.h 2018-07-26 10:44:03.744990438 +0000
@@ -34,7 +34,10 @@
#ifndef __fake_elf_h__
#define __fake_elf_h__
+#include <features.h>
+
#if HAVE_STDINT_H
+__BEGIN_DECLS
#include <stdint.h>
#endif
@@ -542,4 +545,5 @@ typedef struct {
#define DF_1_STUB 0x04000000 /* Stub */
#define DF_1_PIE 0x08000000 /* Position Independent Executable */
+__END_DECLS
#endif

15
file-5.14-tex.dif Normal file
View File

@ -0,0 +1,15 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -5,3 +5,12 @@
# $File: Localstuff,v 1.5 2007/01/12 17:38:27 christos Exp $
# Add any locally observed files here. Remember:
# text if readable, executable if runnable binary, data if unreadable.
+
+# XXX promoted from tex so that *.tfm is not mis-identified as mc68k file.
+# There is no way to detect TeX Font Metric (*.tfm) files without
+# breaking them apart and reading the data. The following patterns
+# match most *.tfm files generated by METAFONT or afm2tfm.
+2 string \000\021 TeX font metric data
+>33 string >\0 (%s)
+2 string \000\022 TeX font metric data
+>33 string >\0 (%s)

40
file-5.17-option.dif Normal file
View File

@ -0,0 +1,40 @@
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[])
break;
case 'e':
case OPT_EXCLUDE_QUIET:
+ if (!optarg)
+ usage();
for (i = 0; i < __arraycount(nv); i++)
if (strcmp(nv[i].name, optarg) == 0)
break;
@@ -275,7 +277,7 @@ main(int argc, char *argv[])
break;
case 'f':
- if(action)
+ if(action || !optarg)
usage();
if (magic == NULL)
if ((magic = load(magicfile, flags)) == NULL)
@@ -285,6 +287,8 @@ main(int argc, char *argv[])
++didsomefiles;
break;
case 'F':
+ if(!optarg)
+ usage();
separator = optarg;
break;
case 'i':
@@ -297,6 +301,8 @@ main(int argc, char *argv[])
action = FILE_LIST;
break;
case 'm':
+ if(!optarg)
+ usage();
magicfile = optarg;
break;
case 'n':

13
file-5.18-javacheck.dif Normal file
View File

@ -0,0 +1,13 @@
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
-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

17
file-5.19-biorad.dif Normal file
View File

@ -0,0 +1,17 @@
---
magic/Magdir/images | 2 ++
1 file changed, 2 insertions(+)
Index: magic/Magdir/images
===================================================================
--- magic/Magdir/images.orig
+++ magic/Magdir/images
@@ -2180,6 +2180,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
+>4 uleshort >0
+>49 byte 0
>62 uleshort <2
>>54 uleshort 12345 Bio-Rad .PIC Image File
>>>0 uleshort >0 %d x

14
file-5.19-clicfs.dif Normal file
View File

@ -0,0 +1,14 @@
--- magic/Localstuff
+++ magic/Localstuff 2013-09-30 00:00:00.000000000 +0000
@@ -53,3 +53,11 @@
0 string SOLV Sat-solver solv file,
>4 belong x version %d
+
+# coolo's clicfs
+
+0 string/b CLIC ClicFS
+>4 byte x \b Version %c
+>5 byte x \b%c
+>6 long >0
+>>6 pstring/l >0 \b, Target "%s"

19
file-5.19-cromfs.dif Normal file
View File

@ -0,0 +1,19 @@
--- magic/Localstuff
+++ magic/Localstuff 2014-06-25 08:49:53.486735323 +0000
@@ -36,3 +36,16 @@
# File magic for X11 cursor data files
0 string Xcur\020\000 X11 cursor data
+
+# File magic for CROM File System
+
+0 string CROMFS CROMFS
+>6 string >\0 \b version %2.2s,
+>8 ulequad >0 \b block data at %lld,
+>16 ulequad >0 \b fblock table at %lld,
+>24 ulequad >0 \b inode table at %lld,
+>32 ulequad >0 \b root at %lld,
+>40 ulelong >0 \b fblock size = %d,
+>44 ulelong >0 \b block size = %d,
+>48 ulequad >0 \b bytes = %lld
+

11
file-5.19-misc.dif Normal file
View File

@ -0,0 +1,11 @@
--- magic/Magdir/audio
+++ magic/Magdir/audio 2013-09-30 00:00:00.000000000 +0000
@@ -129,7 +129,7 @@
# Oct 31, 1995
# fixed by <doj@cubic.org> 2003-06-24
# Too short...
-#0 string MTM MultiTracker Module sound file
+#0 string MTM MultiTracker Module sound data
#0 string if Composer 669 Module sound data
#0 string JN Composer 669 Module sound data (extended format)
0 string MAS_U ULT(imate) Module sound data

17
file-5.19-printf.dif Normal file
View File

@ -0,0 +1,17 @@
---
src/apprentice.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: src/apprentice.c
===================================================================
--- src/apprentice.c.orig
+++ src/apprentice.c
@@ -2623,7 +2623,7 @@ check_format_type(const char *ptr, int t
}
} else
h = 0;
- while (*ptr && strchr("-.#", *ptr) != NULL)
+ while (*ptr && strchr("-.# +'", *ptr) != NULL)
ptr++;
#define CHECKLEN() do { \
for (len = cnt = 0; isdigit(CAST(unsigned char, *ptr)); ptr++, cnt++) \

10
file-5.19-solv.dif Normal file
View File

@ -0,0 +1,10 @@
--- magic/Localstuff
+++ magic/Localstuff 2014-06-25 08:53:43.110735387 +0000
@@ -49,3 +49,7 @@
>44 ulelong >0 \b block size = %d,
>48 ulequad >0 \b bytes = %lld
+# libsatsolver solv file
+
+0 string SOLV Sat-solver solv file,
+>4 belong x version %d

18
file-5.19-zip2.0.dif Normal file
View File

@ -0,0 +1,18 @@
---
magic/Magdir/archive | 5 +++++
1 file changed, 5 insertions(+)
--- magic/Magdir/archive
+++ magic/Magdir/archive 2023-07-28 09:40:12.243809381 +0000
@@ -1622,6 +1622,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
+!:ext zip/cbz
# Android APK file (Zip archive)
0 string PK\003\004

28
file-5.22-elf.dif Normal file
View File

@ -0,0 +1,28 @@
---
src/readelf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: src/readelf.c
===================================================================
--- src/readelf.c.orig
+++ src/readelf.c
@@ -825,7 +825,7 @@ do_core_note(struct magic_set *ms, unsig
default:
if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {
- size_t i, j;
+ size_t i, j, m = 0;
unsigned char c;
/*
* Extract the program name. We assume
@@ -837,7 +837,9 @@ do_core_note(struct magic_set *ms, unsig
* If the characters aren't all printable,
* reject it.
*/
- for (i = 0; i < NOFFSETS; i++) {
+ if (os_style == OS_STYLE_SVR4)
+ m = 1;
+ for (i = m; i < NOFFSETS; i++) {
unsigned char *cname, *cp;
size_t reloffset = prpsoffsets(i);
size_t noffset = doff + reloffset;

63
file-5.28-btrfs-image.dif Normal file
View File

@ -0,0 +1,63 @@
From 27ec95a88943d858433a492940c694bac4bc54d0 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney <jeffm@jeffm.io>
Date: Thu, 20 Oct 2016 11:29:21 -0400
Subject: [PATCH] Add BTRFS Filesystem Metadata Image
Patch-mainline: Submitted to file@mx.gw.com, 20 Oct 2016
The btrfs-image in its uncompressed form contains a directly usable
superblock. Rather than duplicate the superblock printer, split
that out and use it with both the on-disk superblock and the ones
contained within the image.
---
magic/Magdir/filesystems | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
Index: file-5.43/magic/Magdir/filesystems
===================================================================
--- file-5.43.orig/magic/Magdir/filesystems
+++ file-5.43/magic/Magdir/filesystems
@@ -2257,20 +2257,29 @@
>>0x10060 string >\0 lockproto %s)
# Russell Coker <russell@coker.com.au>
-0x10040 string _BHRfS_M BTRFS Filesystem
->0x1012b string >\0 label "%s",
->0x10090 lelong x sectorsize %d,
->0x10094 lelong x nodesize %d,
->0x10098 lelong x leafsize %d,
->0x10020 ubelong x UUID=%08x-
->0x10024 ubeshort x \b%04x-
->0x10026 ubeshort x \b%04x-
->0x10028 ubeshort x \b%04x-
->0x1002a ubeshort x \b%04x
->0x1002c ubelong x \b%08x,
->0x10078 lequad x %lld/
->0x10070 lequad x \b%lld bytes used,
->0x10088 lequad x %lld devices
+0x10040 string _BHRfS_M
+>0x10000 use btrfs_super_block
+0 name btrfs_super_block
+>0x40 string _BHRfS_M BTRFS Filesystem
+>0x12b string >\0 label "%s",
+>0x90 lelong x sectorsize %d,
+>0x94 lelong x nodesize %d,
+>0x98 lelong x leafsize %d,
+>0x20 ubelong x UUID=%08x-
+>0x24 ubeshort x \b%04x-
+>0x26 ubeshort x \b%04x-
+>0x28 ubeshort x \b%04x-
+>0x2a ubeshort x \b%04x
+>0x2c ubelong x \b%08x,
+>0x78 lequad x %lld/
+>0x70 lequad x \b%lld bytes used,
+>0x88 lequad x %lld devices
+
+0 lequad 0xbd5c25e27295668b BTRFS Filesystem Metadata Image
+>20 byte 1 \b, zlib compressed
+>20 byte 0 \b, uncompressed
+>>0x440 string _BHRfS_M \b, contains
+>>>0x400 use btrfs_super_block
0 string btrfs-stream BTRFS stream file

42
file-5.45-type_t.dif Normal file
View File

@ -0,0 +1,42 @@
---
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

598
file-5.45.dif Normal file
View File

@ -0,0 +1,598 @@
---
magic/Magdir/elf | 2
magic/Magdir/linux | 36 +++++----
magic/Magdir/msad | 5 +
magic/Magdir/msdos | 6 -
magic/Makefile.am | 63 +++++++++-------
magic/Makefile.in | 60 +++++++++------
src/Makefile.am | 2
src/dcore.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 313 insertions(+), 68 deletions(-)
--- magic/Magdir/elf
+++ magic/Magdir/elf 2023-07-28 09:42:01.845813939 +0000
@@ -154,7 +154,7 @@
>18 leshort 47 Renesas H8/300H,
>18 leshort 48 Renesas H8S,
>18 leshort 49 Renesas H8/500,
->18 leshort 50 IA-64,
+>18 leshort 50 IA-64 (Intel 64 bit architecture),
>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
--- magic/Magdir/msad
+++ magic/Magdir/msad 2023-07-28 09:42:01.845813939 +0000
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# msad: file(1) magic for msad
+# Microsoft visual C
+# 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
>>(0x3c.l+24) leshort 0x010b
->>>(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
# 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 @@
>1 leshort <-259
# that offset must be accessible
# add 10000h to jump at end of 64 KiB segment, add 1 for jump instruction and 2 for 16-bit offset
->>(1,s+65539) byte x
+>>(1.s+65539) byte x
# after jump next instruction for DEBUGGING!
#>>>&-1 ubelong x \b, NEXT instruction %#8.8x
>>>0 use msdos-com
--- magic/Makefile.am
+++ magic/Makefile.am 2023-07-28 09:42:01.849813866 +0000
@@ -5,7 +5,7 @@ MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
-pkgdata_DATA = magic.mgc
+pkgdata_DATA = magic.mgc magic
MAGIC_FRAGMENTS = \
$(MAGIC_DIR)/Header \
@@ -24,7 +24,6 @@ $(MAGIC_FRAGMENT_DIR)/animation \
$(MAGIC_FRAGMENT_DIR)/aout \
$(MAGIC_FRAGMENT_DIR)/apache \
$(MAGIC_FRAGMENT_DIR)/apl \
-$(MAGIC_FRAGMENT_DIR)/apple \
$(MAGIC_FRAGMENT_DIR)/application \
$(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/apt \
@@ -106,7 +105,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/espressif \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
-$(MAGIC_FRAGMENT_DIR)/filesystems \
$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/firmware \
$(MAGIC_FRAGMENT_DIR)/flash \
@@ -153,6 +151,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
$(MAGIC_FRAGMENT_DIR)/java \
$(MAGIC_FRAGMENT_DIR)/javascript \
$(MAGIC_FRAGMENT_DIR)/jpeg \
+$(MAGIC_FRAGMENT_DIR)/linux \
+$(MAGIC_FRAGMENT_DIR)/filesystems \
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -163,7 +163,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
-$(MAGIC_FRAGMENT_DIR)/linux \
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -171,7 +170,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
-$(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -195,11 +193,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
-$(MAGIC_FRAGMENT_DIR)/modem \
$(MAGIC_FRAGMENT_DIR)/modulefile \
$(MAGIC_FRAGMENT_DIR)/motorola \
$(MAGIC_FRAGMENT_DIR)/mozilla \
$(MAGIC_FRAGMENT_DIR)/msdos \
+$(MAGIC_FRAGMENT_DIR)/modem \
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -263,6 +261,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
+$(MAGIC_FRAGMENT_DIR)/apple \
+$(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -355,9 +355,21 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
-
+RAW = magic
MAGIC = magic.mgc
-CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
+CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff ${RAW}
+
+${RAW}: $(MAGIC_DIR)/Header $(MAGIC_DIR)/Localstuff $(MAGIC_FRAGMENTS)
+ cat /dev/null > $@
+ for frag in $(MAGIC_FRAGMENTS); do \
+ if test -f $(srcdir)/$$frag; then \
+ f=$(srcdir)/$$frag; \
+ else \
+ f=$$frag; \
+ fi; \
+ cat $$f; \
+ done >> $@
+
# 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$
FILE_COMPILE_DEP = $(FILE_COMPILE)
endif
-${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP)
- @rm -fr magic
- @mkdir magic && cp -p $(MAGIC_FRAGMENTS) magic
- @(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
- echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
- else \
- v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
- if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
- echo "Cannot use the installed version of file ($$v) to"; \
- echo "cross-compile file ${PACKAGE_VERSION}"; \
- echo "Please install file ${PACKAGE_VERSION} locally first"; \
- exit 1; \
- fi; \
- fi)
- $(FILE_COMPILE) -C -m magic
- @rm -fr magic
+${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP) $(RAW)
+ $(FILE_COMPILE) -C -m $(RAW)
+
+#${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP)
+# @rm -fr magic
+# @mkdir magic && cp -p $(MAGIC_FRAGMENTS) magic
+# @(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
+# echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
+# else \
+# v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
+# if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
+# echo "Cannot use the installed version of file ($$v) to"; \
+# echo "cross-compile file ${PACKAGE_VERSION}"; \
+# echo "Please install file ${PACKAGE_VERSION} locally first"; \
+# exit 1; \
+# fi; \
+# fi)
+# $(FILE_COMPILE) -C -m magic
+# @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@
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
-pkgdata_DATA = magic.mgc
+pkgdata_DATA = magic.mgc magic
MAGIC_FRAGMENTS = \
$(MAGIC_DIR)/Header \
$(MAGIC_DIR)/Localstuff \
@@ -301,7 +301,6 @@ $(MAGIC_FRAGMENT_DIR)/animation \
$(MAGIC_FRAGMENT_DIR)/aout \
$(MAGIC_FRAGMENT_DIR)/apache \
$(MAGIC_FRAGMENT_DIR)/apl \
-$(MAGIC_FRAGMENT_DIR)/apple \
$(MAGIC_FRAGMENT_DIR)/application \
$(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/apt \
@@ -383,7 +382,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/espressif \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
-$(MAGIC_FRAGMENT_DIR)/filesystems \
$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/firmware \
$(MAGIC_FRAGMENT_DIR)/flash \
@@ -430,6 +428,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
$(MAGIC_FRAGMENT_DIR)/java \
$(MAGIC_FRAGMENT_DIR)/javascript \
$(MAGIC_FRAGMENT_DIR)/jpeg \
+$(MAGIC_FRAGMENT_DIR)/linux \
+$(MAGIC_FRAGMENT_DIR)/filesystems \
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -440,7 +440,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
-$(MAGIC_FRAGMENT_DIR)/linux \
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -448,7 +447,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
-$(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -472,11 +470,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
-$(MAGIC_FRAGMENT_DIR)/modem \
$(MAGIC_FRAGMENT_DIR)/modulefile \
$(MAGIC_FRAGMENT_DIR)/motorola \
$(MAGIC_FRAGMENT_DIR)/mozilla \
$(MAGIC_FRAGMENT_DIR)/msdos \
+$(MAGIC_FRAGMENT_DIR)/modem \
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -540,6 +538,8 @@ $(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/ringdove \
$(MAGIC_FRAGMENT_DIR)/riff \
+$(MAGIC_FRAGMENT_DIR)/apple \
+$(MAGIC_FRAGMENT_DIR)/macintosh \
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -632,10 +632,22 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
+RAW = magic
MAGIC = magic.mgc
-CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff
+CLEANFILES = ${MAGIC} $(MAGIC_FRAGMENT_DIR)/Localstuff ${RAW}
@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file${EXEEXT}
+${RAW}: $(MAGIC_DIR)/Header $(MAGIC_DIR)/Localstuff $(MAGIC_FRAGMENTS)
+ cat /dev/null > $@
+ for frag in $(MAGIC_FRAGMENTS); do \
+ if test -f $(srcdir)/$$frag; then \
+ f=$(srcdir)/$$frag; \
+ else \
+ f=$$frag; \
+ fi; \
+ cat $$f; \
+ done >> $@
+
# 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
.PRECIOUS: Makefile
+${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP) $(RAW)
+ $(FILE_COMPILE) -C -m $(RAW)
-${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP)
- @rm -fr magic
- @mkdir magic && cp -p $(MAGIC_FRAGMENTS) magic
- @(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
- echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
- else \
- v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
- if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
- echo "Cannot use the installed version of file ($$v) to"; \
- echo "cross-compile file ${PACKAGE_VERSION}"; \
- echo "Please install file ${PACKAGE_VERSION} locally first"; \
- exit 1; \
- fi; \
- fi)
- $(FILE_COMPILE) -C -m magic
- @rm -fr magic
+#${MAGIC}: $(MAGIC_FRAGMENTS) $(FILE_COMPILE_DEP)
+# @rm -fr magic
+# @mkdir magic && cp -p $(MAGIC_FRAGMENTS) magic
+# @(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
+# echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
+# else \
+# v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
+# if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
+# echo "Cannot use the installed version of file ($$v) to"; \
+# echo "cross-compile file ${PACKAGE_VERSION}"; \
+# echo "Please install file ${PACKAGE_VERSION} locally first"; \
+# exit 1; \
+# fi; \
+# fi)
+# $(FILE_COMPILE) -C -m magic
+# @rm -fr magic
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
--- src/Makefile.am
+++ src/Makefile.am 2023-07-28 09:42:01.849813866 +0000
@@ -1,4 +1,4 @@
-MAGIC = $(pkgdatadir)/magic
+MAGIC = $(sysconfdir)/magic:$(pkgdatadir)/magic
lib_LTLIBRARIES = libmagic.la
nodist_include_HEADERS = magic.h
--- src/dcore.c
+++ src/dcore.c 2023-07-28 09:42:01.865813574 +0000
@@ -0,0 +1,207 @@
+/*
+ * Show goo about ELF core files
+ * Jeremy Fitzhardinge <jeremy@zip.com.au> 1996
+ */
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#if defined __GLIBC__ && __GLIBC__ >= 2
+#include <elf.h>
+#include <sys/procfs.h>
+# ifndef NT_PRFPREG
+# define NT_PRFPREG 2
+# endif
+# ifndef NT_TASKSTRUCT
+# define NT_TASKSTRUCT 4
+# endif
+#else
+#include <linux/elf.h>
+#include <linux/elfcore.h>
+#endif
+
+static void fperror(const char *str)
+{
+ perror(str);
+ exit(1);
+}
+
+static size_t myread(int fd, void *buf, size_t sz)
+{
+ size_t ret;
+
+ if ((ret = read(fd, buf, sz)) != sz)
+ fperror("read failed");
+ return ret;
+}
+
+static void print_prstatus(const prstatus_t *pr)
+{
+ unsigned i;
+ static const char *regs[] = { "ebx", "ecx", "edx", "esi", "edi", "ebp",
+ "eax", "ds", "es", "fs", "gs",
+ "orig_eax", "eip", "cs",
+ "efl", "uesp", "ss"};
+
+ printf(" pid=%d ppid=%d pgrp=%d sid=%d\n",
+ pr->pr_pid, pr->pr_ppid, pr->pr_pgrp, pr->pr_sid);
+ for(i = 0; i < NGREG; i++)
+ {
+ unsigned long val = pr->pr_reg[i];
+ printf(" %-2u %-5s=%08lx %lu\n", i, regs[i], val, val);
+ }
+}
+
+static void print_prpsinfo(const prpsinfo_t *ps)
+{
+ printf(" uid=%d gid=%d\n", ps->pr_uid, ps->pr_gid);
+ printf(" comm=%s\n", ps->pr_fname);
+ printf(" psargs=%s\n", ps->pr_psargs);
+}
+
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+
+static void do_note(int fd, Elf32_Phdr *phdr)
+{
+ off_t here = lseek(fd, 0, SEEK_CUR);
+ int size = phdr->p_filesz;
+ char *raw = alloca(size), *end;
+ end = raw+size;
+
+ lseek(fd, phdr->p_offset, SEEK_SET);
+ myread(fd, raw, size);
+
+ while(raw < end)
+ {
+ Elf32_Nhdr *note = (Elf32_Nhdr *)raw;
+ const char *str;
+ const char *name, *desc;
+
+ raw += sizeof(*note);
+ name = raw;
+ raw += roundup(note->n_namesz, sizeof(long));
+ desc = raw;
+ raw += roundup(note->n_descsz, sizeof(long));
+
+ printf(" name=%.*s", (int)note->n_namesz, name);
+
+ if(strncmp(name, "CORE", note->n_namesz) != 0)
+ {
+ printf("\n");
+ continue;
+ }
+
+ switch(note->n_type)
+ {
+#define X(x) case x: str = #x; break;
+ X(NT_PRSTATUS);
+ X(NT_PRFPREG);
+ X(NT_PRPSINFO);
+ X(NT_TASKSTRUCT);
+#undef X
+ default:
+ str = "???";
+ }
+ printf(" n_type=%s n_descsz=%ld\n",
+ str, note->n_descsz);
+ switch(note->n_type)
+ {
+ case NT_PRSTATUS:
+ print_prstatus((prstatus_t *)desc);
+ break;
+ case NT_PRPSINFO:
+ print_prpsinfo((prpsinfo_t *)desc);
+ break;
+ }
+ }
+ lseek(fd, here, SEEK_SET);
+}
+
+int main(int argc, char *argv[])
+{
+ int fd;
+ Elf32_Ehdr elf;
+ int i;
+
+ if (argc != 2)
+ {
+ fprintf(stderr, "Usage: %s corefile\n", argv[0]);
+ exit(1);
+ }
+
+ if ((fd = open(argv[1], O_RDONLY)) == -1)
+ fperror("open of core");
+
+ myread(fd, &elf, sizeof(elf));
+
+ if (memcmp(ELFMAG, elf.e_ident, SELFMAG) != 0)
+ printf("bad magic\n");
+
+ if (elf.e_ident[EI_CLASS] != ELFCLASS32)
+ printf("wrong class\n");
+
+ if (elf.e_ident[EI_DATA] != ELFDATA2LSB)
+ printf("wrong endianess\n");
+
+ if (elf.e_ident[EI_VERSION] != EV_CURRENT)
+ printf("wrong version\n");
+
+ {
+ const char *str;
+ switch(elf.e_type)
+ {
+#define C(x) case ET_##x: str = #x; break;
+ C(NONE);
+ C(REL);
+ C(EXEC);
+ C(DYN);
+ C(CORE);
+#undef C
+ default: str = "???"; break;
+ }
+ printf("elf file type ET_%s\n", str);
+ }
+
+ if (elf.e_machine != EM_386 && elf.e_machine != EM_486)
+ printf("not i386 or i486\n");
+
+ if (elf.e_ehsize != sizeof(elf))
+ printf("wrong header size\n");
+
+ if (elf.e_phentsize != sizeof(Elf32_Phdr))
+ printf("wrong phdr size\n");
+
+ if (lseek(fd, elf.e_phoff, SEEK_SET) != (off_t)elf.e_phoff)
+ fperror("lseek to phdr failed\n");
+
+ for(i = 0; i < elf.e_phnum; i++)
+ {
+ Elf32_Phdr phdr;
+ const char *str;
+
+ myread(fd, &phdr, sizeof(phdr));
+ switch(phdr.p_type)
+ {
+#define C(x) case PT_##x: str = #x; break;
+ C(NULL);
+ C(LOAD);
+ C(DYNAMIC);
+ C(INTERP);
+ C(NOTE);
+ C(SHLIB);
+ C(PHDR);
+#undef C
+ default:
+ str = "???"; break;
+ }
+ printf("type PT_%s off=%ld vaddr=%lx filesz=%ld flags=%lx\n",
+ str, phdr.p_offset, phdr.p_vaddr, phdr.p_filesz,
+ (unsigned long)phdr.p_flags);
+ if (phdr.p_type == PT_NOTE)
+ do_note(fd, &phdr);
+ }
+ exit(0);
+}
+

3
file-5.45.tar.gz Normal file
View File

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

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

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

2
file-rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
addFilter(".*W:.*name-repeated-in-summary.*")
addFilter(".*:.*shlib-fixed-dependency.*")

77
file-secure_getenv.patch Normal file
View File

@ -0,0 +1,77 @@
---
file-5.42/configure.ac | 2 ++
file-5.42/src/file.h | 8 ++++++++
file-5.42/src/magic.c | 12 ++++++------
3 files changed, 16 insertions(+), 6 deletions(-)
--- 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
fi
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
+AC_CHECK_FUNCS([__secure_getenv secure_getenv])
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
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)
#define __RCSID(a)
#endif
+#ifndef HAVE_SECURE_GETENV
+# ifdef HAVE___SECURE_GETENV
+# define secure_getenv __secure_getenv
+# else
+# error neither secure_getenv nor __secure_getenv is available
+# endif
+#endif
+
#endif /* __file_h__ */
--- file-5.42/src/magic.c
+++ file-5.42/src/magic.c 2022-06-13 08:36:49.997304349 +0000
@@ -185,7 +185,7 @@ get_default_magic(void)
free(default_magic);
default_magic = NULL;
}
- if ((home = getenv("HOME")) == NULL)
+ if ((home = secure_getenv("HOME")) == NULL)
return MAGIC;
if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0)
@@ -222,20 +222,20 @@ out:
}
/* Before anything else, try to get a magic file from user HOME */
- if ((home = getenv("HOME")) != NULL)
+ if ((home = secure_getenv("HOME")) != NULL)
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
/* First, try to get a magic file from user-application data */
- if ((home = getenv("LOCALAPPDATA")) != NULL)
+ if ((home = secure_getenv("LOCALAPPDATA")) != NULL)
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
/* Second, try to get a magic file from the user profile data */
- if ((home = getenv("USERPROFILE")) != NULL)
+ if ((home = secure_getenv("USERPROFILE")) != NULL)
_w32_append_path(&hmagicpath,
"%s/Local Settings/Application Data%s", home, hmagic);
/* Third, try to get a magic file from Common Files */
- if ((home = getenv("COMMONPROGRAMFILES")) != NULL)
+ if ((home = secure_getenv("COMMONPROGRAMFILES")) != NULL)
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
/* Fourth, try to get magic file relative to exe location */
@@ -256,7 +256,7 @@ magic_getpath(const char *magicfile, int
if (magicfile != NULL)
return magicfile;
- magicfile = getenv("MAGIC");
+ magicfile = secure_getenv("MAGIC");
if (magicfile != NULL)
return magicfile;

1925
file.changes Normal file

File diff suppressed because it is too large Load Diff

43
file.keyring Normal file
View File

@ -0,0 +1,43 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
3fhT6pGrAJ42qJm0ptKqlSBwuYo2Ci36ZIQCaQ==
=IJYi
-----END PGP PUBLIC KEY BLOCK-----

215
file.spec Normal file
View File

@ -0,0 +1,215 @@
#
# spec file for package file
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define somajor 1
%define libname libmagic%{somajor}
Name: file
BuildRequires: bash >= 4.0
BuildRequires: libtool
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libseccomp)
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(zlib)
URL: http://www.darwinsys.com/file/
# bug437293
%ifarch ppc64
Obsoletes: file-64bit
%endif
#
# Set Version also in python-magic.spec
Version: 5.45
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
Patch1: file-5.19-misc.dif
Patch4: file-4.24-autoconf.dif
Patch5: file-5.14-tex.dif
Patch7: file-4.20-ssd.dif
Patch8: file-4.20-xen.dif
Patch9: file-5.22-elf.dif
Patch10: file-5.19-printf.dif
Patch12: file-5.17-option.dif
Patch13: file-4.21-scribus.dif
Patch15: file-4.21-xcursor.dif
Patch22: file-5.19-cromfs.dif
Patch25: file-5.18-javacheck.dif
Patch26: file-5.19-solv.dif
Patch27: file-5.19-zip2.0.dif
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
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir /etc
%global magicdir %{_datadir}/file
%global _miscdir %{_datadir}/misc
%description
With the file command, you can obtain information on the file type of a
specified file. File type recognition is controlled by the file
/etc/magic, which contains the classification criteria. This command is
used by apsfilter to permit automatic printing of different file types.
%package magic
Summary: Database for libmagic to help identify files
Group: Productivity/File utilities
Obsoletes: libmagic-data < %{version}
Provides: libmagic-data = %{version}
BuildArch: noarch
%description magic
This package contains the basic magic files that libmagic reads and uses
to estimate a file's type.
%package -n %libname
Summary: Library for heuristic file type identification
Group: System/Libraries
Provides: file:%{_libdir}/libmagic.so.%{somajor}
Requires: file-magic = %{version}
%description -n %libname
This library reads magic files and detects file types. Used by file command
%package devel
Summary: Development files for libmagic, a library to determine file types
Group: Development/Libraries/C and C++
Provides: file:/usr/include/magic.h
Requires: %libname = %{version}
Requires: glibc-devel
%description devel
This package contains all necessary include files and libraries needed
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
%patch -P 7 -p0 -b .ssd
%patch -P 8 -p0 -b .xen
%patch -P 9 -p0 -b .elf
%patch -P 10 -p0 -b .prtf
%patch -P 12 -p1 -b .opt
%patch -P 13 -p0 -b .scri
%patch -P 15 -p0 -b .xcur
%patch -P 22 -p0 -b .cromfs
%patch -P 25 -p0 -b .javacheck
%patch -P 26 -p0 -b .solv
%patch -P 27 -p0 -b .zip2.0
%patch -P 31 -p0 -b .biorad
%patch -P 32 -p0 -b .clicfs
%patch -P 37 -p1 -b .getenv
%patch -P 39 -p1 -b .btrfs
%patch -P 0 -b .0
test -s src/magic.h.in || cp -p src/magic.h src/magic.h.in
rm -fv src/magic.h
%build
export LANG=POSIX
export LC_ALL=POSIX
rm -f Magdir/*,v Magdir/*~
rm -f ltcf-c.sh ltconfig ltmain.sh
autoreconf -fiv
export CFLAGS="%{optflags} -DHOWMANY=69632 -fPIE $(pkg-config libseccomp --cflags)"
%configure --disable-silent-rules --datadir=%{magicdir} \
--disable-static \
--enable-fsect-man5
make %{?_smp_mflags} pkgdatadir='$(datadir)' LDFLAGS="-pie"
%install
export LANG=POSIX
export LC_ALL=POSIX
mkdir %{buildroot}/etc
make DESTDIR=%{buildroot} install pkgdatadir='$(datadir)'
rm -vf %{buildroot}%{_sysconfdir}/magic
echo '# Localstuff: file(1) magic(5) for locally observed files' > %{buildroot}%{_sysconfdir}/magic
echo '# global magic file is %{magicdir}/magic(.mgc)' >> %{buildroot}%{_sysconfdir}/magic
# Does not build
mkdir -p %{buildroot}%{_miscdir}
ln -s %{magicdir}/magic %{buildroot}%{_miscdir}/magic
ln -s %{magicdir}/magic.mgc %{buildroot}%{_miscdir}/magic.mgc
%if %{with decore}
install -s dcore %{buildroot}%{_bindir}
%endif
rm -f %{buildroot}%{_libdir}/*.la
%check
# Standard checks
make check
# Check out that the binary does not bail out:
LD_LIBRARY_PATH=%{buildroot}%{_libdir}
export LD_LIBRARY_PATH
%{buildroot}%{_bindir}/file -m %{buildroot}%{_miscdir}/magic %{buildroot}%{_bindir}/file
shopt -s globstar
for dir in %{_bindir} /%{_lib} %{_libdir} ; do
echo $dir/** | \
xargs %{buildroot}%{_bindir}/file -m %{buildroot}%{_miscdir}/magic
done
unset LD_LIBRARY_PATH
%post -n %libname -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig
%files -n %libname
%defattr (-,root,root)
%{_libdir}/lib*.so.*
%files magic
%defattr (-,root,root)
%config(noreplace) %{_sysconfdir}/magic
%{_miscdir}/magic
%{_miscdir}/magic.mgc
%dir %{magicdir}
%{magicdir}/magic
%{magicdir}/magic.mgc
%doc %{_mandir}/man5/magic.5.gz
%files
%defattr (-,root,root)
%if %{with decore}
%attr(755,root,root) %{_bindir}/dcore
%endif
%attr(755,root,root) %{_bindir}/file
%doc %{_mandir}/man1/file.1.gz
%license COPYING
%doc AUTHORS NEWS ChangeLog
%files devel
%defattr (-,root,root)
%{_libdir}/lib*.so
%{_includedir}/magic.h
%{_libdir}/pkgconfig/libmagic.pc
%doc %{_mandir}/man3/libmagic.3.gz
%license COPYING
%doc README.DEVELOPER AUTHORS NEWS ChangeLog
%changelog

4
pre_checkin.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# This script is called automatically during autobuild checkin.
version=$(grep '^Version:.*' file.spec)
sed -ri "s,^Version:.*,$version," python-magic.spec

222
python-magic.changes Normal file
View File

@ -0,0 +1,222 @@
-------------------------------------------------------------------
Fri Aug 9 14:18:25 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Don't use `setup.py test`, that is now not allowed.
-------------------------------------------------------------------
Thu May 4 14:15:38 UTC 2023 - Frederic Crozat <fcrozat@suse.com>
- Add _multibuild to define additional spec files as additional
flavors.
Eliminates the need for source package links in OBS.
-------------------------------------------------------------------
Tue Jan 10 13:28:15 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Enable tests for python-magic (not python-python-magic)
-------------------------------------------------------------------
Tue Jan 10 08:29:12 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Run pre_checkin.sh to get correct source tar ball
-------------------------------------------------------------------
Mon Jan 9 14:29:09 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Update to 5.44
-------------------------------------------------------------------
Mon Dec 12 08:58:58 UTC 2022 - Dirk Müller <dmueller@suse.com>
- switch to pkgconfig(zlib) so that alternative providers can be
used
-------------------------------------------------------------------
Wed Sep 14 09:00:26 UTC 2022 - Dr. Werner Fink <werner@suse.de>
- Update to 5.43 due to Dirk
-------------------------------------------------------------------
Sat Mar 19 18:01:52 UTC 2022 - Dirk Müller <dmueller@suse.com>
- spec-cleaner run
-------------------------------------------------------------------
Tue Oct 19 09:55:47 UTC 2021 - Dr. Werner Fink <werner@suse.de>
- Update to 5.41
-------------------------------------------------------------------
Sat Apr 3 07:32:11 UTC 2021 - Andreas Stieger <andreas.stieger@gmx.de>
- update to 5.40:
* file 5.40, no changes specific to python-magic
-------------------------------------------------------------------
Wed Jun 17 14:03:49 UTC 2020 - Paolo Stivanin <info@paolostivanin.com>
- Update to 5.39
-------------------------------------------------------------------
Tue Dec 17 09:59:08 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Correct version of file which is now 5.38
-------------------------------------------------------------------
Mon Oct 14 13:40:13 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Let python-magic build with latest rpm
-------------------------------------------------------------------
Wed May 29 06:08:37 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Correct version of file which is now 5.37
-------------------------------------------------------------------
Thu Feb 21 07:18:57 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Correct version of file which is now 5.36
-------------------------------------------------------------------
Thu Oct 25 06:09:52 UTC 2018 - Dr. Werner Fink <werner@suse.de>
- Correct version of file which is now 5.35
-------------------------------------------------------------------
Wed Jun 13 07:49:54 UTC 2018 - werner@suse.de
- Correct version of file which is now 5.33
-------------------------------------------------------------------
Tue Sep 26 15:17:29 UTC 2017 - jmatejek@suse.com
- converted to singlespec, dropped separate python3-magic spec file
- moved python build instructions from file.spec to python-magic.spec
- do not need to build the binary parts in order to build the python part
- removed inlining of %defines from file.spec because it is unreliable
in presence of parametrized macros
- added provides: python-file-magic to comply with the python package
naming policy
-------------------------------------------------------------------
Wed Apr 20 08:49:18 UTC 2016 - werner@suse.de
- Add Build Require python-setuptools
-------------------------------------------------------------------
Mon Apr 18 12:21:12 UTC 2016 - werner@suse.de
- Now it's file 5.26
-------------------------------------------------------------------
Tue Feb 16 12:41:14 UTC 2016 - rolf@rotkraut.de
- Make the python command a macro.
- Remove %py_requires.
- Add dependency on libmagic.
-------------------------------------------------------------------
Thu Jan 21 11:32:14 UTC 2016 - dmueller@suse.com
- add file-5.25-avoid-double-evaluation-in-python-bindings.dif (bsc#949905)
-------------------------------------------------------------------
Sun Oct 4 15:55:51 UTC 2015 - astieger@suse.com
- file 5.25:
* add a limit to the length of regex searches
* fix problems with --parameter
-------------------------------------------------------------------
Tue Jul 14 14:16:29 UTC 2015 - werner@suse.de
- adapt version in specfile to 5.24
-------------------------------------------------------------------
Thu Jun 11 15:15:34 UTC 2015 - werner@suse.de
- adapt version in specfile to 5.23
-------------------------------------------------------------------
Tue Jan 20 11:11:43 UTC 2015 - werner@suse.de
- adapt version in specfile to 5.22
-------------------------------------------------------------------
Wed Dec 17 13:13:59 UTC 2014 - werner@suse.de
- adapt version in specfile to 5.21
-------------------------------------------------------------------
Mon Oct 13 13:19:32 UTC 2014 - werner@suse.de
- adapt version in specfile to 5.20
-------------------------------------------------------------------
Wed Jun 25 09:07:13 UTC 2014 - werner@suse.de
- adapt version in specfile to 5.19
-------------------------------------------------------------------
Fri Feb 28 11:17:12 CET 2014 - ro@suse.de
- adapt version in specfile to 5.17
-------------------------------------------------------------------
Sun Feb 23 20:34:25 UTC 2014 - andreas.stieger@gmx.de
- Update python-magic to file version 5.17 (bug fix release)
* Count recursion levels through indirect magic
* Prevent infinite recursion on files with indirect offsets of 0
* Add -E flag that makes file print filesystem errors to stderr
and exit.
* mime printing could print results from multiple magic entries
if there were multiple matches.
* in some cases overflow was not detected when computing offsets
in softmagic.
* use strcasestr() to for cdf strings
* reset to the "C" locale while doing regex operations, or case
insensitive comparisons; this is provisional
-------------------------------------------------------------------
Mon Dec 2 11:31:12 UTC 2013 - werner@suse.de
- Make it ready for file 5.16
-------------------------------------------------------------------
Tue Oct 1 10:43:20 UTC 2013 - werner@suse.de
- Make it ready for file 5.15
-------------------------------------------------------------------
Tue Mar 12 10:37:20 UTC 2013 - idonmez@suse.com
- Run pre_checkin.sh
-------------------------------------------------------------------
Tue Mar 27 07:57:55 UTC 2012 - aj@suse.de
- ran pre_checkin.sh
-------------------------------------------------------------------
Sun Sep 18 17:17:12 UTC 2011 - jengelh@medozas.de
- Apply packaging guidelines (remove redundant/obsolete
tags/sections from specfile, etc.)
-------------------------------------------------------------------
Mon Aug 29 11:17:14 UTC 2011 - coolo@novell.com
- ran pre_checkin.sh
-------------------------------------------------------------------
Tue Apr 15 11:58:17 CEST 2008 - werner@suse.de
- Also change version number in python-magic.spec
-------------------------------------------------------------------
Mon Jan 28 18:10:23 CET 2008 - rguenther@suse.de
- Split off from file.

72
python-magic.spec Normal file
View File

@ -0,0 +1,72 @@
#
# spec file for package python-magic
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# PyPI package name is file-magic. Version is taken from setup.py
%define file_magic_version 0.3.0
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global _miscdir %{_datadir}/misc
Name: python-magic
Version: 5.45
Release: 0
Summary: Python module to use libmagic
License: BSD-3-Clause AND BSD-4-Clause
Group: Development/Languages/Python
URL: https://www.darwinsys.com/file/
Source99: file.spec
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: findutils
BuildRequires: libtool
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(zlib)
Requires: libmagic1
Provides: python-file-magic = %{file_magic_version}
%{expand:%(sed -n -e '/^Source0\?:/,/^BuildRoot:/p' <%{_sourcedir}/file.spec)}
%python_subpackages
%description
This package contains the Python binding that require the magic "file"
interface.
%prep
%{expand:%(sed -n -e '/^%%prep/,/^%%build/p' <%{_sourcedir}/file.spec | sed -e '1d' -e '$d')}
ln -sf README.md python/README
pushd python
%python_build
popd
%install
pushd python
%python_install
popd
%check
export LC_ALL=C.UTF-8
pushd python
%python_flavored_alternatives
%pyunittest -v tests
popd
%files %{python_files}
%doc python/README python/example.py
%{python_sitelib}/magic.py*
%pycache_only %{python_sitelib}/__pycache__
%{python_sitelib}/file_magic-*-py%{python_version}.egg-info
%changelog