Fix several regressions of 5.40 with upstream commits and an own patch
OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=224
This commit is contained in:
parent
fa806214b7
commit
4b0a77ed1a
@ -20,43 +20,43 @@ diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
|
||||
>>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 belong x UUID=%08x-
|
||||
->0x10024 beshort x \b%04x-
|
||||
->0x10026 beshort x \b%04x-
|
||||
->0x10028 beshort x \b%04x-
|
||||
->0x1002a beshort x \b%04x
|
||||
->0x1002c belong 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 belong x UUID=%08x-
|
||||
+>0x24 beshort x \b%04x-
|
||||
+>0x26 beshort x \b%04x-
|
||||
+>0x28 beshort x \b%04x-
|
||||
+>0x2a beshort x \b%04x
|
||||
+>0x2c belong x \b%08x,
|
||||
+>0x78 lequad x %lld/
|
||||
+>0x70 lequad x \b%lld bytes used,
|
||||
+>0x88 lequad x %lld devices
|
||||
-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 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
|
||||
|
||||
# dvdisaster's .ecc
|
||||
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
|
||||
|
105
file-5.40-3096f87f.patch
Normal file
105
file-5.40-3096f87f.patch
Normal file
@ -0,0 +1,105 @@
|
||||
From 3096f87f823e1e936139e48d6a3bae9a95557861 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Fri, 9 Apr 2021 19:16:19 +0000
|
||||
Subject: [PATCH] No point returning 0 twice, also don't return -1 as an error
|
||||
where 0 is expected.
|
||||
|
||||
---
|
||||
src/encoding.c | 14 +++++++++++---
|
||||
src/readelf.c | 19 ++++++++-----------
|
||||
2 files changed, 19 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git src/encoding.c src/encoding.c
|
||||
index c66703bb..691e3e16 100644
|
||||
--- src/encoding.c
|
||||
+++ src/encoding.c
|
||||
@@ -1,3 +1,5 @@
|
||||
+/* $NetBSD: encoding.c,v 1.1.1.13 2021/04/09 18:58:01 christos Exp $ */
|
||||
+
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
* Software written by Ian F. Darwin and others;
|
||||
@@ -35,7 +37,11 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
-FILE_RCSID("@(#)$File: encoding.c,v 1.28 2021/04/04 21:02:19 christos Exp $")
|
||||
+#if 0
|
||||
+FILE_RCSID("@(#)$File: encoding.c,v 1.29 2021/04/09 19:16:19 christos Exp $")
|
||||
+#else
|
||||
+__RCSID("$NetBSD: encoding.c,v 1.1.1.13 2021/04/09 18:58:01 christos Exp $");
|
||||
+#endif
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -282,7 +288,8 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
|
||||
} \
|
||||
u = 0; \
|
||||
for (i = 0; i < __arraycount(dist); i++) { \
|
||||
- u+= dist[i]; \
|
||||
+ if (dist[i]) \
|
||||
+ u++; \
|
||||
} \
|
||||
if (u < 3) \
|
||||
return 0; \
|
||||
@@ -386,7 +393,8 @@ file_looks_utf8(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf,
|
||||
} else { /* 11xxxxxx begins UTF-8 */
|
||||
int following;
|
||||
uint8_t x = first[buf[i]];
|
||||
- const struct accept_range *ar = &accept_ranges[x >> 4];
|
||||
+ const struct accept_range *ar =
|
||||
+ &accept_ranges[(unsigned int)x >> 4];
|
||||
if (x == XX)
|
||||
return -1;
|
||||
|
||||
diff --git src/readelf.c src/readelf.c
|
||||
index 0cd119a6..633fd2e8 100644
|
||||
--- src/readelf.c
|
||||
+++ src/readelf.c
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
-FILE_RCSID("@(#)$File: readelf.c,v 1.175 2020/12/17 20:43:37 christos Exp $")
|
||||
+FILE_RCSID("@(#)$File: readelf.c,v 1.176 2021/04/09 19:16:19 christos Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef BUILTIN_ELF
|
||||
@@ -982,9 +982,8 @@ get_string_on_virtaddr(struct magic_set *ms,
|
||||
fsize, virtaddr);
|
||||
if (offset < 0 ||
|
||||
(buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
|
||||
- if (file_printf(ms, ", can't read elf string at %jd",
|
||||
- (intmax_t)offset) == -1)
|
||||
- return -1;
|
||||
+ (void)file_printf(ms, ", can't read elf string at %jd",
|
||||
+ (intmax_t)offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1185,17 +1184,15 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
|
||||
}
|
||||
|
||||
if (namesz & 0x80000000) {
|
||||
- if (file_printf(ms, ", bad note name size %#lx",
|
||||
- CAST(unsigned long, namesz)) == -1)
|
||||
- return -1;
|
||||
+ (void)file_printf(ms, ", bad note name size %#lx",
|
||||
+ CAST(unsigned long, namesz);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (descsz & 0x80000000) {
|
||||
- if (file_printf(ms, ", bad note description size %#lx",
|
||||
- CAST(unsigned long, descsz)) == -1)
|
||||
- return -1;
|
||||
- return 0;
|
||||
+ (void)file_printf(ms, ", bad note description size %#lx",
|
||||
+ CAST(unsigned long, descsz);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
noff = offset;
|
||||
--
|
||||
2.28.0
|
||||
|
50
file-5.40-4c5fe1ad.patch
Normal file
50
file-5.40-4c5fe1ad.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 4c5fe1ad1daa798eda3265e09a382d4ede548981 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Fri, 9 Apr 2021 20:40:56 +0000
|
||||
Subject: [PATCH] Add missing parens, use reinterpret-casr
|
||||
|
||||
---
|
||||
src/readelf.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git src/readelf.c src/readelf.c
|
||||
index 633fd2e8..10902f09 100644
|
||||
--- src/readelf.c
|
||||
+++ src/readelf.c
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
-FILE_RCSID("@(#)$File: readelf.c,v 1.176 2021/04/09 19:16:19 christos Exp $")
|
||||
+FILE_RCSID("@(#)$File: readelf.c,v 1.177 2021/04/09 20:40:56 christos Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef BUILTIN_ELF
|
||||
@@ -918,7 +918,7 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
|
||||
if (file_printf(ms, ", from '%s'",
|
||||
file_copystr(buf, sizeof(buf),
|
||||
CAST(size_t, cp - cname),
|
||||
- CAST(const char *, cname))) == -1)
|
||||
+ RCAST(char *, cname))) == -1)
|
||||
return -1;
|
||||
*flags |= FLAGS_DID_CORE;
|
||||
return 1;
|
||||
@@ -1185,13 +1185,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
|
||||
|
||||
if (namesz & 0x80000000) {
|
||||
(void)file_printf(ms, ", bad note name size %#lx",
|
||||
- CAST(unsigned long, namesz);
|
||||
+ CAST(unsigned long, namesz));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (descsz & 0x80000000) {
|
||||
(void)file_printf(ms, ", bad note description size %#lx",
|
||||
- CAST(unsigned long, descsz);
|
||||
+ CAST(unsigned long, descsz));
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.28.0
|
||||
|
35
file-5.40-749e1ecf.patch
Normal file
35
file-5.40-749e1ecf.patch
Normal file
@ -0,0 +1,35 @@
|
||||
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 | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git src/encoding.c src/encoding.c
|
||||
index 0fb1f47b..31d4d125 100644
|
||||
--- src/encoding.c
|
||||
+++ src/encoding.c
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
-FILE_RCSID("@(#)$File: encoding.c,v 1.30 2021/04/09 19:16:51 christos Exp $")
|
||||
+FILE_RCSID("@(#)$File: encoding.c,v 1.31 2021/04/19 18:38:04 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -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; \
|
||||
--
|
||||
2.28.0
|
||||
|
40
file-5.40-9b0459af.patch
Normal file
40
file-5.40-9b0459af.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 9b0459afab309a82aa4e46f73a4e50dd641f3d39 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Mon, 19 Apr 2021 17:01:45 +0000
|
||||
Subject: [PATCH] PR/257: cuihao: put attributes inside the xz magic.
|
||||
|
||||
---
|
||||
magic/Magdir/compress | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git magic/Magdir/compress magic/Magdir/compress
|
||||
index 64d11a73..41a65738 100644
|
||||
--- magic/Magdir/compress
|
||||
+++ magic/Magdir/compress
|
||||
@@ -1,5 +1,5 @@
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: compress,v 1.80 2021/03/15 17:49:24 christos Exp $
|
||||
+# $File: compress,v 1.81 2021/04/19 17:01:45 christos Exp $
|
||||
# compress: file(1) magic for pure-compression formats (no archives)
|
||||
#
|
||||
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
||||
@@ -265,14 +265,13 @@
|
||||
|
||||
# http://tukaani.org/xz/xz-file-format.txt
|
||||
0 ustring \xFD7zXZ\x00 XZ compressed data, checksum
|
||||
+!:strength * 2
|
||||
+!:mime application/x-xz
|
||||
>7 byte&0xf 0x0 NONE
|
||||
>7 byte&0xf 0x1 CRC32
|
||||
>7 byte&0xf 0x4 CRC64
|
||||
>7 byte&0xf 0xa SHA-256
|
||||
|
||||
-!:strength * 2
|
||||
-!:mime application/x-xz
|
||||
-
|
||||
# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
|
||||
0 string LRZI LRZIP compressed data
|
||||
>4 byte x - version %d
|
||||
--
|
||||
2.28.0
|
||||
|
27
file-5.40-ascii.patch
Normal file
27
file-5.40-ascii.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From a806b7c99870f76c5fcf3d34f9d91f37685e1a1c Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Fri, 23 Apr 2021 09:32:09 +0200
|
||||
Subject: [PATCH] Count every ASCII character
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
src/encoding.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git src/encoding.c src/encoding.c
|
||||
index 31d4d125..686be210 100644
|
||||
--- src/encoding.c
|
||||
+++ src/encoding.c
|
||||
@@ -282,8 +282,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
|
||||
} \
|
||||
u = 0; \
|
||||
for (i = 0; i < __arraycount(dist); i++) { \
|
||||
- if (dist[i]) \
|
||||
- u++; \
|
||||
+ u += dist[i]; \
|
||||
} \
|
||||
if (u < MIN(nbytes, 3)) \
|
||||
return 0; \
|
||||
--
|
||||
2.28.0
|
||||
|
BIN
file-5.40-f0601504.patch
Normal file
BIN
file-5.40-f0601504.patch
Normal file
Binary file not shown.
35
file-5.40-f7705dca.patch
Normal file
35
file-5.40-f7705dca.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From f7705dca0be7aacc8ce96d842860c419f755c26e Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Fri, 9 Apr 2021 19:16:51 +0000
|
||||
Subject: [PATCH] fix previous (cast >>)
|
||||
|
||||
---
|
||||
src/encoding.c | 8 +-------
|
||||
1 file changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
diff --git src/encoding.c src/encoding.c
|
||||
index 691e3e16..0fb1f47b 100644
|
||||
--- src/encoding.c
|
||||
+++ src/encoding.c
|
||||
@@ -1,5 +1,3 @@
|
||||
-/* $NetBSD: encoding.c,v 1.1.1.13 2021/04/09 18:58:01 christos Exp $ */
|
||||
-
|
||||
/*
|
||||
* Copyright (c) Ian F. Darwin 1986-1995.
|
||||
* Software written by Ian F. Darwin and others;
|
||||
@@ -37,11 +35,7 @@
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
-#if 0
|
||||
-FILE_RCSID("@(#)$File: encoding.c,v 1.29 2021/04/09 19:16:19 christos Exp $")
|
||||
-#else
|
||||
-__RCSID("$NetBSD: encoding.c,v 1.1.1.13 2021/04/09 18:58:01 christos Exp $");
|
||||
-#endif
|
||||
+FILE_RCSID("@(#)$File: encoding.c,v 1.30 2021/04/09 19:16:51 christos Exp $")
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
--
|
||||
2.28.0
|
||||
|
26
file.changes
26
file.changes
@ -1,3 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 23 10:26:49 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Add patch file-5.40-ascii.patch
|
||||
* fix regressions on dection of smaller ASCII files (boo#1184899)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 22 13:42:49 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Add upstream comitts as patches
|
||||
* file-5.40-9b0459af.patch
|
||||
put attributes inside the xz magic. (boo#1184888, boo#1184891)
|
||||
* file-5.40-749e1ecf.patch
|
||||
If the file is less than 3 bytes, use the file length to determine type
|
||||
* file-5.40-f0601504.patch
|
||||
Fix regression after unsigned/signed printing changes
|
||||
* file-5.40-f7705dca.patch
|
||||
fix previous (cast >>)
|
||||
* file-5.40-3096f87f.patch
|
||||
Correct return values to exptexted
|
||||
* file-5.40-4c5fe1ad.patch
|
||||
Add missing parens
|
||||
- Port patch
|
||||
* file-5.28-btrfs-image.dif
|
||||
due patch file-5.40-f0601504.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 6 07:39:00 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
|
15
file.spec
15
file.spec
@ -68,6 +68,14 @@ Patch40: file-5.38-allow-readlinkat.dif
|
||||
Patch41: file-5.40-1c677c04.patch
|
||||
Patch42: file-5.40-9e2becec.patch
|
||||
Patch43: file-5.40-6b34436a.patch
|
||||
Patch44: file-5.40-9b0459af.patch
|
||||
Patch45: file-5.40-f0601504.patch
|
||||
Patch46: file-5.40-3096f87f.patch
|
||||
Patch47: file-5.40-f7705dca.patch
|
||||
Patch48: file-5.40-749e1ecf.patch
|
||||
Patch49: file-5.40-4c5fe1ad.patch
|
||||
# My fix of the ASCII count bug
|
||||
Patch60: file-5.40-ascii.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%global _sysconfdir /etc
|
||||
%global _miscdir %{_datadir}/misc
|
||||
@ -114,6 +122,13 @@ to develop applications that require the magic "file" interface.
|
||||
%patch41 -p0
|
||||
%patch42 -p0
|
||||
%patch43 -p0
|
||||
%patch44 -p0
|
||||
%patch45 -p0
|
||||
%patch46 -p0
|
||||
%patch47 -p0
|
||||
%patch48 -p0
|
||||
%patch49 -p0
|
||||
%patch60 -p0
|
||||
%patch1 -p0 -b .misc
|
||||
%patch4 -p0 -b .conf
|
||||
%patch5 -p0 -b .tex
|
||||
|
Loading…
Reference in New Issue
Block a user