From fa806214b7a76136fe4a97e2f69530166708995d2607d586221bcbad765a715f Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 6 Apr 2021 07:42:26 +0000 Subject: [PATCH] Add upstream bug fix commits OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=223 --- file-5.17-option.dif | 8 ++++---- file-5.19-biorad.dif | 2 +- file-5.19-printf.dif | 2 +- file-5.19-zip2.0.dif | 2 +- file-5.22-elf.dif | 4 ++-- file-5.23-endian.patch | 2 +- file-5.28-btrfs-image.dif | 2 +- file-5.38-allow-readlinkat.dif | 2 +- file-5.40-1c677c04.patch | 36 ++++++++++++++++++++++++++++++++++ file-5.40-6b34436a.patch | 29 +++++++++++++++++++++++++++ file-5.40-9e2becec.patch | 25 +++++++++++++++++++++++ file-secure_getenv.patch | 2 +- file.changes | 22 +++++++++++++++++++++ file.spec | 7 +++++++ 14 files changed, 132 insertions(+), 13 deletions(-) create mode 100644 file-5.40-1c677c04.patch create mode 100644 file-5.40-6b34436a.patch create mode 100644 file-5.40-9e2becec.patch diff --git a/file-5.17-option.dif b/file-5.17-option.dif index d2ad535..ea077ac 100644 --- a/file-5.17-option.dif +++ b/file-5.17-option.dif @@ -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 -@@ -249,6 +249,8 @@ +@@ -251,6 +251,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; -@@ -261,7 +263,7 @@ +@@ -263,7 +265,7 @@ break; case 'f': @@ -18,7 +18,7 @@ usage(); if (magic == NULL) if ((magic = load(magicfile, flags)) == NULL) -@@ -271,6 +273,8 @@ +@@ -273,6 +275,8 @@ ++didsomefiles; break; case 'F': @@ -27,7 +27,7 @@ separator = optarg; break; case 'i': -@@ -283,6 +287,8 @@ +@@ -285,6 +289,8 @@ action = FILE_LIST; break; case 'm': diff --git a/file-5.19-biorad.dif b/file-5.19-biorad.dif index ee76a01..8c33177 100644 --- a/file-5.19-biorad.dif +++ b/file-5.19-biorad.dif @@ -4,7 +4,7 @@ --- magic/Magdir/images +++ magic/Magdir/images 2019-05-27 08:52:51.674238380 +0000 -@@ -1290,6 +1290,8 @@ +@@ -1348,6 +1348,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 diff --git a/file-5.19-printf.dif b/file-5.19-printf.dif index e59d2fd..09dda4d 100644 --- a/file-5.19-printf.dif +++ b/file-5.19-printf.dif @@ -4,7 +4,7 @@ --- src/apprentice.c +++ src/apprentice.c 2019-02-21 06:39:25.249091320 +0000 -@@ -2465,6 +2465,12 @@ check_format_type(const char *ptr, int t +@@ -2476,6 +2476,12 @@ check_format_type(const char *ptr, int t ptr++; if (*ptr == '#') ptr++; diff --git a/file-5.19-zip2.0.dif b/file-5.19-zip2.0.dif index b5610d3..e3670ff 100644 --- a/file-5.19-zip2.0.dif +++ b/file-5.19-zip2.0.dif @@ -4,7 +4,7 @@ --- magic/Magdir/archive +++ magic/Magdir/archive 2019-02-21 06:49:05.298138025 +0000 -@@ -1102,6 +1102,11 @@ +@@ -1117,6 +1117,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 diff --git a/file-5.22-elf.dif b/file-5.22-elf.dif index cee62d6..237504a 100644 --- a/file-5.22-elf.dif +++ b/file-5.22-elf.dif @@ -4,7 +4,7 @@ --- src/readelf.c +++ src/readelf.c 2019-02-21 06:41:38.598573505 +0000 -@@ -818,7 +818,7 @@ do_core_note(struct magic_set *ms, unsig +@@ -824,7 +824,7 @@ do_core_note(struct magic_set *ms, unsig default: if (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) { @@ -13,7 +13,7 @@ unsigned char c; /* * Extract the program name. We assume -@@ -830,7 +830,9 @@ do_core_note(struct magic_set *ms, unsig +@@ -836,7 +836,9 @@ do_core_note(struct magic_set *ms, unsig * If the characters aren't all printable, * reject it. */ diff --git a/file-5.23-endian.patch b/file-5.23-endian.patch index d9a44f3..6c60c9e 100644 --- a/file-5.23-endian.patch +++ b/file-5.23-endian.patch @@ -29,7 +29,7 @@ private char *mkdbname(struct magic_set *, const char *, int); private struct magic_map *apprentice_buf(struct magic_set *, struct magic *, size_t); -@@ -3336,67 +3338,6 @@ byteswap(struct magic *magic, uint32_t n +@@ -3347,67 +3349,6 @@ byteswap(struct magic *magic, uint32_t n } /* diff --git a/file-5.28-btrfs-image.dif b/file-5.28-btrfs-image.dif index 08cda23..15ccbba 100644 --- a/file-5.28-btrfs-image.dif +++ b/file-5.28-btrfs-image.dif @@ -16,7 +16,7 @@ contained within the image. diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems --- a/magic/Magdir/filesystems +++ b/magic/Magdir/filesystems -@@ -2281,20 +2281,29 @@ +@@ -2296,20 +2296,29 @@ >>0x10060 string >\0 lockproto %s) # Russell Coker diff --git a/file-5.38-allow-readlinkat.dif b/file-5.38-allow-readlinkat.dif index 7b3db02..d24e160 100644 --- a/file-5.38-allow-readlinkat.dif +++ b/file-5.38-allow-readlinkat.dif @@ -2,7 +2,7 @@ Index: file-5.38/src/seccomp.c =================================================================== --- file-5.38.orig/src/seccomp.c +++ file-5.38/src/seccomp.c -@@ -206,6 +206,9 @@ enable_sandbox_full(void) +@@ -205,6 +205,9 @@ enable_sandbox_full(void) #ifdef __NR_newfstatat ALLOW_RULE(newfstatat); #endif diff --git a/file-5.40-1c677c04.patch b/file-5.40-1c677c04.patch new file mode 100644 index 0000000..c672adf --- /dev/null +++ b/file-5.40-1c677c04.patch @@ -0,0 +1,36 @@ +From 1c677c04c0fa43ecfeccdb9705dbbd19fb356891 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Sun, 4 Apr 2021 21:02:19 +0000 +Subject: [PATCH] Don't count each byte encounter as 1, count the total number + of bytes found (Anatol Belski). This makes it behave like 5.39. + +--- + src/encoding.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git src/encoding.c src/encoding.c +index c8b40439..c66703bb 100644 +--- src/encoding.c ++++ src/encoding.c +@@ -35,7 +35,7 @@ + #include "file.h" + + #ifndef lint +-FILE_RCSID("@(#)$File: encoding.c,v 1.27 2021/02/05 21:33:49 christos Exp $") ++FILE_RCSID("@(#)$File: encoding.c,v 1.28 2021/04/04 21:02:19 christos Exp $") + #endif /* lint */ + + #include "magic.h" +@@ -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 < 3) \ + return 0; \ +-- +2.26.2 + diff --git a/file-5.40-6b34436a.patch b/file-5.40-6b34436a.patch new file mode 100644 index 0000000..7e229e7 --- /dev/null +++ b/file-5.40-6b34436a.patch @@ -0,0 +1,29 @@ +From 6b34436ac766dae64749b8d14f18c6910be40131 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Mon, 5 Apr 2021 16:36:14 +0000 +Subject: [PATCH] remove "u" from the pattern (Joerg Jenderek) + +--- + magic/Magdir/mail.news | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git magic/Magdir/mail.news magic/Magdir/mail.news +index 3a2eeb96..6a222910 100644 +--- magic/Magdir/mail.news ++++ magic/Magdir/mail.news +@@ -1,5 +1,5 @@ + #------------------------------------------------------------------------------ +-# $File: mail.news,v 1.26 2021/03/21 14:37:03 christos Exp $ ++# $File: mail.news,v 1.27 2021/04/05 16:36:14 christos Exp $ + # mail.news: file(1) magic for mail and news + # + # Unfortunately, saved netnews also has From line added in some news software. +@@ -81,4 +81,4 @@ + # File format spec: https://wiki.dovecot.org/Design/Dcrypt/#File_format + # From: Stephen Gildea + 0 string CRYPTED\003\007 Dovecot encrypted message +->9 byte xu \b, dcrypt version %d ++>9 byte x \b, dcrypt version %d +-- +2.26.2 + diff --git a/file-5.40-9e2becec.patch b/file-5.40-9e2becec.patch new file mode 100644 index 0000000..b8ea1b1 --- /dev/null +++ b/file-5.40-9e2becec.patch @@ -0,0 +1,25 @@ +From 9e2becec20d023409a1671bf10a682f699350e85 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Sun, 4 Apr 2021 21:03:43 +0000 +Subject: [PATCH] Encoding bug fix. + +--- + ChangeLog | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git ChangeLog ChangeLog +index 23a93cf4..2238ba6f 100644 +--- ChangeLog ++++ ChangeLog +@@ -1,3 +1,8 @@ ++2021-04-04 17:02 Christos Zoulas ++ ++ * count the total bytes found not the total byte positions ++ in order to determine encoding (Anatol Belski) ++ + 2021-03-30 20:21 Christos Zoulas + + * release 5.40 +-- +2.26.2 + diff --git a/file-secure_getenv.patch b/file-secure_getenv.patch index 0de0b3f..08b3675 100644 --- a/file-secure_getenv.patch +++ b/file-secure_getenv.patch @@ -22,7 +22,7 @@ Index: file-5.38/src/file.h =================================================================== --- file-5.38.orig/src/file.h +++ file-5.38/src/file.h -@@ -676,4 +676,12 @@ static const char *rcsid(const char *p) +@@ -691,4 +691,12 @@ static const char *rcsid(const char *p) #define __RCSID(a) #endif diff --git a/file.changes b/file.changes index 7c56e9b..9709211 100644 --- a/file.changes +++ b/file.changes @@ -1,3 +1,25 @@ +------------------------------------------------------------------- +Tue Apr 6 07:39:00 UTC 2021 - Dr. Werner Fink + +- Add upstream commits as patches + * file-5.40-1c677c04.patch + Don't count each byte encounter as 1, count the total number + of bytes found (Anatol Belski). This makes it behave like 5.39 + * file-5.40-6b34436a.patch + remove "u" from the pattern (Joerg Jenderek) + * file-5.40-9e2becec.patch + Encoding bug fix +- Fix offsets of patches + * file-5.17-option.dif + * file-5.19-biorad.dif + * file-5.19-printf.dif + * file-5.19-zip2.0.dif + * file-5.22-elf.dif + * file-5.23-endian.patch + * file-5.28-btrfs-image.dif + * file-5.38-allow-readlinkat.dif + * file-secure_getenv.patch + ------------------------------------------------------------------- Sat Apr 3 07:32:11 UTC 2021 - Andreas Stieger diff --git a/file.spec b/file.spec index 82214e9..680d3a0 100644 --- a/file.spec +++ b/file.spec @@ -64,6 +64,10 @@ Patch34: file-5.23-endian.patch Patch37: file-secure_getenv.patch Patch39: file-5.28-btrfs-image.dif Patch40: file-5.38-allow-readlinkat.dif +# Upstream commits as patches +Patch41: file-5.40-1c677c04.patch +Patch42: file-5.40-9e2becec.patch +Patch43: file-5.40-6b34436a.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc %global _miscdir %{_datadir}/misc @@ -107,6 +111,9 @@ to develop applications that require the magic "file" interface. %prep %setup -q -n file-%{version} +%patch41 -p0 +%patch42 -p0 +%patch43 -p0 %patch1 -p0 -b .misc %patch4 -p0 -b .conf %patch5 -p0 -b .tex