Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2 years ago
commit
d10dd1439a
  1. 12
      SOURCES/file-4.17-rpm-name.patch
  2. 10
      SOURCES/file-5.04-volume_key.patch
  3. 201
      SOURCES/file-5.39-CLOEXEC.patch
  4. 319
      SOURCES/file-5.40-magic-python.patch
  5. 62
      SOURCES/file-localmagic.patch
  6. 1252
      SPECS/file.spec

12
SOURCES/file-4.17-rpm-name.patch

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
diff --git a/magic/Magdir/rpm b/magic/Magdir/rpm
index 9a795f8..31db083 100644
--- a/magic/Magdir/rpm
+++ b/magic/Magdir/rpm
@@ -29,6 +29,7 @@
>>8 beshort 17 SuperH
>>8 beshort 18 Xtensa
>>8 beshort 255 noarch
+>>10 string x %s
#delta RPM Daniel Novotny (dnovotny@redhat.com)
0 string drpm Delta RPM

10
SOURCES/file-5.04-volume_key.patch

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
diff --git a/magic/Magdir/securitycerts b/magic/Magdir/securitycerts
index 8785dd8..1c340be 100644
--- a/magic/Magdir/securitycerts
+++ b/magic/Magdir/securitycerts
@@ -4,3 +4,5 @@
0 search/1 -----BEGIN\ CERTIFICATE------ RFC1421 Security Certificate text
0 search/1 -----BEGIN\ NEW\ CERTIFICATE RFC1421 Security Certificate Signing Request text
0 belong 0xedfeedfe Sun 'jks' Java Keystore File data
+
+0 string \0volume_key volume_key escrow packet

201
SOURCES/file-5.39-CLOEXEC.patch

@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
diff --git a/ChangeLog b/ChangeLog
index d46caaa0d..41d6e99d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-08 16:24 Christos Zoulas <christos@zoulas.com>
+
+ * fix multithreaded decompression file descriptor issue
+ by using close-on-exec (Denys Vlasenko)
+
2020-06-14 20:02 Christos Zoulas <christos@zoulas.com>

* release 5.39
diff --git a/configure.ac b/configure.ac
index 64c9f42e3..521dc12db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,7 +166,7 @@ else
fi])

dnl Checks for functions
-AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem)
+AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2)

dnl Provide implementation of some required functions if necessary
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
diff --git a/src/compress.c b/src/compress.c
index cbc2ce19b..9f65e4fa1 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -35,7 +35,7 @@
#include "file.h"

#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.127 2020/05/31 00:11:06 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.129 2020/12/08 21:26:00 christos Exp $")
#endif

#include "magic.h"
@@ -844,8 +844,23 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
for (i = 0; i < __arraycount(fdp); i++)
fdp[i][0] = fdp[i][1] = -1;

