local.support-local-definitions-in-etc-magic.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Description: Support local definitions in /etc/magic
  2. Author:
  3. Michael Piefel <piefel@debian.org>,
  4. Judit Foglszinger <fgrfgr@freenet.de>
  5. Forwarded: no
  6. Last-Update: 2016-06-27
  7. --- a/magic/Header
  8. +++ b/magic/Header
  9. @@ -1,5 +1,6 @@
  10. # Magic data for file(1) command.
  11. -# Format is described in magic(files), where:
  12. -# files is 5 on V7 and BSD, 4 on SV, and ?? on SVID.
  13. +# Format is described in in magic(5).
  14. # Don't edit this file, edit /etc/magic or send your magic improvements
  15. -# to the maintainers, at file@astron.com
  16. +# to the upstream maintainers, at file@astron.com
  17. +# or send your suggested inclusions
  18. +# as a wishlist bug against the file package (using the reportbug utility).
  19. --- /dev/null
  20. +++ b/magic/magic.local
  21. @@ -0,0 +1,3 @@
  22. +# Magic local data for file(1) command.
  23. +# Insert here your local magic data. Format is described in magic(5).
  24. +
  25. --- a/src/apprentice.c
  26. +++ b/src/apprentice.c
  27. @@ -496,7 +496,7 @@
  28. #ifndef COMPILE_ONLY
  29. map = apprentice_map(ms, fn);
  30. if (map == NULL) {
  31. - if (ms->flags & MAGIC_CHECK)
  32. + if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
  33. file_magwarn(NULL, "using regular magic file `%s'", fn);
  34. map = apprentice_load(ms, fn, action);
  35. if (map == NULL)
  36. --- a/src/Makefile.am
  37. +++ b/src/Makefile.am
  38. @@ -4,7 +4,7 @@
  39. bin_PROGRAMS = file
  40. -AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  41. +AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
  42. AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
  43. libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
  44. --- a/src/Makefile.in
  45. +++ b/src/Makefile.in
  46. @@ -361,7 +361,7 @@
  47. MAGIC = $(pkgdatadir)/magic
  48. lib_LTLIBRARIES = libmagic.la
  49. nodist_include_HEADERS = magic.h
  50. -AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  51. +AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
  52. AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
  53. libmagic_la_SOURCES = buffer.c magic.c apprentice.c softmagic.c ascmagic.c \
  54. encoding.c compress.c is_csv.c is_json.c is_tar.c readelf.c print.c \
  55. --- a/doc/file.man
  56. +++ b/doc/file.man
  57. @@ -59,7 +59,7 @@
  58. Exceptions are well-known file formats (core files, tar archives)
  59. that are known to contain binary data.
  60. When modifying magic files or the program itself, make sure to
  61. -.Em preserve these keywords .
  62. +.Em "preserve these keywords" .
  63. Users depend on knowing that all the readable files in a directory
  64. have the word
  65. .Dq text
  66. @@ -102,7 +102,8 @@
  67. has been applied by extension to data files.
  68. Any file with some invariant identifier at a small fixed
  69. offset into the file can usually be described in this way.
  70. -The information identifying these files is read from the compiled
  71. +The information identifying these files is read from /etc/magic
  72. +and the compiled
  73. magic file
  74. .Pa __MAGIC__.mgc ,
  75. or the files in the directory
  76. @@ -572,12 +573,6 @@
  77. The order of entries in the magic file is significant.
  78. Depending on what system you are using, the order that
  79. they are put together may be incorrect.
  80. -If your old
  81. -.Nm
  82. -command uses a magic file,
  83. -keep the old magic file around for comparison purposes
  84. -(rename it to
  85. -.Pa __MAGIC__.orig ) .
  86. .Sh HISTORY
  87. There has been a
  88. .Nm