Update ot file-5.42

OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=245
This commit is contained in:
Dr. Werner Fink 2022-06-13 08:55:08 +00:00 committed by Git OBS Bridge
parent 15ff46f54d
commit ce565f44ae
17 changed files with 103 additions and 832 deletions

View File

@ -1,6 +1,6 @@
--- file-5.39/src/file.c.orig 2020-06-17 16:13:36.625305367 +0200
+++ file-5.39/src/file.c 2020-06-17 16:15:12.429553163 +0200
@@ -251,6 +251,8 @@
@@ -254,6 +254,8 @@
break;
case 'e':
case OPT_EXCLUDE_QUIET:
@ -9,7 +9,7 @@
for (i = 0; i < __arraycount(nv); i++)
if (strcmp(nv[i].name, optarg) == 0)
break;
@@ -263,7 +265,7 @@
@@ -266,7 +268,7 @@
break;
case 'f':
@ -18,7 +18,7 @@
usage();
if (magic == NULL)
if ((magic = load(magicfile, flags)) == NULL)
@@ -273,6 +275,8 @@
@@ -276,6 +278,8 @@
++didsomefiles;
break;
case 'F':
@ -27,7 +27,7 @@
separator = optarg;
break;
case 'i':
@@ -285,6 +289,8 @@
@@ -288,6 +292,8 @@
action = FILE_LIST;
break;
case 'm':

View File

@ -3,13 +3,13 @@
1 file changed, 2 insertions(+)
--- magic/Magdir/images
+++ magic/Magdir/images 2019-05-27 08:52:51.674238380 +0000
@@ -1566,6 +1566,8 @@
+++ magic/Magdir/images 2022-06-13 08:30:37.596139595 +0000
@@ -1951,6 +1951,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 leshort <2
+>4 leshort >0
+>49 byte 0
>62 leshort <2
>>54 leshort 12345 Bio-Rad .PIC Image File
>>>0 leshort >0 %d x
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

View File

@ -4,7 +4,7 @@
--- src/apprentice.c
+++ src/apprentice.c 2021-10-19 08:52:01.991343421 +0000
@@ -2489,7 +2489,7 @@ check_format_type(const char *ptr, int t
@@ -2608,7 +2608,7 @@ check_format_type(const char *ptr, int t
}
} else
h = 0;

View File

@ -4,7 +4,7 @@
--- magic/Magdir/archive
+++ magic/Magdir/archive 2019-02-21 06:49:05.298138025 +0000
@@ -1200,6 +1200,11 @@
@@ -1399,6 +1399,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

View File

