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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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@mx.gw.com
  16. +# to the upstream maintainers, at file@mx.gw.com
  17. +# or send your suggested inclusions
  18. +# as a wishlist bug against file (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. @@ -454,7 +454,7 @@
  28. if (map == (struct magic_map *)-1)
  29. return -1;
  30. if (map == NULL) {
  31. - if (ms->flags & MAGIC_CHECK)
  32. + if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
  33. file_magwarn(ms, "using regular magic file `%s'", fn);
  34. map = apprentice_load(ms, fn, action);
  35. if (map == NULL)
  36. --- a/doc/file.man
  37. +++ b/doc/file.man
  38. @@ -57,7 +57,7 @@
  39. or non-printable).
  40. Exceptions are well-known file formats (core files, tar archives)
  41. that are known to contain binary data.
  42. -When modifying magic files or the program itself, make sure to
  43. +When adding local definitions to /etc/magic, make sure to
  44. .Em "preserve these keywords" .
  45. Users depend on knowing that all the readable files in a directory
  46. have the word
  47. @@ -101,7 +101,8 @@
  48. has been applied by extension to data files.
  49. Any file with some invariant identifier at a small fixed
  50. offset into the file can usually be described in this way.
  51. -The information identifying these files is read from the compiled
  52. +The information identifying these files is read from /etc/magic
  53. +and the compiled
  54. magic file
  55. .Pa __MAGIC__.mgc ,
  56. or the files in the directory
  57. @@ -472,12 +473,6 @@
  58. The order of entries in the magic file is significant.
  59. Depending on what system you are using, the order that
  60. they are put together may be incorrect.
  61. -If your old
  62. -.Nm
  63. -command uses a magic file,
  64. -keep the old magic file around for comparison purposes
  65. -(rename it to
  66. -.Pa __MAGIC__.orig ) .
  67. .Sh EXAMPLES
  68. .Bd -literal -offset indent
  69. $ file file.c file /dev/{wd0a,hda}