summaryrefslogtreecommitdiffstats
path: root/debian/patches/local.support-local-definitions-in-etc-magic.patch
blob: f26768a128315e226d7a64184aff850baddea23f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Description: Support local definitions in /etc/magic
Author:
 Michael Piefel <piefel@debian.org>,
 Judit Foglszinger <fgrfgr@freenet.de>
Forwarded: no
Last-Update: 2016-06-27

--- a/magic/Header
+++ b/magic/Header
@@ -1,5 +1,6 @@
 # Magic data for file(1) command.
-# Format is described in magic(files), where:
-# files is 5 on V7 and BSD, 4 on SV, and ?? on SVID.
+# Format is described in in magic(5).
 # Don't edit this file, edit /etc/magic or send your magic improvements
-# to the maintainers, at file@astron.com
+# to the upstream maintainers, at file@astron.com
+# or send your suggested inclusions
+# as a wishlist bug against the file package (using the reportbug utility).
--- /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).
+
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -496,7 +496,7 @@
 #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(NULL, "using regular magic file `%s'", fn);
 		map = apprentice_load(ms, fn, action);
 		if (map == NULL)
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,7 @@
 
 bin_PROGRAMS = file
 
-AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
+AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
 AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 
 libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -360,7 +360,7 @@
 MAGIC = $(pkgdatadir)/magic
 lib_LTLIBRARIES = libmagic.la
 nodist_include_HEADERS = magic.h
-AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
+AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
 AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
 	encoding.c compress.c is_csv.c is_json.c is_tar.c readelf.c print.c \
--- a/doc/file.man
+++ b/doc/file.man
@@ -59,7 +59,7 @@
 Exceptions are well-known file formats (core files, tar archives)
 that are known to contain binary data.
 When modifying magic files or the program itself, make sure to
-.Em preserve these keywords .
+.Em "preserve these keywords" .
 Users depend on knowing that all the readable files in a directory
 have the word
 .Dq text
@@ -102,7 +102,8 @@
 has been applied by extension to data files.
 Any file with some invariant identifier at a small fixed
 offset into the file can usually be described in this way.
-The information identifying these files is read from the compiled
+The information identifying these files is read from /etc/magic
+and the compiled
 magic file
 .Pa __MAGIC__.mgc ,
 or the files in the directory
@@ -572,12 +573,6 @@
 The order of entries in the magic file is significant.
 Depending on what system you are using, the order that
 they are put together may be incorrect.
-If your old
-.Nm
-command uses a magic file,
-keep the old magic file around for comparison purposes
-(rename it to
-.Pa __MAGIC__.orig ) .
 .Sh HISTORY
 There has been a
 .Nm