@ -1,168 +0,0 @@
---
src/apprentice.c | 71 ++++---------------------------------------------------
src/cdf.c | 53 +++--------------------------------------
2 files changed, 10 insertions(+), 114 deletions(-)
--- src/apprentice.c
+++ src/apprentice.c 2021-10-19 08:56:33.418646912 +0000
@@ -50,7 +50,7 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.
#endif
#include <dirent.h>
#include <limits.h>
-
+#include <byteswap.h>
#define EATAB {while (isascii(CAST(unsigned char, *l)) && \
isspace(CAST(unsigned char, *l))) ++l;}
@@ -124,9 +124,11 @@ private void mlist_free_all(struct magic
private void mlist_free(struct mlist *);
private void byteswap(struct magic *, uint32_t);
private void bs1(struct magic *);
-private uint16_t swap2(uint16_t);
-private uint32_t swap4(uint32_t);
-private uint64_t swap8(uint64_t);
+
+#define swap2(x) bswap_16(x)
+#define swap4(x) bswap_32(x)
+#define swap8(x) bswap_64(x)
+
private char *mkdbname(struct magic_set *, const char *, int);
private struct magic_map *apprentice_buf(struct magic_set *, struct magic *,
size_t);
@@ -3355,67 +3357,6 @@ byteswap(struct magic *magic, uint32_t n
bs1(&magic[i]);
}
-/*
- * swap a short
- */
-private uint16_t
-swap2(uint16_t sv)
-{
- uint16_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
- d[0] = s[1];
- d[1] = s[0];
- return rv;
-}
-
-/*
- * swap an int
- */
-private uint32_t
-swap4(uint32_t sv)
-{
- uint32_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
- d[0] = s[3];
- d[1] = s[2];
- d[2] = s[1];
- d[3] = s[0];
- return rv;
-}
-
-/*
- * swap a quad
- */
-private uint64_t
-swap8(uint64_t sv)
-{
- uint64_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
-#if 0
- d[0] = s[3];
- d[1] = s[2];
- d[2] = s[1];
- d[3] = s[0];
- d[4] = s[7];
- d[5] = s[6];
- d[6] = s[5];
- d[7] = s[4];
-#else
- d[0] = s[7];
- d[1] = s[6];
- d[2] = s[5];
- d[3] = s[4];
- d[4] = s[3];
- d[5] = s[2];
- d[6] = s[1];
- d[7] = s[0];
-#endif
- return rv;
-}
-
protected uintmax_t
file_varint2uintmax_t(const unsigned char *us, int t, size_t *l)
{
--- src/cdf.c
+++ src/cdf.c 2021-10-19 08:53:37.577690786 +0000
@@ -48,6 +48,7 @@ FILE_RCSID("@(#)$File: cdf.c,v 1.120 202
#include <time.h>
#include <ctype.h>
#include <limits.h>
+#include <byteswap.h>
#ifndef EFTYPE
#define EFTYPE EINVAL
@@ -124,55 +125,9 @@ cdf_calloc(const char *file __attribute_
return calloc(n, u);
}
-/*
- * swap a short
- */
-static uint16_t
-_cdf_tole2(uint16_t sv)
-{
- uint16_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
- d[0] = s[1];
- d[1] = s[0];
- return rv;
-}
-
-/*
- * swap an int
- */
-static uint32_t
-_cdf_tole4(uint32_t sv)
-{
- uint32_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
- d[0] = s[3];
- d[1] = s[2];
- d[2] = s[1];
- d[3] = s[0];
- return rv;
-}
-
-/*
- * swap a quad
- */
-static uint64_t
-_cdf_tole8(uint64_t sv)
-{
- uint64_t rv;
- uint8_t *s = RCAST(uint8_t *, RCAST(void *, &sv));
- uint8_t *d = RCAST(uint8_t *, RCAST(void *, &rv));
- d[0] = s[7];
- d[1] = s[6];
- d[2] = s[5];
- d[3] = s[4];
- d[4] = s[3];
- d[5] = s[2];
- d[6] = s[1];
- d[7] = s[0];
- return rv;
-}
+#define _cdf_tole2(x) bswap_16(x)
+#define _cdf_tole4(x) bswap_32(x)
+#define _cdf_tole8(x) bswap_64(x)
/*
* grab a uint32_t from a possibly unaligned address, and return it in

View File

@ -9,9 +9,9 @@ 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(-)
diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
--- a/magic/Magdir/filesystems
@ -58,5 +58,5 @@ diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
+>>0x440 string _BHRfS_M \b, contains
+>>>0x400 use btrfs_super_block
# dvdisaster's .ecc
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
0 string btrfs-stream BTRFS stream file

View File

@ -1,236 +0,0 @@
From 7d438e28c16773e28a3707935c8e5d9927a515a7 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sat, 19 Mar 2022 19:52:09 +0000
Subject: [PATCH] Now that we are cacheing regex's we cannot assume that we
always do regcomp->regexec->regfree, so this causes memory corruption (and
increased memory use with all the locale copies) in xlocale systems. Instead
save and restore locales in regcomp and regexec as needed.
---
src/apprentice.c | 13 +++++++++--
src/file.h | 18 +++++++--------
src/funcs.c | 57 +++++++++++++++++++++++++++++-------------------
src/softmagic.c | 11 +++++-----
4 files changed, 59 insertions(+), 40 deletions(-)
Index: file-5.41/src/apprentice.c
===================================================================
--- file-5.41.orig/src/apprentice.c
+++ file-5.41/src/apprentice.c
@@ -516,6 +516,9 @@ file_ms_free(struct magic_set *ms)
free(ms->o.pbuf);
free(ms->o.buf);
free(ms->c.li);
+#ifdef USE_C_LOCALE
+ freelocale(ms->c_lc_ctype);
+#endif
free(ms);
}
@@ -555,6 +558,10 @@ file_ms_alloc(int flags)
ms->regex_max = FILE_REGEX_MAX;
ms->bytes_max = FILE_BYTES_MAX;
ms->encoding_max = FILE_ENCODING_MAX;
+#ifdef USE_C_LOCALE
+ ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
+ assert(ms->c_lc_ctype != NULL);
+#endif
return ms;
free:
free(ms);
@@ -628,6 +635,7 @@ mlist_free_one(struct mlist *ml)
if (ml->magic_rxcomp[i]) {
file_regfree(ml->magic_rxcomp[i]);
free(ml->magic_rxcomp[i]);
+ ml->magic_rxcomp[i] = NULL;
}
}
free(ml->magic_rxcomp);
@@ -2741,7 +2749,8 @@ getvalue(struct magic_set *ms, struct ma
}
if (m->type == FILE_REGEX) {
file_regex_t rx;
- int rc = file_regcomp(&rx, m->value.s, REG_EXTENDED);
+ int rc = file_regcomp(ms, &rx, m->value.s,
+ REG_EXTENDED);
if (rc) {
if (ms->flags & MAGIC_CHECK)
file_regerror(&rx, rc, ms);
Index: file-5.41/src/file.h
===================================================================
--- file-5.41.orig/src/file.h
+++ file-5.41/src/file.h
@@ -173,13 +173,6 @@
typedef struct {
const char *pat;
-#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE) && defined(HAVE_FREELOCALE)
-#define USE_C_LOCALE
- locale_t old_lc_ctype;
- locale_t c_lc_ctype;
-#else
- char *old_lc_ctype;
-#endif
int rc;
regex_t rx;
} file_regex_t;
@@ -495,6 +488,10 @@ struct magic_set {
#define FILE_NAME_MAX 50
#define FILE_REGEX_MAX 8192
#define FILE_ENCODING_MAX (64 * 1024)
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE) && defined(HAVE_FREELOCALE)
+#define USE_C_LOCALE
+ locale_t c_lc_ctype;
+#endif
};
/* Type for Unicode characters */
@@ -588,9 +585,10 @@ protected int buffer_fill(const struct b
-protected int file_regcomp(file_regex_t *, const char *, int);
-protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
+protected int file_regcomp(struct magic_set *, file_regex_t *, const char *,
int);
+protected int file_regexec(struct magic_set *, file_regex_t *, const char *,
+ size_t, regmatch_t *, int);
protected void file_regfree(file_regex_t *);
protected void file_regerror(file_regex_t *, int, struct magic_set *);
Index: file-5.41/src/funcs.c
===================================================================
--- file-5.41.orig/src/funcs.c
+++ file-5.41/src/funcs.c
@@ -634,13 +634,13 @@ file_replace(struct magic_set *ms, const
file_regex_t rx;
int rc, rv = -1;
- rc = file_regcomp(&rx, pat, REG_EXTENDED);
+ rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
if (rc) {
file_regerror(&rx, rc, ms);
} else {
regmatch_t rm;
int nm = 0;
- while (file_regexec(&rx, ms->o.buf, 1, &rm, 0) == 0) {
+ while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
ms->o.buf[rm.rm_so] = '\0';
if (file_printf(ms, "%s%s", rep,
rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
@@ -655,34 +655,52 @@ out:
}
protected int
-file_regcomp(file_regex_t *rx, const char *pat, int flags)
+file_regcomp(struct magic_set *ms, file_regex_t *rx, const char *pat, int flags)
{
#ifdef USE_C_LOCALE
- rx->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
- assert(rx->c_lc_ctype != NULL);
- rx->old_lc_ctype = uselocale(rx->c_lc_ctype);
- assert(rx->old_lc_ctype != NULL);
+ locale_t old = uselocale(ms->c_lc_ctype);
+ assert(old != NULL);
#else
- rx->old_lc_ctype = setlocale(LC_CTYPE, NULL);
- assert(rx->old_lc_ctype != NULL);
- rx->old_lc_ctype = strdup(rx->old_lc_ctype);
- assert(rx->old_lc_ctype != NULL);
+ char old[1024];
+ strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
(void)setlocale(LC_CTYPE, "C");
#endif
rx->pat = pat;
- return rx->rc = regcomp(&rx->rx, pat, flags);
+ rx->rc = regcomp(&rx->rx, pat, flags);
+
+#ifdef USE_C_LOCALE
+ uselocale(old);
+#else
+ (void)setlocale(LC_CTYPE, old);
+#endif
+ return rx->rc;
}
protected int
-file_regexec(file_regex_t *rx, const char *str, size_t nmatch,
- regmatch_t* pmatch, int eflags)
+file_regexec(struct magic_set *ms, file_regex_t *rx, const char *str,
+ size_t nmatch, regmatch_t* pmatch, int eflags)
{
+#ifdef USE_C_LOCALE
+ locale_t old = uselocale(ms->c_lc_ctype);
+ assert(old != NULL);
+#else
+ char old[1024];
+ strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
+ (void)setlocale(LC_CTYPE, "C");
+#endif
+ int rc;
assert(rx->rc == 0);
/* XXX: force initialization because glibc does not always do this */
if (nmatch != 0)
memset(pmatch, 0, nmatch * sizeof(*pmatch));
- return regexec(&rx->rx, str, nmatch, pmatch, eflags);
+ rc = regexec(&rx->rx, str, nmatch, pmatch, eflags);
+#ifdef USE_C_LOCALE
+ uselocale(old);
+#else
+ (void)setlocale(LC_CTYPE, old);
+#endif
+ return rc;
}
protected void
@@ -690,13 +708,6 @@ file_regfree(file_regex_t *rx)
{
if (rx->rc == 0)
regfree(&rx->rx);
-#ifdef USE_C_LOCALE
- (void)uselocale(rx->old_lc_ctype);
- freelocale(rx->c_lc_ctype);
-#else
- (void)setlocale(LC_CTYPE, rx->old_lc_ctype);
- free(rx->old_lc_ctype);
-#endif
}
protected void
Index: file-5.41/src/softmagic.c
===================================================================
--- file-5.41.orig/src/softmagic.c
+++ file-5.41/src/softmagic.c
@@ -479,11 +479,11 @@ check_fmt(struct magic_set *ms, const ch
if (strchr(fmt, '%') == NULL)
return 0;
- rc = file_regcomp(&rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
+ rc = file_regcomp(ms, &rx, "%[-0-9\\.]*s", REG_EXTENDED|REG_NOSUB);
if (rc) {
file_regerror(&rx, rc, ms);
} else {
- rc = file_regexec(&rx, fmt, 0, 0, 0);
+ rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
rv = !rc;
}
file_regfree(&rx);
@@ -2192,7 +2192,7 @@ magiccheck(struct magic_set *ms, struct
if (rx == NULL) {
rx = *m_cache = CAST(file_regex_t*, malloc(sizeof(file_regex_t)));
- rc = file_regcomp(rx, m->value.s,
+ rc = file_regcomp(ms, rx, m->value.s,
REG_EXTENDED|REG_NEWLINE|
((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
if (rc) {
@@ -2222,7 +2222,7 @@ magiccheck(struct magic_set *ms, struct
search = CCAST(char *, "");
copy = NULL;
}
- rc = file_regexec(rx, RCAST(const char *, search),
+ rc = file_regexec(ms, rx, RCAST(const char *, search),
1, &pmatch, 0);
free(copy);
switch (rc) {

View File

@ -1,346 +0,0 @@
From 1957db8212e9c74e5d626de3023e49d0bb502052 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
Date: Fri, 11 Mar 2022 23:51:55 +0100
Subject: [PATCH] Cache compiled regexps between magic matches
regcomp() is relatively expensive compared to regexec() for matching,
so it helps to only compile once and then reuse the compiled version
for future matches of the same magic.
when doing equivalent of `find | xargs file` this provides a massive
speedup, between factor 2 and 4 depending on how heavy the magic
is on regexp usage.
The memory overhead is mediocre (~ 200kb ) and it compiles regexps
lazy, so it doesn't add significant overhead to single match usecases.
---
src/apprentice.c | 26 +++++++++++++++++++----
src/file.h | 40 ++++++++++++++++++-----------------
src/softmagic.c | 54 +++++++++++++++++++++++++++---------------------
3 files changed, 73 insertions(+), 47 deletions(-)
Index: file-5.41/src/apprentice.c
===================================================================
--- file-5.41.orig/src/apprentice.c
+++ file-5.41/src/apprentice.c
@@ -427,7 +427,14 @@ add_mlist(struct mlist *mlp, struct magi
ml->map = idx == 0 ? map : NULL;
ml->magic = map->magic[idx];
ml->nmagic = map->nmagic[idx];
-
+ ml->magic_rxcomp = NULL;
+ if (ml->nmagic) {
+ ml->magic_rxcomp = CAST(file_regex_t**, calloc(ml->nmagic, sizeof(file_regex_t*)));
+ if (ml->magic_rxcomp == NULL) {
+ free(ml);
+ return -1;
+ }
+ }
mlp->prev->next = ml;
ml->prev = mlp->prev;
ml->next = mlp;
@@ -612,8 +619,19 @@ mlist_free_all(struct magic_set *ms)
private void
mlist_free_one(struct mlist *ml)
{
+ size_t i;
+
if (ml->map)
apprentice_unmap(CAST(struct magic_map *, ml->map));
+
+ for (i = 0; i < ml->nmagic; ++i) {
+ if (ml->magic_rxcomp[i]) {
+ file_regfree(ml->magic_rxcomp[i]);
+ free(ml->magic_rxcomp[i]);
+ }
+ }
+ free(ml->magic_rxcomp);
+ ml->magic_rxcomp = NULL;
free(ml);
}
@@ -3489,16 +3507,16 @@ file_magicfind(struct magic_set *ms, con
for (ml = mlist->next; ml != mlist; ml = ml->next) {
struct magic *ma = ml->magic;
- uint32_t nma = ml->nmagic;
- for (i = 0; i < nma; i++) {
+ for (i = 0; i < ml->nmagic; i++) {
if (ma[i].type != FILE_NAME)
continue;
if (strcmp(ma[i].value.s, name) == 0) {
v->magic = &ma[i];
- for (j = i + 1; j < nma; j++)
+ for (j = i + 1; j < ml->nmagic; j++)
if (ma[j].cont_level == 0)
break;
v->nmagic = j - i;
+ v->magic_rxcomp = &(ml->magic_rxcomp[i]);
return 0;
}
}
Index: file-5.41/src/file.h
===================================================================
--- file-5.41.orig/src/file.h
+++ file-5.41/src/file.h
@@ -88,6 +88,10 @@
/* Do this here and now, because struct stat gets re-defined on solaris */
#include <sys/stat.h>
#include <stdarg.h>
+#include <locale.h>
+#if defined(HAVE_XLOCALE_H)
+#include <xlocale.h>
+#endif
#define ENABLE_CONDITIONALS
@@ -167,6 +171,19 @@
#define FILE_COMPILE 2
#define FILE_LIST 3
+typedef struct {
+ const char *pat;
+#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE) && defined(HAVE_FREELOCALE)
+#define USE_C_LOCALE
+ locale_t old_lc_ctype;
+ locale_t c_lc_ctype;
+#else
+ char *old_lc_ctype;
+#endif
+ int rc;
+ regex_t rx;
+} file_regex_t;
+
struct buffer {
int fd;
struct stat st;
@@ -397,9 +414,10 @@ struct magic {
/* list of magic entries */
struct mlist {
- struct magic *magic; /* array of magic entries */
- uint32_t nmagic; /* number of entries in array */
- void *map; /* internal resources used by entry */
+ struct magic *magic; /* array of magic entries */
+ file_regex_t **magic_rxcomp; /* array of compiled regexps */
+ size_t nmagic; /* number of entries in array */
+ void *map; /* internal resources used by entry */
struct mlist *next, *prev;
};
@@ -568,23 +586,7 @@ protected void buffer_init(struct buffer
protected void buffer_fini(struct buffer *);
protected int buffer_fill(const struct buffer *);
-#include <locale.h>
-#if defined(HAVE_XLOCALE_H)
-#include <xlocale.h>
-#endif
-typedef struct {
- const char *pat;
-#if defined(HAVE_NEWLOCALE) && defined(HAVE_USELOCALE) && defined(HAVE_FREELOCALE)
-#define USE_C_LOCALE
- locale_t old_lc_ctype;
- locale_t c_lc_ctype;
-#else
- char *old_lc_ctype;
-#endif
- int rc;
- regex_t rx;
-} file_regex_t;
protected int file_regcomp(file_regex_t *, const char *, int);
protected int file_regexec(file_regex_t *, const char *, size_t, regmatch_t *,
Index: file-5.41/src/softmagic.c
===================================================================
--- file-5.41.orig/src/softmagic.c
+++ file-5.41/src/softmagic.c
@@ -43,7 +43,7 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.3
#include <time.h>
#include "der.h"
-private int match(struct magic_set *, struct magic *, uint32_t,
+private int match(struct magic_set *, struct magic *, file_regex_t **, uint32_t,
const struct buffer *, size_t, int, int, int, uint16_t *,
uint16_t *, int *, int *, int *, int *);
private int mget(struct magic_set *, struct magic *, const struct buffer *,
@@ -52,7 +52,7 @@ private int mget(struct magic_set *, str
uint16_t *, int *, int *, int *, int *);
private int msetoffset(struct magic_set *, struct magic *, struct buffer *,
const struct buffer *, size_t, unsigned int);
-private int magiccheck(struct magic_set *, struct magic *);
+private int magiccheck(struct magic_set *, struct magic *, file_regex_t **);
private int32_t mprint(struct magic_set *, struct magic *);
private int moffset(struct magic_set *, struct magic *, const struct buffer *,
int32_t *);
@@ -131,7 +131,7 @@ file_softmagic(struct magic_set *ms, con
}
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
- if ((rv = match(ms, ml->magic, ml->nmagic, b, 0, mode,
+ if ((rv = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b, 0, mode,
text, 0, indir_count, name_count,
&printed_something, &need_separator, NULL, NULL)) != 0)
return rv;
@@ -191,7 +191,7 @@ file_fmtcheck(struct magic_set *ms, cons
* so that higher-level continuations are processed.
*/
private int
-match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
+match(struct magic_set *ms, struct magic *magic, file_regex_t **magic_rxcomp, uint32_t nmagic,
const struct buffer *b, size_t offset, int mode, int text,
int flip, uint16_t *indir_count, uint16_t *name_count,
int *printed_something, int *need_separator, int *returnval,
@@ -220,6 +220,7 @@ match(struct magic_set *ms, struct magic
for (magindex = 0; magindex < nmagic; magindex++) {
int flush = 0;
struct magic *m = &magic[magindex];
+ file_regex_t** m_rxcomp = &magic_rxcomp[magindex];
if (m->type != FILE_NAME)
if ((IS_STRING(m->type) &&
@@ -257,7 +258,7 @@ flush:
*returnval = 1;
}
- switch (magiccheck(ms, m)) {
+ switch (magiccheck(ms, m, m_rxcomp)) {
case -1:
return -1;
case 0:
@@ -318,6 +319,7 @@ flush:
while (magindex + 1 < nmagic &&
magic[magindex + 1].cont_level != 0) {
m = &magic[++magindex];
+ m_rxcomp = &magic_rxcomp[magindex];
ms->line = m->lineno; /* for messages */
if (cont_level < m->cont_level)
@@ -371,7 +373,7 @@ flush:
break;
}
- switch (flush ? 1 : magiccheck(ms, m)) {
+ switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
case -1:
return -1;
case 0:
@@ -655,7 +657,7 @@ mprint(struct magic_set *ms, struct magi
if (m->str_flags & STRING_TRIM)
str = file_strtrim(str);
-
+
if (file_printf(ms, F(ms, desc, "%s"),
file_printable(ms, sbuf, sizeof(sbuf), str,
sizeof(p->s) - (str - p->s))) == -1)
@@ -770,7 +772,7 @@ mprint(struct magic_set *ms, struct magi
return -1;
}
scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
-
+
rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
sbuf, sizeof(sbuf), scp, ms->search.rm_len));
free(cp);
@@ -1822,7 +1824,7 @@ mget(struct magic_set *ms, struct magic
for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
mlp = mlp->next)
{
- if ((rv = match(ms, mlp->magic, mlp->nmagic, &bb, 0,
+ if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp, mlp->nmagic, &bb, 0,
BINTEST, text, 0, indir_count, name_count,
printed_something, need_separator, NULL,
NULL)) != 0)
@@ -1875,7 +1877,7 @@ mget(struct magic_set *ms, struct magic
nfound_match = 0;
(*name_count)++;
eoffset = ms->eoffset;
- rv = match(ms, ml.magic, ml.nmagic, b, offset + o,
+ rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b, offset + o,
mode, text, flip, indir_count, name_count,
printed_something, need_separator, returnval,
&nfound_match);
@@ -1999,7 +2001,7 @@ file_strncmp16(const char *a, const char
}
private int
-magiccheck(struct magic_set *ms, struct magic *m)
+magiccheck(struct magic_set *ms, struct magic *m, file_regex_t** m_cache)
{
uint64_t l = m->value.q;
uint64_t v;
@@ -2182,27 +2184,32 @@ magiccheck(struct magic_set *ms, struct
}
case FILE_REGEX: {
int rc;
- file_regex_t rx;
+ file_regex_t *rx = *m_cache;
const char *search;
if (ms->search.s == NULL)
return 0;
+ if (rx == NULL) {
+ rx = *m_cache = CAST(file_regex_t*, malloc(sizeof(file_regex_t)));
+ rc = file_regcomp(rx, m->value.s,
+ REG_EXTENDED|REG_NEWLINE|
+ ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
+ if (rc) {
+ file_regerror(rx, rc, ms);
+ file_regfree(rx);
+ v = CAST(uint64_t, -1);
+ break;
+ }
+ }
l = 0;
- rc = file_regcomp(&rx, m->value.s,
- REG_EXTENDED|REG_NEWLINE|
- ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
- if (rc) {
- file_regerror(&rx, rc, ms);
- v = CAST(uint64_t, -1);
- } else {
+ {
regmatch_t pmatch;
size_t slen = ms->search.s_len;
char *copy;
if (slen != 0) {
copy = CAST(char *, malloc(slen));
if (copy == NULL) {
- file_regfree(&rx);
file_error(ms, errno,
"can't allocate %" SIZE_T_FORMAT "u bytes",
slen);
@@ -2215,14 +2222,14 @@ magiccheck(struct magic_set *ms, struct
search = CCAST(char *, "");
copy = NULL;
}
- rc = file_regexec(&rx, RCAST(const char *, search),
+ rc = file_regexec(rx, RCAST(const char *, search),
1, &pmatch, 0);
free(copy);
switch (rc) {
case 0:
ms->search.s += CAST(int, pmatch.rm_so);
ms->search.offset += CAST(size_t, pmatch.rm_so);
- ms->search.rm_len = CAST(size_t,
+ ms->search.rm_len = CAST(size_t,
pmatch.rm_eo - pmatch.rm_so);
v = 0;
break;
@@ -2232,12 +2239,11 @@ magiccheck(struct magic_set *ms, struct
break;
default:
- file_regerror(&rx, rc, ms);
+ file_regerror(rx, rc, ms);
v = CAST(uint64_t, -1);
break;
}
}
- file_regfree(&rx);
if (v == CAST(uint64_t, -1))
return -1;
break;

View File

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

View File

@ -1,6 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iEYEABECAAYFAmFtpa0ACgkQcREqsWyzOzowtQCglMaWOWrYrD5d3V/GK7gmlEQ0
7CMAoO0c9XQwyuR0XbNIQc/+Mz7jwmdC
=Th7A
-----END PGP SIGNATURE-----

View File

@ -10,7 +10,7 @@
8 files changed, 313 insertions(+), 68 deletions(-)
--- magic/Magdir/elf
+++ magic/Magdir/elf 2021-10-19 09:27:23.638685060 +0000
+++ magic/Magdir/elf 2022-06-13 08:44:29.248838085 +0000
@@ -152,7 +152,7 @@
>18 leshort 47 Renesas H8/300H,
>18 leshort 48 Renesas H8S,
@ -21,7 +21,7 @@
>18 leshort 52 Motorola Coldfire,
>18 leshort 53 Motorola M68HC12,
--- magic/Magdir/linux
+++ magic/Magdir/linux 2021-10-19 09:27:23.638685060 +0000
+++ magic/Magdir/linux 2022-06-13 08:44:29.248838085 +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)
@ -71,7 +71,7 @@
0 belong 0xb8c0078e Linux kernel
>0x1e3 string Loading version 1.3.79 or older
--- magic/Magdir/msad
+++ magic/Magdir/msad 2021-10-19 09:27:23.638685060 +0000
+++ magic/Magdir/msad 2022-06-13 08:44:29.248838085 +0000
@@ -0,0 +1,5 @@
+#------------------------------------------------------------------------------
+# msad: file(1) magic for msad
@ -79,7 +79,7 @@
+# This must precede the heuristic for raw G3 data
+4 string Standard\ Jet\ DB Microsoft Access Database
--- magic/Magdir/msdos
+++ magic/Magdir/msdos 2021-10-19 09:27:23.638685060 +0000
+++ magic/Magdir/msdos 2022-06-13 08:44:29.248838085 +0000
@@ -145,9 +145,9 @@
>>(0x3c.l+22) leshort&0x0200 >0 (stripped to external PDB)
>>(0x3c.l+22) leshort&0x1000 >0 system file
@ -102,7 +102,7 @@
# updated by Joerg Jenderek at Oct 2008,2015
--- magic/Makefile.am
+++ magic/Makefile.am 2021-10-19 09:31:45.610115482 +0000
+++ magic/Makefile.am 2022-06-13 08:44:29.248838085 +0000
@@ -5,7 +5,7 @@ MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
@ -120,7 +120,7 @@
$(MAGIC_FRAGMENT_DIR)/application \
$(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/apt \
@@ -102,7 +101,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
@@ -105,7 +104,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/espressif \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
@ -128,7 +128,7 @@
$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/flash \
$(MAGIC_FRAGMENT_DIR)/flif \
@@ -147,6 +145,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
@@ -150,6 +148,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
$(MAGIC_FRAGMENT_DIR)/java \
$(MAGIC_FRAGMENT_DIR)/javascript \
$(MAGIC_FRAGMENT_DIR)/jpeg \
@ -137,7 +137,7 @@
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -157,7 +157,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
@@ -160,7 +160,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
@ -145,7 +145,7 @@
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -165,7 +164,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
@@ -168,7 +167,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
@ -153,7 +153,7 @@
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -189,11 +187,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
@@ -192,11 +190,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
@ -166,7 +166,7 @@
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -252,6 +250,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
@@ -258,6 +256,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
$(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/riff \
@ -175,7 +175,7 @@
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -341,9 +341,21 @@ EXTRA_DIST = \
@@ -347,9 +347,21 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
@ -199,7 +199,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
@@ -355,19 +367,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
@@ -361,19 +373,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
FILE_COMPILE_DEP = $(FILE_COMPILE)
endif
@ -239,7 +239,7 @@
+# $(FILE_COMPILE) -C -m magic
+# @rm -fr magic
--- magic/Makefile.in
+++ magic/Makefile.in 2021-10-19 09:34:04.535688599 +0000
+++ magic/Makefile.in 2022-06-13 08:44:29.248838085 +0000
@@ -280,7 +280,7 @@ top_srcdir = @top_srcdir@
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@ -257,7 +257,7 @@
$(MAGIC_FRAGMENT_DIR)/application \
$(MAGIC_FRAGMENT_DIR)/applix \
$(MAGIC_FRAGMENT_DIR)/apt \
@@ -376,7 +375,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
@@ -379,7 +378,6 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/espressif \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
@ -265,7 +265,7 @@
$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/flash \
$(MAGIC_FRAGMENT_DIR)/flif \
@@ -421,6 +419,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
@@ -424,6 +422,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
$(MAGIC_FRAGMENT_DIR)/java \
$(MAGIC_FRAGMENT_DIR)/javascript \
$(MAGIC_FRAGMENT_DIR)/jpeg \
@ -274,7 +274,7 @@
$(MAGIC_FRAGMENT_DIR)/karma \
$(MAGIC_FRAGMENT_DIR)/kde \
$(MAGIC_FRAGMENT_DIR)/keepass \
@@ -431,7 +431,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
@@ -434,7 +434,6 @@ $(MAGIC_FRAGMENT_DIR)/lammps \
$(MAGIC_FRAGMENT_DIR)/lecter \
$(MAGIC_FRAGMENT_DIR)/lex \
$(MAGIC_FRAGMENT_DIR)/lif \
@ -282,7 +282,7 @@
$(MAGIC_FRAGMENT_DIR)/lisp \
$(MAGIC_FRAGMENT_DIR)/llvm \
$(MAGIC_FRAGMENT_DIR)/locoscript \
@@ -439,7 +438,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
@@ -442,7 +441,6 @@ $(MAGIC_FRAGMENT_DIR)/lua \
$(MAGIC_FRAGMENT_DIR)/luks \
$(MAGIC_FRAGMENT_DIR)/m4 \
$(MAGIC_FRAGMENT_DIR)/mach \
@ -290,7 +290,7 @@
$(MAGIC_FRAGMENT_DIR)/macos \
$(MAGIC_FRAGMENT_DIR)/magic \
$(MAGIC_FRAGMENT_DIR)/mail.news \
@@ -463,11 +461,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
@@ -466,11 +464,11 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
$(MAGIC_FRAGMENT_DIR)/mkid \
$(MAGIC_FRAGMENT_DIR)/mlssa \
$(MAGIC_FRAGMENT_DIR)/mmdf \
@ -303,7 +303,7 @@
$(MAGIC_FRAGMENT_DIR)/msooxml \
$(MAGIC_FRAGMENT_DIR)/msvc \
$(MAGIC_FRAGMENT_DIR)/msx \
@@ -526,6 +524,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
@@ -532,6 +530,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
$(MAGIC_FRAGMENT_DIR)/qt \
$(MAGIC_FRAGMENT_DIR)/revision \
$(MAGIC_FRAGMENT_DIR)/riff \
@ -312,7 +312,7 @@
$(MAGIC_FRAGMENT_DIR)/rpi \
$(MAGIC_FRAGMENT_DIR)/rpm \
$(MAGIC_FRAGMENT_DIR)/rpmsg \
@@ -615,10 +615,22 @@ EXTRA_DIST = \
@@ -621,10 +621,22 @@ EXTRA_DIST = \
$(MAGIC_DIR)/scripts/create_filemagic_flac \
$(MAGIC_FRAGMENTS)
@ -336,7 +336,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}
@@ -843,23 +855,25 @@ uninstall-am: uninstall-pkgdataDATA
@@ -849,23 +861,25 @@ uninstall-am: uninstall-pkgdataDATA
.PRECIOUS: Makefile
@ -379,7 +379,7 @@
# 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 2021-10-19 09:27:23.654684781 +0000
+++ src/Makefile.am 2022-06-13 08:44:29.248838085 +0000
@@ -1,4 +1,4 @@
-MAGIC = $(pkgdatadir)/magic
+MAGIC = $(sysconfdir)/magic:$(pkgdatadir)/magic
@ -387,7 +387,7 @@
nodist_include_HEADERS = magic.h
--- src/dcore.c
+++ src/dcore.c 2021-10-19 09:27:23.654684781 +0000
+++ src/dcore.c 2022-06-13 08:44:29.248838085 +0000
@@ -0,0 +1,207 @@
+/*
+ * Show goo about ELF core files

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

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

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

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCYqNK1QAKCRBxESqxbLM7
Or2rAKDIx6yR4k5adLOh6+dwe3gHGeq7SwCffNuFkJgje9xr31P0KaZEPBdd91Q=
=cCEN
-----END PGP SIGNATURE-----

View File

@ -1,14 +1,11 @@
---
file-5.38/configure.ac | 2 ++
file-5.38/src/file.c | 2 +-
file-5.38/src/file.h | 8 ++++++++
file-5.38/src/magic.c | 10 +++++-----
4 files changed, 16 insertions(+), 6 deletions(-)
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(-)
Index: file-5.38/configure.ac
===================================================================
--- file-5.38.orig/configure.ac
+++ file-5.38/configure.ac
--- file-5.42/configure.ac
+++ file-5.42/configure.ac 2022-06-13 08:34:50.347521415 +0000
@@ -114,6 +114,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>])
@ -18,11 +15,9 @@ Index: file-5.38/configure.ac
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
Index: file-5.38/src/file.h
===================================================================
--- file-5.38.orig/src/file.h
+++ file-5.38/src/file.h
@@ -700,4 +700,12 @@ static const char *rcsid(const char *p)
--- file-5.42/src/file.h
+++ file-5.42/src/file.h 2022-06-13 08:34:50.347521415 +0000
@@ -706,4 +706,12 @@ static const char *rcsid(const char *p)
#define __RCSID(a)
#endif
@ -35,10 +30,8 @@ Index: file-5.38/src/file.h
+#endif
+
#endif /* __file_h__ */
Index: file-5.38/src/magic.c
===================================================================
--- file-5.38.orig/src/magic.c
+++ file-5.38/src/magic.c
--- 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;
@ -48,9 +41,14 @@ Index: file-5.38/src/magic.c
return MAGIC;
if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0)
@@ -222,16 +222,16 @@ out:
@@ -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)
@ -58,7 +56,7 @@ Index: file-5.38/src/magic.c
/* Second, try to get a magic file from the user profile data */
- if ((home = getenv("USERPROFILE")) != NULL)
+ if ((home = secure_getenv("USERPROFILE")) != NULL)
+ if ((home = secure_getenv("USERPROFILE")) != NULL)
_w32_append_path(&hmagicpath,
"%s/Local Settings/Application Data%s", home, hmagic);
@ -68,7 +66,7 @@ Index: file-5.38/src/magic.c
_w32_append_path(&hmagicpath, "%s%s", home, hmagic);
/* Fourth, try to get magic file relative to exe location */
@@ -252,7 +252,7 @@ magic_getpath(const char *magicfile, int
@@ -256,7 +256,7 @@ magic_getpath(const char *magicfile, int
if (magicfile != NULL)
return magicfile;

View File

@ -1,3 +1,32 @@
-------------------------------------------------------------------
Mon Jun 13 08:45:48 UTC 2022 - Dr. Werner Fink <werner@suse.de>
- Update to 5.42:
* PR/348: add missing cases to prevent file from aborting on
random magic files.
* PR/351: octalify filenames when not raw before printing.
* fix regex cacheing bug (Dirk Mueller)
* merge file_regcomp and file_regerror() to simplify the code
and reduce memory requirements for storing regexes (Dirk Mueller)
* cache regex (Dirk Mueller)
* detect filesystem full by flushing output (Dirk Mueller)
* implement running decompressor programs using
posix_spawnp(2) instead of vfork(2)
* Add support for msdos dates and times
* use the system byte swapping functions if available (Werner Fink)
- Port patches
* file-5.17-option.dif
* file-5.19-biorad.dif
* file-5.19-printf.dif
* file-5.19-zip2.0.dif
* file-5.28-btrfs-image.dif
* file-secure_getenv.patch
- Remove patches now upstream
* file-5.23-endian.patch
* file-5.41-cache-regexps-locale-restore.patch
* file-5.41-cache-regexps.patch
- Port and rename patch file-5.41.dif which is now file-5.42.dif
-------------------------------------------------------------------
Tue Apr 26 09:03:32 UTC 2022 - Dr. Werner Fink <werner@suse.de>

View File

@ -33,7 +33,7 @@ Obsoletes: file-64bit
%endif
#
# Set Version also in python-magic.spec
Version: 5.41
Version: 5.42
Release: 0
Summary: A Tool to Determine File Types
License: BSD-2-Clause
@ -43,7 +43,7 @@ Source2: baselibs.conf
Source3: file-rpmlintrc
Source4: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz.asc
Source5: file.keyring
Patch: file-5.41.dif
Patch: file-5.42.dif
Patch1: file-5.19-misc.dif
Patch4: file-4.24-autoconf.dif
Patch5: file-5.14-tex.dif
@ -60,11 +60,8 @@ 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
Patch34: file-5.23-endian.patch
Patch37: file-secure_getenv.patch
Patch38: file-5.41-cache-regexps.patch
Patch39: file-5.28-btrfs-image.dif
Patch40: file-5.41-cache-regexps-locale-restore.patch
# Upstream commits as patches
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir /etc
@ -125,11 +122,8 @@ to develop applications that require the magic "file" interface.
%patch27 -p0 -b .zip2.0
%patch31 -p0 -b .biorad
%patch32 -p0 -b .clicfs
%patch34 -p0 -b .endian
%patch37 -p1 -b .getenv
%patch38 -p1 -b .regexp
%patch39 -p1 -b .btrfs
%patch40 -p1 -b .locale
%patch -b .0
test -s src/magic.h.in || cp -p src/magic.h src/magic.h.in
rm -fv src/magic.h

View File

@ -21,7 +21,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global _miscdir %{_datadir}/misc
Name: python-magic
Version: 5.41
Version: 5.42
Release: 0
Summary: Python module to use libmagic
License: BSD-3-Clause AND BSD-4-Clause