- if ((fd == -1 && pipe(fdp[STDIN_FILENO]) == -1) ||
- pipe(fdp[STDOUT_FILENO]) == -1 || pipe(fdp[STDERR_FILENO]) == -1) {
+ /*
+ * There are multithreaded users who run magic_file()
+ * from dozens of threads. If two parallel magic_file() calls
+ * analyze two large compressed files, both will spawn
+ * an uncompressing child here, which writes out uncompressed data.
+ * We read some portion, then close the pipe, then waitpid() the child.
+ * If uncompressed data is larger, child shound get EPIPE and exit.
+ * However, with *parallel* calls OTHER child may unintentionally
+ * inherit pipe fds, thus keeping pipe open and making writes in
+ * our child block instead of failing with EPIPE!
+ * (For the bug to occur, two threads must mutually inherit their pipes,
+ * and both must have large outputs. Thus it happens not that often).
+ * To avoid this, be sure to create pipes with O_CLOEXEC.
+ */
+ if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
+ file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
+ file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
closep(fdp[STDIN_FILENO]);
closep(fdp[STDOUT_FILENO]);
return makeerror(newch, n, "Cannot create pipe, %s",
@@ -876,16 +891,20 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
if (fdp[STDIN_FILENO][1] > 2)
(void) close(fdp[STDIN_FILENO][1]);
}
+ file_clear_closexec(STDIN_FILENO);
+
///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
if (copydesc(STDOUT_FILENO, fdp[STDOUT_FILENO][1]))
(void) close(fdp[STDOUT_FILENO][1]);
if (fdp[STDOUT_FILENO][0] > 2)
(void) close(fdp[STDOUT_FILENO][0]);
+ file_clear_closexec(STDOUT_FILENO);

if (copydesc(STDERR_FILENO, fdp[STDERR_FILENO][1]))
(void) close(fdp[STDERR_FILENO][1]);
if (fdp[STDERR_FILENO][0] > 2)
(void) close(fdp[STDERR_FILENO][0]);
+ file_clear_closexec(STDERR_FILENO);

(void)execvp(compr[method].argv[0],
RCAST(char *const *, RCAST(intptr_t, compr[method].argv)));
diff --git a/src/file.h b/src/file.h
index f00e8010b..6c3900479 100644
--- a/src/file.h
+++ b/src/file.h
@@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.220 2020/06/08 17:38:27 christos Exp $
+ * @(#)$File: file.h,v 1.223 2020/12/08 21:26:00 christos Exp $
*/

#ifndef __file_h__
@@ -143,6 +143,14 @@
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif

+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+#endif
+
#define FILE_BADSIZE CAST(size_t, ~0ul)
#define MAXDESC 64 /* max len of text description/MIME type */
#define MAXMIME 80 /* max len of text MIME type */
@@ -540,6 +548,8 @@ protected char * file_printable(char *, size_t, const char *, size_t);
protected int file_os2_apptype(struct magic_set *, const char *, const void *,
size_t);
#endif /* __EMX__ */
+protected int file_pipe_closexec(int *);
+protected int file_clear_closexec(int);

protected void buffer_init(struct buffer *, int, const struct stat *,
const void *, size_t);
diff --git a/src/funcs.c b/src/funcs.c
index ecbfa28c5..bcf9ddaae 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -27,7 +27,7 @@
#include "file.h"

#ifndef lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.115 2020/02/20 15:50:20 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.118 2020/12/08 21:26:00 christos Exp $")
#endif /* lint */

#include "magic.h"
@@ -36,6 +36,9 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.117 2020/06/25 16:52:48 christos Exp $")
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* for pipe2() */
+#endif
#if defined(HAVE_WCHAR_H)
#include <wchar.h>
#endif
@@ -784,3 +787,22 @@ file_print_guid(char *str, size_t len, const uint64_t *guid)
g->data4[2], g->data4[3], g->data4[4], g->data4[5],
g->data4[6], g->data4[7]);
}
+
+protected int
+file_pipe_closexec(int *fds)
+{
+#ifdef HAVE_PIPE2
+ return pipe2(fds, O_CLOEXEC);
+#else
+ if (pipe(fds) == -1)
+ return -1;
+ (void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
+ (void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
+ return 0;
+#endif
+}
+
+protected int
+file_clear_closexec(int fd) {
+ return fcntl(fd, F_SETFD, 0);
+}
diff --git a/src/magic.c b/src/magic.c
index 17a7077d8..89f4e16c0 100644
--- a/src/magic.c
+++ b/src/magic.c
@@ -33,7 +33,7 @@
#include "file.h"

#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.112 2020/06/08 19:44:10 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.113 2020/12/08 21:26:00 christos Exp $")
#endif /* lint */

#include "magic.h"
@@ -436,7 +436,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
_setmode(STDIN_FILENO, O_BINARY);
#endif
if (inname != NULL) {
- int flags = O_RDONLY|O_BINARY|O_NONBLOCK;
+ int flags = O_RDONLY|O_BINARY|O_NONBLOCK|O_CLOEXEC;
errno = 0;
if ((fd = open(inname, flags)) < 0) {
okstat = stat(inname, &sb) == 0;
@@ -460,6 +460,9 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
rv = 0;
goto done;
}
+#if O_CLOEXEC == 0
+ (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
+#endif
}

if (fd != -1) {

319
SOURCES/file-5.40-magic-python.patch

@ -0,0 +1,319 @@ @@ -0,0 +1,319 @@
diff --git a/magic/Magdir/python b/magic/Magdir/python
index 9d306c0..bc5163e 100644
--- a/magic/Magdir/python
+++ b/magic/Magdir/python
@@ -10,211 +10,211 @@
# MAGIC as specified in Python/import.c (1.0 to 3.7)
# two bytes of magic followed by "\r\n" in little endian order
0 belong 0x02099900 python 1.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x03099900 python 1.1/1.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x892e0d0a python 1.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x04170d0a python 1.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x994e0d0a python 1.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xfcc40d0a python 1.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xfdc40d0a python 1.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x87c60d0a python 2.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x88c60d0a python 2.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2aeb0d0a python 2.1 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2beb0d0a python 2.1 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2ded0d0a python 2.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2eed0d0a python 2.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x3bf20d0a python 2.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x3cf20d0a python 2.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x45f20d0a python 2.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x59f20d0a python 2.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x63f20d0a python 2.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x6df20d0a python 2.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x6ef20d0a python 2.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x77f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x81f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x8bf20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x8cf20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x95f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x9ff20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xa9f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xb3f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xb4f20d0a python 2.5 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xc7f20d0a python 2.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xd1f20d0a python 2.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xd2f20d0a python 2.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xdbf20d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xe5f20d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xeff20d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xf9f20d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x03f30d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x04f30d0a python 2.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xb80b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xc20b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xcc0b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xd60b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xe00b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xea0b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xf40b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xf50b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xff0b0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x090c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x130c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x1d0c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x1f0c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x270c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x3b0c0d0a python 3.0 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x450c0d0a python 3.1 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x4f0c0d0a python 3.1 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x580c0d0a python 3.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x620c0d0a python 3.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x6c0c0d0a python 3.2 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x760c0d0a python 3.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x800c0d0a python 3.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x8a0c0d0a python 3.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x940c0d0a python 3.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x9e0c0d0a python 3.3 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xb20c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xbc0c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xc60c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xd00c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xda0c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xe40c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xee0c0d0a python 3.4 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0xf80c0d0a python 3.5.1- byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x020d0d0a python 3.5.1- byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x0c0d0d0a python 3.5.1- byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x160d0d0a python 3.5.1- byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x170d0d0a python 3.5.2+ byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x200d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x210d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2a0d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2b0d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2c0d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2d0d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x2f0d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x300d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x310d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x320d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x330d0d0a python 3.6 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x3e0d0d0a python 3.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x3f0d0d0a python 3.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x400d0d0a python 3.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x410d0d0a python 3.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x420d0d0a python 3.7 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x480d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x490d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x520d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x530d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x540d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x550d0d0a python 3.8 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x5c0d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x5d0d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x5e0d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x5f0d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x600d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 belong 0x610d0d0a python 3.9 byte-compiled
-!:mime text/x-bytecode.python
+!:mime application/x-bytecode.python
0 search/1/w #!\040/usr/bin/python Python script text executable
!:strength + 15

62
SOURCES/file-localmagic.patch

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
From 95c993ff6bdfe92a7f519c4db60157a421e65b38 Mon Sep 17 00:00:00 2001
From: Siteshwar Vashisht <svashisht@redhat.com>
Date: Thu, 21 Feb 2019 15:26:38 +0100
Subject: [PATCH] Upstream says it's up to distributions to add a way to
support local-magic.

---
magic/magic.local | 3 +++
src/Makefile.am | 2 +-
src/Makefile.in | 2 +-
src/apprentice.c | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
create mode 100644 magic/magic.local

diff --git a/magic/magic.local b/magic/magic.local
new file mode 100644
index 0000000..283a863
--- /dev/null
+++ b/magic/magic.local
@@ -0,0 +1,3 @@
+# Magic local data for file(1) command.
+# Insert here your local magic data. Format is described in magic(5).
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f67f2c..b43cb8e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-MAGIC = $(pkgdatadir)/magic
+MAGIC = /etc/magic:$(pkgdatadir)/magic
lib_LTLIBRARIES = libmagic.la
nodist_include_HEADERS = magic.h
diff --git a/src/Makefile.in b/src/Makefile.in
index 59f3b5e..a8f56cf 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -356,7 +356,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-MAGIC = $(pkgdatadir)/magic
+MAGIC = /etc/magic:$(pkgdatadir)/magic
lib_LTLIBRARIES = libmagic.la
nodist_include_HEADERS = magic.h
AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
diff --git a/src/apprentice.c b/src/apprentice.c
index 1437bcc..b609dd1 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -460,7 +460,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
#ifndef COMPILE_ONLY
map = apprentice_map(ms, fn);
if (map == NULL) {
- if (ms->flags & MAGIC_CHECK)
+ if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
file_magwarn(ms, "using regular magic file `%s'", fn);
map = apprentice_load(ms, fn, action);
if (map == NULL)
--
2.25.4

1252
SPECS/file.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save