core/file to 5.41-1

This commit is contained in:
Kevin Mihelich 2021-10-20 12:48:38 +00:00
parent ce115e9896
commit 4dc98cfbc3
4 changed files with 6 additions and 139 deletions

View File

@ -7,8 +7,8 @@
# - configure with --disable-libseccomp
pkgname=file
pkgver=5.40
pkgrel=6
pkgver=5.41
pkgrel=1
pkgdesc='File type identification utility'
arch=('x86_64')
license=('custom')
@ -16,18 +16,11 @@ groups=('base-devel')
url='https://www.darwinsys.com/file/'
depends=('glibc' 'zlib' 'xz' 'bzip2')
provides=('libmagic.so')
source=("https://astron.com/pub/$pkgname/$pkgname-$pkgver.tar.gz"{,.asc}
"pr256.patch" # fix binary detection that breaks subversion tests
"pr259.patch" # mime printing through indirect magic is not taken into account, use match directly so that it does
"pr261.patch" # follow-up patch which restores file 5.39 behavior
"https://github.com/file/file/commit/9b0459afab309a82aa4e46f73a4e50dd641f3d39.patch")
options=('!emptydirs')
source=("https://astron.com/pub/$pkgname/$pkgname-$pkgver.tar.gz"{,.asc})
validpgpkeys=('BE04995BA8F90ED0C0C176C471112AB16CB33B3A') # Christos Zoulas
sha256sums=('167321f43c148a553f68a0ea7f579821ef3b11c27b8cbe158e4df897e4a5dd57'
'SKIP'
'5fd8dc41a10ee8097ddbffad37e07ea417b6ea5ff9d416d4aadfe15bc33a46df'
'e811744d8e02883e7ddea67497a113db6a9a176dd6c3696d43498ad15440aa6c'
'c149311a54ee2539344d6ace2cb733e45bc1c134cd91d50d462dd9edbff916f5'
'f5d9c964233b75d6b5ac1b95fe4cc23143fbc6070d3b136e91b542021959e7dd')
sha256sums=('13e532c7b364f7d57e23dfeea3147103150cb90593a57af86c10e4f6e411603f'
'SKIP')
prepare() {
cd $pkgname-$pkgver

View File

@ -1,23 +0,0 @@
From 749e1ecfc3d333e5ec8b1a2e639da7ccb2498c34 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 19 Apr 2021 18:38:04 +0000
Subject: [PATCH] PR/256: mutableVoid: If the file is less than 3 bytes, use
the file length to determine type
---
src/encoding.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/encoding.c b/src/encoding.c
index 0fb1f47b..31d4d125 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -285,7 +285,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
if (dist[i]) \
u++; \
} \
- if (u < 3) \
+ if (u < MIN(nbytes, 3)) \
return 0; \
\
return 1; \

View File

@ -1,59 +0,0 @@
From 07595622bd09e5b09720ccd717d2d862703a95fe Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 19 Apr 2021 16:47:13 +0000
Subject: PR/259: aleksandr.v.novichkov: mime printing through indirect magic
is not taken into account, use match directly so that it does.
---
src/softmagic.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/softmagic.c b/src/softmagic.c
index 1ec3e604..2eb5b630 100644
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -1559,7 +1559,7 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
int rv, oneed_separator, in_type, nfound_match;
char *rbuf;
union VALUETYPE *p = &ms->ms_value;
- struct mlist ml;
+ struct mlist ml, *mlp;
struct cont c;
if (*indir_count >= ms->indir_max) {
@@ -1829,8 +1829,15 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
bb = *b;
bb.fbuf = s + offset;
bb.flen = nbytes - offset;
- rv = file_softmagic(ms, &bb,
- indir_count, name_count, BINTEST, text);
+ for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
+ mlp = mlp->next)
+ {
+ if ((rv = match(ms, mlp->magic, mlp->nmagic, &bb, 0,
+ BINTEST, text, 0, indir_count, name_count,
+ printed_something, need_separator, NULL,
+ NULL)) != 0)
+ break;
+ }
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
From aba3766ef6fddc67e12514293be3f1f4180ee5ab Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 19 Apr 2021 20:35:30 +0000
Subject: fix tests
---
tests/JW07022A.mp3.result | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/JW07022A.mp3.result b/tests/JW07022A.mp3.result
index 8a3e1195..f5911910 100644
--- a/tests/JW07022A.mp3.result
+++ b/tests/JW07022A.mp3.result
@@ -1 +1 @@
-Audio file with ID3 version 2.2.0, contains:MPEG ADTS, layer III, v1, 96 kbps, 44.1 kHz, Monaural
\ No newline at end of file
+Audio file with ID3 version 2.2.0, contains: MPEG ADTS, layer III, v1, 96 kbps, 44.1 kHz, Monaural
\ No newline at end of file

View File

@ -1,44 +0,0 @@
From c07e242e766242a44ff720c149b1bdd4924ec247 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 27 Apr 2021 19:37:14 +0000
Subject: [PATCH] Revert the fix for PR/180. It lead to PR/261. Using character
count heuristics ends up with confusing behavior, the following should not be
producing different results: echo -n xx | ./file - echo -n xy |
./file -
---
src/encoding.c | 13 +-------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/src/encoding.c b/src/encoding.c
index 31d4d1251..3647a481d 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -265,9 +265,7 @@ private int \
looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
size_t *ulen) \
{ \
- size_t i, u; \
- unsigned char dist[256]; \
- memset(dist, 0, sizeof(dist)); \
+ size_t i; \
\
*ulen = 0; \
\
@@ -278,16 +276,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
return 0; \
\
ubuf[(*ulen)++] = buf[i]; \
- dist[buf[i]]++; \
} \
- u = 0; \
- for (i = 0; i < __arraycount(dist); i++) { \
- if (dist[i]) \
- u++; \
- } \
- if (u < MIN(nbytes, 3)) \
- return 0; \
-\
return 1; \
}