01-conglomeration.dpatch 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. #!/bin/sh /usr/share/dpatch/dpatch-run
  2. ## 01-conglomeration.dpatch
  3. ##
  4. ## DP: Needs to be broken out (FIXME).
  5. @DPATCH@
  6. diff -Naur file-4.20.orig/doc/file.man file-4.20/doc/file.man
  7. --- file-4.20.orig/doc/file.man 2007-01-25 21:05:46.000000000 +0000
  8. +++ file-4.20/doc/file.man 2007-03-27 12:23:14.000000000 +0000
  9. @@ -47,9 +47,8 @@
  10. or non-printable).
  11. Exceptions are well-known file formats (core files, tar archives)
  12. that are known to contain binary data.
  13. -When modifying the file
  14. -.Pa __MAGIC__
  15. -or the program itself, make sure to
  16. +When adding local definitions to
  17. +.Pa /etc/magic ,
  18. .Em "preserve these keywords" .
  19. People depend on knowing that all the readable files in a directory
  20. have the word
  21. @@ -99,12 +98,14 @@
  22. has been applied by extension to data files.
  23. Any file with some invariant identifier at a small fixed
  24. offset into the file can usually be described in this way.
  25. -The information identifying these files is read from the compiled
  26. +The information identifying these files is read from
  27. +.Pa /etc/magic
  28. +and the compiled
  29. magic file
  30. .Pa __MAGIC__.mgc ,
  31. or
  32. .Pa __MAGIC__
  33. -if the compile file does not exist. In addition
  34. +if the compiled file does not exist. In addition
  35. .Nm
  36. will look in
  37. .Pa $HOME/.magic.mgc ,
  38. @@ -161,7 +162,8 @@
  39. archives).
  40. .Pp
  41. Any file that cannot be identified as having been written
  42. -in any of the character sets listed above is simply said to be ``data''.
  43. +in any of the character sets listed above is simply said to be
  44. +.Dq data .
  45. .Sh OPTIONS
  46. .Bl -tag -width indent
  47. .It Fl b , -brief
  48. @@ -239,7 +241,12 @@
  49. .Dq FILES
  50. section, below).
  51. .It Fl k , -keep-going
  52. -Don't stop at the first match, keep going.
  53. +Don't stop at the first match, keep going. Subsequent matches will be
  54. +prepended by
  55. +.Dq "\[rs]012\- ".
  56. +(If you want a newline, see
  57. +.Dq "\-r"
  58. +option.)
  59. .It Fl L , -dereference
  60. option causes symlinks to be followed, as the like-named option in
  61. .Xr ls 1
  62. @@ -252,7 +259,8 @@
  63. This can be a single file, or a colon-separated list of files.
  64. If a compiled magic file is found alongside, it will be used instead.
  65. With the
  66. -.Fl i or
  67. +.Fl i
  68. +or
  69. .Fl "mime"
  70. option, the program adds
  71. .Dq .mime
  72. @@ -339,6 +347,11 @@
  73. and/or
  74. .Dq .mgc
  75. to the value of this variable as appropriate.
  76. +However,
  77. +.Pa file
  78. +has to exist in order for
  79. +.Pa file.mime
  80. +to be considered.
  81. The environment variable
  82. .Dv POSIXLY_CORRECT
  83. controls (on systems that support symbolic links), if
  84. @@ -413,12 +426,6 @@
  85. The order of entries in the magic file is significant.
  86. Depending on what system you are using, the order that
  87. they are put together may be incorrect.
  88. -If your old
  89. -.Nm
  90. -command uses a magic file,
  91. -keep the old magic file around for comparison purposes
  92. -(rename it to
  93. -.Pa __MAGIC__.orig ).
  94. .Sh EXAMPLES
  95. .Bd -literal -offset indent
  96. $ file file.c file /dev/{wd0a,hda}
  97. @@ -586,9 +593,17 @@
  98. The new support for multiple character codes makes it even slower.
  99. .Pp
  100. This manual page, and particularly this section, is too long.
  101. +.Sh RETURN CODE
  102. +.Nm
  103. +almost always returns 0. It returns a different code if it cannot open a file.
  104. .Sh AVAILABILITY
  105. You can obtain the original author's latest version by anonymous FTP
  106. on
  107. .Dv ftp.astron.com
  108. in the directory
  109. .Dv /pub/file/file-X.YZ.tar.gz
  110. +.Pp
  111. +This Debian version adds a number of new magix entries. It can be
  112. +obtained from every site carrying a Debian distribution (that is
  113. +.Dv ftp.debian.org
  114. +and mirrors).
  115. diff -Naur file-4.20.orig/doc/libmagic.man file-4.20/doc/libmagic.man
  116. --- file-4.20.orig/doc/libmagic.man 2007-01-25 21:04:08.000000000 +0000
  117. +++ file-4.20/doc/libmagic.man 2007-03-27 12:23:14.000000000 +0000
  118. @@ -39,7 +39,7 @@
  119. .Nm magic_load
  120. .Nd Magic number recognition library.
  121. .Sh LIBRARY
  122. -.Lb libmagic
  123. +.Lb libmagic1
  124. .Sh SYNOPSIS
  125. .In magic.h
  126. .Ft magic_t
  127. diff -Naur file-4.20.orig/doc/magic.man file-4.20/doc/magic.man
  128. --- file-4.20.orig/doc/magic.man 2007-01-12 17:38:27.000000000 +0000
  129. +++ file-4.20/doc/magic.man 2007-03-27 12:23:14.000000000 +0000
  130. @@ -65,7 +65,7 @@
  131. .Dq c
  132. flag, specifies case insensitive matching: lowercase
  133. characters in the magic match both lower and upper case characters in the
  134. -targer, whereas upper case characters in the magic, only much uppercase
  135. +target, whereas upper case characters in the magic, only much uppercase
  136. characters in the target.
  137. .It Dv pstring
  138. A pascal style string where the first byte is interpreted as the an
  139. diff -Naur file-4.20.orig/magic/Header file-4.20/magic/Header
  140. --- file-4.20.orig/magic/Header 2000-08-05 17:36:46.000000000 +0000
  141. +++ file-4.20/magic/Header 2007-03-27 12:23:14.000000000 +0000
  142. @@ -1,5 +1,5 @@
  143. -# Magic
  144. # Magic data for file(1) command.
  145. -# Machine-generated from src/cmd/file/magdir/*; edit there only!
  146. -# Format is described in magic(files), where:
  147. -# files is 5 on V7 and BSD, 4 on SV, and ?? in the SVID.
  148. +# Format is described in magic(5).
  149. +# Don't edit this file, edit /etc/magic or send your suggested inclusions to
  150. +# this file as a wishlist bug against file (using the reportbug utility).
  151. +
  152. diff -Naur file-4.20.orig/magic/Magdir/animation file-4.20/magic/Magdir/animation
  153. --- file-4.20.orig/magic/Magdir/animation 2007-01-14 18:47:21.000000000 +0000
  154. +++ file-4.20/magic/Magdir/animation 2007-03-27 12:23:14.000000000 +0000
  155. @@ -14,11 +14,11 @@
  156. >12 string cmov \b movie (fast start, compressed header)
  157. >12 string rmra \b multiple URLs
  158. 4 string mdat Apple QuickTime movie (unoptimized)
  159. -4 string wide Apple QuickTime movie (unoptimized)
  160. -4 string skip Apple QuickTime movie (modified)
  161. -4 string free Apple QuickTime movie (modified)
  162. +#4 string wide Apple QuickTime movie (unoptimized)
  163. +#4 string skip Apple QuickTime movie (modified)
  164. +#4 string free Apple QuickTime movie (modified)
  165. 4 string idsc Apple QuickTime image (fast start)
  166. -4 string idat Apple QuickTime image (unoptimized)
  167. +#4 string idat Apple QuickTime image (unoptimized)
  168. 4 string pckg Apple QuickTime compressed archive
  169. 4 string/B jP JPEG 2000 image
  170. 4 string ftyp ISO Media
  171. diff -Naur file-4.20.orig/magic/Magdir/commands file-4.20/magic/Magdir/commands
  172. --- file-4.20.orig/magic/Magdir/commands 2007-01-19 19:28:01.000000000 +0000
  173. +++ file-4.20/magic/Magdir/commands 2007-03-27 12:23:14.000000000 +0000
  174. @@ -28,7 +28,7 @@
  175. 0 string/b #!\ /bin/awk awk script text executable
  176. 0 string/b #!\ /usr/bin/awk awk script text executable
  177. # update to distinguish from *.vcf files
  178. -0 regex BEGIN[[:space:]]*[{] awk script text
  179. +#0 regex BEGIN[[:space:]]*[{] awk script text
  180. # AT&T Bell Labs' Plan 9 shell
  181. 0 string/b #!\ /bin/rc Plan 9 rc shell script text executable
  182. diff -Naur file-4.20.orig/magic/Magdir/compress file-4.20/magic/Magdir/compress
  183. --- file-4.20.orig/magic/Magdir/compress 2006-03-02 22:10:26.000000000 +0000
  184. +++ file-4.20/magic/Magdir/compress 2007-03-27 12:23:14.000000000 +0000
  185. @@ -101,18 +101,18 @@
  186. # bzip a block-sorting file compressor
  187. # by Julian Seward <sewardj@cs.man.ac.uk> and others
  188. -#
  189. -0 string BZ bzip compressed data
  190. ->2 byte x \b, version: %c
  191. ->3 string =1 \b, compression block size 100k
  192. ->3 string =2 \b, compression block size 200k
  193. ->3 string =3 \b, compression block size 300k
  194. ->3 string =4 \b, compression block size 400k
  195. ->3 string =5 \b, compression block size 500k
  196. ->3 string =6 \b, compression block size 600k
  197. ->3 string =7 \b, compression block size 700k
  198. ->3 string =8 \b, compression block size 800k
  199. ->3 string =9 \b, compression block size 900k
  200. +# Disabled because it is too weak (MPi)
  201. +#0 string BZ bzip compressed data
  202. +#>2 byte x \b, version: %c
  203. +#>3 string =1 \b, compression block size 100k
  204. +#>3 string =2 \b, compression block size 200k
  205. +#>3 string =3 \b, compression block size 300k
  206. +#>3 string =4 \b, compression block size 400k
  207. +#>3 string =5 \b, compression block size 500k
  208. +#>3 string =6 \b, compression block size 600k
  209. +#>3 string =7 \b, compression block size 700k
  210. +#>3 string =8 \b, compression block size 800k
  211. +#>3 string =9 \b, compression block size 900k
  212. # lzop from <markus.oberhumer@jk.uni-linz.ac.at>
  213. 0 string \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data
  214. diff -Naur file-4.20.orig/magic/Magdir/cracklib file-4.20/magic/Magdir/cracklib
  215. --- file-4.20.orig/magic/Magdir/cracklib 2006-03-02 22:10:26.000000000 +0000
  216. +++ file-4.20/magic/Magdir/cracklib 2007-03-27 12:23:14.000000000 +0000
  217. @@ -9,5 +9,5 @@
  218. 0 belong 0x70775631 Cracklib password index, big endian
  219. >4 belong >-1 (%i words)
  220. # really bellong 0x0000000070775631
  221. -4 belong 0x70775631 Cracklib password index, big endian ("64-bit")
  222. +0 search/1 \0\0\0\0pwV1 Cracklib password index, big endian ("64-bit")
  223. >12 belong >0 (%i words)
  224. diff -Naur file-4.20.orig/magic/Magdir/elf file-4.20/magic/Magdir/elf
  225. --- file-4.20.orig/magic/Magdir/elf 2006-12-18 14:14:34.000000000 +0000
  226. +++ file-4.20/magic/Magdir/elf 2007-03-27 12:23:14.000000000 +0000
  227. @@ -51,7 +51,7 @@
  228. >>>>36 lelong&0xf0000000 0x20000000 MIPS-III
  229. >>>>36 lelong&0xf0000000 0x30000000 MIPS-IV
  230. >>>>36 lelong&0xf0000000 0x40000000 MIPS-V
  231. ->>>>36 lelong&0xf0000000 0x60000000 MIPS32
  232. +>>>>36 lelong&0xf0000000 0x5fffffff MIPS32
  233. >>>>36 lelong&0xf0000000 0x70000000 MIPS64
  234. >>>>36 lelong&0xf0000000 0x80000000 MIPS32 rel2
  235. >>>>36 lelong&0xf0000000 0x90000000 MIPS64 rel2
  236. diff -Naur file-4.20.orig/magic/Magdir/hp file-4.20/magic/Magdir/hp
  237. --- file-4.20.orig/magic/Magdir/hp 2003-02-08 18:30:39.000000000 +0000
  238. +++ file-4.20/magic/Magdir/hp 2007-03-27 12:23:14.000000000 +0000
  239. @@ -203,33 +203,36 @@
  240. >8 long >0 %d messages
  241. # addendum to /etc/magic with HP-48sx file-types by phk@data.fls.dk 1jan92
  242. -0 string HPHP48- HP48 binary
  243. ->7 byte >0 - Rev %c
  244. ->8 beshort 0x1129 (ADR)
  245. ->8 beshort 0x3329 (REAL)
  246. ->8 beshort 0x5529 (LREAL)
  247. ->8 beshort 0x7729 (COMPLX)
  248. ->8 beshort 0x9d29 (LCOMPLX)
  249. ->8 beshort 0xbf29 (CHAR)
  250. ->8 beshort 0xe829 (ARRAY)
  251. ->8 beshort 0x0a2a (LNKARRAY)
  252. ->8 beshort 0x2c2a (STRING)
  253. ->8 beshort 0x4e2a (HXS)
  254. ->8 beshort 0x742a (LIST)
  255. ->8 beshort 0x962a (DIR)
  256. ->8 beshort 0xb82a (ALG)
  257. ->8 beshort 0xda2a (UNIT)
  258. ->8 beshort 0xfc2a (TAGGED)
  259. ->8 beshort 0x1e2b (GROB)
  260. ->8 beshort 0x402b (LIB)
  261. ->8 beshort 0x622b (BACKUP)
  262. ->8 beshort 0x882b (LIBDATA)
  263. ->8 beshort 0x9d2d (PROG)
  264. ->8 beshort 0xcc2d (CODE)
  265. ->8 beshort 0x482e (GNAME)
  266. ->8 beshort 0x6d2e (LNAME)
  267. ->8 beshort 0x922e (XLIB)
  268. -0 string %%HP: HP48 text
  269. +0 string HPHP4 HP
  270. +>5 string 8 48 binary
  271. +>5 string 9 49 binary
  272. +>7 byte >64 - Rev %c
  273. +>8 leshort 0x2911 (ADR)
  274. +>8 leshort 0x2933 (REAL)
  275. +>8 leshort 0x2955 (LREAL)
  276. +>8 leshort 0x2977 (COMPLX)
  277. +>8 leshort 0x299d (LCOMPLX)
  278. +>8 leshort 0x29bf (CHAR)
  279. +>8 leshort 0x29e8 (ARRAY)
  280. +>8 leshort 0x2a0a (LNKARRAY)
  281. +>8 leshort 0x2a2c (STRING)
  282. +>8 leshort 0x2a4e (HXS)
  283. +>8 leshort 0x2a74 (LIST)
  284. +>8 leshort 0x2a96 (DIR)
  285. +>8 leshort 0x2ab8 (ALG)
  286. +>8 leshort 0x2ada (UNIT)
  287. +>8 leshort 0x2afc (TAGGED)
  288. +>8 leshort 0x2b1e (GROB)
  289. +>8 leshort 0x2b40 (LIB)
  290. +>8 leshort 0x2b62 (BACKUP)
  291. +>8 leshort 0x2b88 (LIBDATA)
  292. +>8 leshort 0x2d9d (PROG)
  293. +>8 leshort 0x2dcc (CODE)
  294. +>8 leshort 0x2e48 (GNAME)
  295. +>8 leshort 0x2e6d (LNAME)
  296. +>8 leshort 0x2e92 (XLIB)
  297. +
  298. +0 string %%HP: HP text
  299. >6 string T(0) - T(0)
  300. >6 string T(1) - T(1)
  301. >6 string T(2) - T(2)
  302. @@ -240,6 +243,23 @@
  303. >14 string F(.) F(.);
  304. >14 string F(,) F(,);
  305. +0 string HP3 HP
  306. +>3 string 8 38
  307. +>3 string 9 39
  308. +>4 string Bin binary
  309. +>4 string Asc ASCII
  310. +>7 string A (Directory List)
  311. +>7 string B (Zaplet)
  312. +>7 string C (Note)
  313. +>7 string D (Program)
  314. +>7 string E (Variable)
  315. +>7 string F (List)
  316. +>7 string G (Matrix)
  317. +>7 string H (Library)
  318. +>7 string I (Target List)
  319. +>7 string J (ASCII Vector specification)
  320. +>7 string K (wildcard)
  321. +
  322. # hpBSD magic numbers
  323. 0 beshort 200 hp200 (68010) BSD
  324. >2 beshort 0407 impure binary
  325. @@ -390,6 +410,3 @@
  326. >>>>>>>>>0xC4 belong 33 - received SIGXCPU
  327. >>>>>>>>>0xC4 belong 34 - received SIGXFSZ
  328. -# From: AMAKAWA Shuhei <sa264@cam.ac.uk>
  329. -0 string HPHP49- HP49 binary
  330. -
  331. diff -Naur file-4.20.orig/magic/Magdir/images file-4.20/magic/Magdir/images
  332. --- file-4.20.orig/magic/Magdir/images 2007-01-19 19:31:46.000000000 +0000
  333. +++ file-4.20/magic/Magdir/images 2007-03-27 12:23:14.000000000 +0000
  334. @@ -130,8 +130,8 @@
  335. # CGM image files
  336. 0 string BEGMF clear text Computer Graphics Metafile
  337. # XXX - questionable magic
  338. -0 beshort&0xffe0 0x0020 binary Computer Graphics Metafile
  339. -0 beshort 0x3020 character Computer Graphics Metafile
  340. +#0 beshort&0xffe0 0x0020 binary Computer Graphics Metafile
  341. +#0 beshort 0x3020 character Computer Graphics Metafile
  342. # MGR bitmaps (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
  343. 0 string yz MGR bitmap, modern format, 8-bit aligned
  344. @@ -505,9 +505,6 @@
  345. # http://www.djvuzone.org/
  346. 0 string AT&TFORM DjVu Image file
  347. -# From: Jason Bacon <bacon@smithers.neuro.mcw.edu>
  348. -0 beshort 0x3020 character Computer Graphics Metafile
  349. -
  350. # From Marc Espie
  351. 0 lelong 20000630 OpenEXR image data
  352. @@ -525,3 +522,10 @@
  353. # Xara (for a while: Corel Xara) is a graphic package, see
  354. # http://www.xara.com/ for Windows and as GPL application for
  355. 0 string XARA\243\243 Xara graphics file
  356. +
  357. +# The boot loaders syslinux and isolinux use a RLE based image format
  358. +# called SLL16 to store splash screens.
  359. +0 lelong 0x1413f33d Syslinux SLL16 image data,
  360. +>4 leshort >0 %hd x
  361. +>6 leshort >0 %hd
  362. +
  363. diff -Naur file-4.20.orig/magic/Magdir/msdos file-4.20/magic/Magdir/msdos
  364. --- file-4.20.orig/magic/Magdir/msdos 2007-01-19 19:35:20.000000000 +0000
  365. +++ file-4.20/magic/Magdir/msdos 2007-03-27 12:23:14.000000000 +0000
  366. @@ -262,8 +262,9 @@
  367. # Uncommenting only the first two lines will cover about 2/3 of COM files,
  368. # but it isn't feasible to match all COM files since there must be at least
  369. # two dozen different one-byte "magics".
  370. -0 byte 0xe9 DOS executable (COM)
  371. ->0x1FE leshort 0xAA55 \b, boot code
  372. +# Disabled one-byte magic (MPi)
  373. +#0 byte 0xe9 DOS executable (COM)
  374. +#>0x1FE leshort 0xAA55 \b, boot code
  375. >6 string SFX\ of\ LHarc (%s)
  376. 0 belong 0xffffffff DOS executable (device driver)
  377. #CMD640X2.SYS
  378. @@ -286,15 +287,16 @@
  379. >>77 string >\x40
  380. >>>77 string <\x5B
  381. >>>>77 string x \b, name: %.8s
  382. -0 byte 0x8c DOS executable (COM)
  383. +# Disabled one-byte magic (MPi)
  384. +#0 byte 0x8c DOS executable (COM)
  385. # 0xeb conflicts with "sequent" magic
  386. -0 byte 0xeb DOS executable (COM)
  387. ->0x1FE leshort 0xAA55 \b, boot code
  388. ->85 string UPX \b, UPX compressed
  389. ->4 string \ $ARX \b, ARX self-extracting archive
  390. ->4 string \ $LHarc \b, LHarc self-extracting archive
  391. ->0x20e string SFX\ by\ LARC \b, LARC self-extracting archive
  392. -0 byte 0xb8 COM executable
  393. +#0 byte 0xeb DOS executable (COM)
  394. +#>0x1FE leshort 0xAA55 \b, boot code
  395. +#>85 string UPX \b, UPX compressed
  396. +#>4 string \ $ARX \b, ARX self-extracting archive
  397. +#>4 string \ $LHarc \b, LHarc self-extracting archive
  398. +#>0x20e string SFX\ by\ LARC \b, LARC self-extracting archive
  399. +#0 byte 0xb8 COM executable
  400. # modified by Joerg Jenderek
  401. >1 lelong !0x21cd4cff for DOS
  402. # http://syslinux.zytor.com/comboot.php
  403. @@ -572,24 +574,25 @@
  404. >4 byte =0x30 Offline database
  405. -# Windows Enhanced Metafile (EMF)
  406. -# See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp
  407. -# for further information. Note that "0 lelong 1" should be true i.e.
  408. -# the first double word in the file should be 1. With the extended
  409. -# syntax available by some file commands you could write:
  410. -# 0 lelong 1
  411. -# &40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data
  412. -40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data
  413. ->44 ulelong x version 0x%x.
  414. -# If the description has a length greater than zero, it exists and is
  415. -# found at offset (*64).
  416. ->64 ulelong >0 Description available at offset 0x%x
  417. ->>60 ulelong >0 (length 0x%x)
  418. -# Note it would be better to print out the description, which is found
  419. -# as below. Unfortunately the following only prints out the first couple
  420. -# of characters instead of all the "description length"
  421. -# number of characters -- indicated by the ulelong at offset 60.
  422. ->>(64.l) lestring16 >0 Description: %15.15s
  423. +# This is pure ASCII magic, "EMF " at position 40 (MPi)
  424. +## Windows Enhanced Metafile (EMF)
  425. +## See msdn.microsoft.com/archive/en-us/dnargdi/html/msdn_enhmeta.asp
  426. +## for further information. Note that "0 lelong 1" should be true i.e.
  427. +## the first double word in the file should be 1. With the extended
  428. +## syntax available by some file commands you could write:
  429. +## 0 lelong 1
  430. +## &40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data
  431. +#40 ulelong 0x464D4520 Windows Enhanced Metafile (EMF) image data
  432. +#>44 ulelong x version 0x%x.
  433. +## If the description has a length greater than zero, it exists and is
  434. +## found at offset (*64).
  435. +#>64 ulelong >0 Description available at offset 0x%x
  436. +#>>60 ulelong >0 (length 0x%x)
  437. +## Note it would be better to print out the description, which is found
  438. +## as below. Unfortunately the following only prints out the first couple
  439. +## of characters instead of all the "description length"
  440. +## number of characters -- indicated by the ulelong at offset 60.
  441. +#>>(64.l) lestring16 >0 Description: %15.15s
  442. # From: Alex Beregszaszi <alex@fsn.hu>
  443. 0 string COWD VMWare3
  444. @@ -617,5 +620,6 @@
  445. 0 lelong 0x02468ace Bochs Sparse disk image
  446. # from http://filext.com by Derek M Jones <derek@knosof.co.uk>
  447. -0 string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
  448. +# False positive with PPT
  449. +#0 string \xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x03\x00\xFE\xFF Microsoft Installer
  450. 0 string \320\317\021\340\241\261\032\341 Microsoft Office Document
  451. diff -Naur file-4.20.orig/magic/Magdir/perl file-4.20/magic/Magdir/perl
  452. --- file-4.20.orig/magic/Magdir/perl 2007-03-01 23:20:19.000000000 +0000
  453. +++ file-4.20/magic/Magdir/perl 2007-03-27 12:23:14.000000000 +0000
  454. @@ -9,8 +9,8 @@
  455. 0 string eval\ "exec\ /bin/perl perl script text
  456. 0 string/b #!\ /usr/bin/perl perl script text executable
  457. 0 string eval\ "exec\ /usr/bin/perl perl script text
  458. -0 string/b #!\ /usr/local/bin/perl perl script text
  459. -0 string eval\ "exec\ /usr/local/bin/perl perl script text executable
  460. +0 string/b #!\ /usr/local/bin/perl perl script text executable
  461. +0 string eval\ "exec\ /usr/local/bin/perl perl script text
  462. 0 string eval\ '(exit\ $?0)'\ &&\ eval\ 'exec perl script text
  463. diff -Naur file-4.20.orig/magic/Magdir/revision file-4.20/magic/Magdir/revision
  464. --- file-4.20.orig/magic/Magdir/revision 2003-05-25 23:04:55.000000000 +0000
  465. +++ file-4.20/magic/Magdir/revision 2007-03-27 12:23:14.000000000 +0000
  466. @@ -3,3 +3,9 @@
  467. # file(1) magic for revision control files
  468. # From Hendrik Scholz <hendrik@scholz.net>
  469. 0 string /1\ :pserver: cvs password text file
  470. +
  471. +
  472. +# Subversion (SVN) dumps
  473. +# Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
  474. +0 string SVN-fs-dump-format-version: Subversion dumpfile
  475. +>28 string >\0 (version: %s)
  476. diff -Naur file-4.20.orig/magic/magic.local file-4.20/magic/magic.local
  477. --- file-4.20.orig/magic/magic.local 1970-01-01 00:00:00.000000000 +0000
  478. +++ file-4.20/magic/magic.local 2007-03-27 12:23:14.000000000 +0000
  479. @@ -0,0 +1,3 @@
  480. +# Magic local data for file(1) command.
  481. +# Insert here your local magic data. Format is described in magic(5).
  482. +
  483. diff -Naur file-4.20.orig/magic/magic.mime file-4.20/magic/magic.mime
  484. --- file-4.20.orig/magic/magic.mime 2007-01-25 22:10:35.000000000 +0000
  485. +++ file-4.20/magic/magic.mime 2007-03-27 12:23:14.000000000 +0000
  486. @@ -156,9 +156,7 @@
  487. # Creative Labs AUDIO stuff
  488. # Standard MIDI data
  489. -0 string MThd audio/unknown
  490. -#>9 byte >0 (format %d)
  491. -#>11 byte >1 using %d channels
  492. +0 string MThd audio/midi
  493. # Creative Music (CMF) data
  494. 0 string CTMF audio/unknown
  495. # SoundBlaster instrument data
  496. @@ -273,7 +271,7 @@
  497. 0 string #!/usr/bin/awk application/x-awk
  498. 0 string #!\ /usr/bin/awk application/x-awk
  499. # update to distinguish from *.vcf files by Joerg Jenderek: joerg dot jenderek at web dot de
  500. -0 regex BEGIN[[:space:]]*[{] application/x-awk
  501. +#0 regex BEGIN[[:space:]]*[{] application/x-awk
  502. # For Larry Wall's perl language. The ``eval'' line recognizes an
  503. # outrageously clever hack for USG systems.
  504. @@ -298,7 +296,7 @@
  505. # because it tries to uncompress it to figure out what's inside.
  506. # standard unix compress
  507. -0 string \037\235 application/x-compress
  508. +#0 string \037\235 application/x-compress
  509. # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
  510. 0 string \037\213 application/x-gzip
  511. @@ -400,18 +398,15 @@
  512. #------------------------------------------------------------------------------
  513. # html: file(1) magic for HTML (HyperText Markup Language) docs
  514. #
  515. -# from Daniel Quinlan <quinlan@yggdrasil.com>
  516. +# from Michael Piefel <piefel@debian.org>
  517. #
  518. -0 string \<HEAD text/html
  519. -0 string \<head text/html
  520. -0 string \<TITLE text/html
  521. -0 string \<title text/html
  522. -0 string \<html text/html
  523. -0 string \<HTML text/html
  524. +0 string/cB \<!DOCTYPE\ html text/html
  525. +0 string/cb \<head text/html
  526. +0 string/cb \<title text/html
  527. +0 string/bc \<html text/html
  528. 0 string \<!-- text/html
  529. -0 string \<h1 text/html
  530. -0 string \<H1 text/html
  531. -0 string/c \<!doctype\ html text/html
  532. +0 string/c \<h1 text/html
  533. +
  534. #------------------------------------------------------------------------------
  535. # images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
  536. @@ -474,7 +469,7 @@
  537. 0 beshort 0xffd8 image/jpeg
  538. # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
  539. -0 string BM image/bmp
  540. +0 string BM image/x-ms-bmp
  541. #>14 byte 12 (OS/2 1.x format)
  542. #>14 byte 64 (OS/2 2.x format)
  543. #>14 byte 40 (Windows 3.x format)
  544. @@ -706,8 +701,10 @@
  545. #------------------------------------------------------------------------------
  546. # Hierarchical Data Format, used to facilitate scientific data exchange
  547. # specifications at http://hdf.ncsa.uiuc.edu/
  548. -0 belong 0x0e031301 Hierarchical Data Format (version 4) data
  549. -0 string \211HDF\r\n\032 Hierarchical Data Format (version 5) data
  550. +#Hierarchical Data Format (version 4) data
  551. +0 belong 0x0e031301 application/x-hdf
  552. +#Hierarchical Data Format (version 5) data
  553. +0 string \211HDF\r\n\032 application/x-hdf
  554. # Adobe Photoshop
  555. 0 string 8BPS image/x-photoshop
  556. @@ -777,21 +774,25 @@
  557. # Debian has entries for the old PGP formats:
  558. # pgp: file(1) magic for Pretty Good Privacy
  559. # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
  560. -0 beshort 0x9900 text/PGP key public ring
  561. -0 beshort 0x9501 text/PGP key security ring
  562. -0 beshort 0x9500 text/PGP key security ring
  563. -0 beshort 0xa600 text/PGP encrypted data
  564. -0 string -----BEGIN\040PGP text/PGP armored data
  565. ->15 string PUBLIC\040KEY\040BLOCK- public key block
  566. ->15 string MESSAGE- message
  567. ->15 string SIGNED\040MESSAGE- signed message
  568. ->15 string PGP\040SIGNATURE- signature
  569. -0 beshort 0x8501 data
  570. +#text/PGP key public ring
  571. +0 beshort 0x9900 application/pgp
  572. +#text/PGP key security ring
  573. +0 beshort 0x9501 application/pgp
  574. +#text/PGP key security ring
  575. +0 beshort 0x9500 application/pgp
  576. +#text/PGP encrypted data
  577. +0 beshort 0xa600 application/pgp-encrypted
  578. +#text/PGP armored data
  579. +##public key block
  580. +2 string ---BEGIN\ PGP\ PUBLIC\ KEY\ BLOCK- application/pgp-keys
  581. +0 string -----BEGIN\040PGP\40MESSAGE- application/pgp
  582. +0 string -----BEGIN\040PGP\40SIGNATURE- application/pgp-signature
  583. #
  584. # GnuPG Magic:
  585. -#
  586. -0 beshort 0x9901 text/GnuPG key public ring
  587. -0 beshort 0x8501 text/OpenPGP data
  588. +#text/GnuPG key public ring
  589. +0 beshort 0x9901 application/pgp
  590. +#text/OpenPGP data
  591. +0 beshort 0x8501 application/pgp-encrypted
  592. # flash: file(1) magic for Macromedia Flash file format
  593. #
  594. @@ -951,3 +952,9 @@
  595. #
  596. 128 string DICM application/dicom
  597. +
  598. +# Gnumeric spreadsheet
  599. +# This entry is only semi-helpful, as Gnumeric compresses its files, so
  600. +# they will ordinarily reported as "compressed", but at least -z helps
  601. +39 string =<gmr:Workbook application/x-gnumeric
  602. +
  603. diff -Naur file-4.20.orig/src/Makefile.am file-4.20/src/Makefile.am
  604. --- file-4.20.orig/src/Makefile.am 2007-01-12 17:40:53.000000000 +0000
  605. +++ file-4.20/src/Makefile.am 2007-03-27 12:23:14.000000000 +0000
  606. @@ -5,7 +5,7 @@
  607. bin_PROGRAMS = file
  608. -AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  609. +AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
  610. libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
  611. compress.c is_tar.c readelf.c print.c fsmagic.c \
  612. diff -Naur file-4.20.orig/src/Makefile.in file-4.20/src/Makefile.in
  613. --- file-4.20.orig/src/Makefile.in 2007-03-01 23:21:09.000000000 +0000
  614. +++ file-4.20/src/Makefile.in 2007-03-27 12:23:14.000000000 +0000
  615. @@ -196,7 +196,7 @@
  616. lib_LTLIBRARIES = libmagic.la
  617. include_HEADERS = magic.h
  618. EXTRA_DIST = test.c
  619. -AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
  620. +AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
  621. libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
  622. compress.c is_tar.c readelf.c print.c fsmagic.c \
  623. funcs.c file.h names.h patchlevel.h readelf.h tar.h apptype.c
  624. @@ -296,7 +296,7 @@
  625. done
  626. file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES)
  627. @rm -f file$(EXEEXT)
  628. - $(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD) $(LIBS)
  629. + $(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD)
  630. mostlyclean-compile:
  631. -rm -f *.$(OBJEXT)
  632. diff -Naur file-4.20.orig/src/file.c file-4.20/src/file.c
  633. --- file-4.20.orig/src/file.c 2007-01-25 21:05:46.000000000 +0000
  634. +++ file-4.20/src/file.c 2007-03-27 12:23:14.000000000 +0000
  635. @@ -352,7 +352,7 @@
  636. }
  637. magic_close(magic);
  638. - return 0;
  639. + return magic->haderr ? -1 : 0;
  640. }
  641. diff -Naur file-4.20.orig/src/fsmagic.c file-4.20/src/fsmagic.c
  642. --- file-4.20.orig/src/fsmagic.c 2007-01-12 17:40:53.000000000 +0000
  643. +++ file-4.20/src/fsmagic.c 2007-03-27 12:23:14.000000000 +0000
  644. @@ -92,7 +92,8 @@
  645. if (file_printf(ms, "cannot open `%s' (%s)",
  646. fn, strerror(errno)) == -1)
  647. return -1;
  648. - return 1;
  649. + ms->haderr++;
  650. + return -1;
  651. }
  652. if ((ms->flags & MAGIC_MIME) != 0) {
  653. diff -Naur file-4.20.orig/src/readelf.c file-4.20/src/readelf.c
  654. --- file-4.20.orig/src/readelf.c 2007-01-18 05:45:35.000000000 +0000
  655. +++ file-4.20/src/readelf.c 2007-03-27 12:23:14.000000000 +0000
  656. @@ -396,6 +396,14 @@
  657. if (file_printf(ms, "Solaris") == -1)
  658. return size;
  659. break;
  660. + case GNU_OS_KFREEBSD:
  661. + if (file_printf(ms, "kFreeBSD") == -1)
  662. + return size;
  663. + break;
  664. + case GNU_OS_KNETBSD:
  665. + if (file_printf(ms, "kNetBSD") == -1)
  666. + return size;
  667. + break;
  668. default:
  669. if (file_printf(ms, "<unknown>") == -1)
  670. return size;
  671. @@ -907,29 +915,30 @@
  672. off_t fsize;
  673. int flags = 0;
  674. - /*
  675. - * If we cannot seek, it must be a pipe, socket or fifo.
  676. - */
  677. - if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
  678. - fd = file_pipe2file(ms, fd, buf, nbytes);
  679. -
  680. - if (fstat(fd, &st) == -1) {
  681. - file_badread(ms);
  682. - return -1;
  683. - }
  684. - fsize = st.st_size;
  685. /*
  686. * ELF executables have multiple section headers in arbitrary
  687. * file locations and thus file(1) cannot determine it from easily.
  688. * Instead we traverse thru all section headers until a symbol table
  689. * one is found or else the binary is stripped.
  690. + * Return immediately if it's not ELF (so we avoid pipe2file unless needed).
  691. */
  692. if (buf[EI_MAG0] != ELFMAG0
  693. || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
  694. || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
  695. return 0;
  696. + /*
  697. + * If we cannot seek, it must be a pipe, socket or fifo.
  698. + */
  699. + if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
  700. + fd = file_pipe2file(ms, fd, buf, nbytes);
  701. +
  702. + if (fstat(fd, &st) == -1) {
  703. + file_badread(ms);
  704. + return -1;
  705. + }
  706. + fsize = st.st_size;
  707. class = buf[EI_CLASS];
  708. diff -Naur file-4.20.orig/src/readelf.h file-4.20/src/readelf.h
  709. --- file-4.20.orig/src/readelf.h 2007-01-12 17:40:53.000000000 +0000
  710. +++ file-4.20/src/readelf.h 2007-03-27 12:23:14.000000000 +0000
  711. @@ -232,5 +232,7 @@
  712. #define GNU_OS_LINUX 0
  713. #define GNU_OS_HURD 1
  714. #define GNU_OS_SOLARIS 2
  715. +#define GNU_OS_KFREEBSD 3
  716. +#define GNU_OS_KNETBSD 4
  717. #endif