[php-maint] Bug#335674: php5: mime_magic support => invalid magic file, disabled

Piotr Roszatycki dexter at debian.org
Tue Oct 25 11:01:23 UTC 2005


Package: php5
Version: 5.0.5-3
Severity: normal

`php5 -i' reports:

mime_magic support => invalid magic file, disabled

it should report:

mime_magic support => enabled


In fact, the mime.magic file for PHP have to be different than the Debian
/usr/share/file/magic.mime file. I suggest to put the modified php5 version
of magic.mime to the /usr/share/php5 directory.

This is the patch for mime_magic/config.m4:

Don't check if file exists for mime.magic as far as it will be provided with
php5-common.

diff -ru php-5.0.2.orig/ext/mime_magic/config.m4 php-5.0.2/ext/mime_magic/config.m4
--- php-5.0.2.orig/ext/mime_magic/config.m4     2004-04-22 03:24:12 +0200
+++ php-5.0.2/ext/mime_magic/config.m4  2004-11-12 13:30:27 +0100
@@ -16,11 +16,7 @@
   dnl Try to see if we can find the path of the magic file in its default locations.
   dnl
   if test "$PHP_MIME_MAGIC" != "yes"; then
-    if test -f $PHP_MIME_MAGIC; then
-      PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC
-    else
-      AC_MSG_ERROR([File '$PHP_MIME_MAGIC' not found!])
-    fi
+    PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC
   else
     MAGIC_MIME_LOCATIONS="/usr/local/apache/conf/magic /usr/local/etc/apache/conf/magic /etc/apach
e/magic /etc/httpd/conf/magic /usr/share/magic.mime /usr/share/misc/magic.mime /etc/magic.mime"


This is the patch for original magic.mime file:

--- /usr/share/misc/file/magic.mime	2004-12-06 10:55:53 +0100
+++ magic.mime	2005-02-08 18:14:35 +0100
@@ -1,4 +1,6 @@
-# Magic data for KMimeMagic (originally for file(1) command)
+# Magic data for PHP (originally for file(1) command)
+#
+# Adapted from libmagic1 package by Piotr Roszatycki <dexter at debian.org>
 #
 # The format is 4-5 columns:
 #    Column #1: byte number to begin checking from, ">" indicates continuation
@@ -44,7 +46,7 @@
 #audio/x-tracker-module
 ##>17	string	>\0		Title: "%s"
 
-21	string/c	!SCREAM!	audio/x-mod
+21	string	!SCREAM!	audio/x-mod
 #audio/x-screamtracker-module
 21	string	BMOD2STM	audio/x-mod
 #audio/x-screamtracker-module
@@ -101,7 +103,7 @@
 
 0	string		\<?xml
 #			text/xml
->38	string		\<\!DOCTYPE\040svg	image/svg+xml
+#>38	string		\<\!DOCTYPE\040svg	image/svg+xml
 
 
 # xml
@@ -184,7 +186,7 @@
 0	string		RIFF
 #					- WAVE format
 >8	string		WAVE		audio/x-wav
->8	string/B	AVI		video/x-msvideo
+>8	string		AVI		video/x-msvideo
 #
 >8 	string		CDRA		image/x-coreldraw
 
@@ -205,7 +207,7 @@
 0	string		/*\ XPM		image/x-xpm	7bit
 
 # 3DS (3d Studio files)
-#16	beshort		0x3d3d		image/x-3ds
+16	beshort		0x3d3d		image/x-3ds
 
 # this first will upset you if you're a PL/1 shop... (are there any left?)
 # in which case rm it; ascmagic will catch real C programs
@@ -289,10 +291,10 @@
 # because it tries to uncompress it to figure out what's inside.
 
 # standard unix compress
-#0	string		\037\235	application/x-compress
+0	string		\037\235	application/x-compress
 
 # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
-#0       string          \037\213        application/x-gzip
+0       string          \037\213        application/x-gzip
 
 0		string			PK\003\004		application/x-zip
 
@@ -393,14 +395,18 @@
 #
 # from Daniel Quinlan <quinlan at yggdrasil.com>
 #
-0	string/cB	\<!DOCTYPE\ html	text/html
-0	string/cb	\<head	text/html
-0	string/cb	\<title	text/html
-0       string/bc	\<html	text/html
+0	string		\<HEAD	text/html
+0	string		\<head	text/html
+0	string		\<TITLE	text/html
+0	string		\<title	text/html
+0       string          \<html	text/html
+0       string          \<HTML	text/html
 0	string		\<!--	text/html
-0	string/c	\<h1	text/html
-
-0	string		\<?xml			text/xml
+0	string		\<h1	text/html
+0	string		\<H1	text/html
+0	string		\<!doctype\ HTML	text/html
+0	string		\<!DOCTYPE\ HTML	text/html
+0	string		\<!doctype\ html	text/html
 
 #------------------------------------------------------------------------------
 # images:  file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
@@ -463,7 +469,7 @@
 0	beshort		0xffd8		image/jpeg
 
 # PC bitmaps (OS/2, Windoze BMP files)  (Greg Roelofs, newt at uchicago.edu)
-0	string		BM		image/x-ms-bmp
+0	string		BM		image/bmp
 #>14	byte		12		(OS/2 1.x format)
 #>14	byte		64		(OS/2 2.x format)
 #>14	byte		40		(Windows 3.x format)
@@ -606,16 +612,18 @@
 4	string		idsc	      image/x-quicktime
 4	string		idat	      image/x-quicktime
 4	string		pckg	      application/x-quicktime
-4	string/B	jP	      image/jp2
+4	string  	jP	      image/jp2
 4	string		ftyp	      application/octet-stream
 >8	string		isom	      video/mp4
 >8	string		mp41	      video/mp4
 >8	string		mp42	      video/mp4
->8	string/B	jp2	      image/jp2
+>8	string  	jp2	      image/jp2
 >8	string		3gp	      video/3gpp
 >8	string		mmp4	      video/mp4
->8	string/B	M4A	      audio/mp4
->8	string/B	qt	      video/quicktime
+>8	string  	M4A	      audio/mp4
+>8	string  	qt	      video/quicktime
+# MNG
+0	string		\x8aMNG				video/x-mng
 # The contributor claims:
 #   I couldn't find a real magic number for these, however, this
 #   -appears- to work.  Note that it might catch other files, too,
@@ -678,8 +686,8 @@
 #------------------------------------------------------------------------------
 # Hierarchical Data Format, used to facilitate scientific data exchange
 # specifications at http://hdf.ncsa.uiuc.edu/
-0	belong		0x0e031301	Hierarchical Data Format (version 4) data
-0	string		\211HDF\r\n\032	Hierarchical Data Format (version 5) data
+#0	belong		0x0e031301	Hierarchical Data Format (version 4) data
+#0	string		\211HDF\r\n\032	Hierarchical Data Format (version 5) data
 
 # Adobe Photoshop
 0	string		8BPS			image/x-photoshop
@@ -746,24 +754,24 @@
 #
 #0	leshort		0x0006		application/x-dbt
 
-# Debian has entries for the old PGP formats:
-# pgp:  file(1) magic for Pretty Good Privacy
-# see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
-0       beshort         0x9900                  text/PGP key public ring
-0       beshort         0x9501                  text/PGP key security ring
-0       beshort         0x9500                  text/PGP key security ring
-0       beshort         0xa600                  text/PGP encrypted data
-0       string          -----BEGIN\040PGP       text/PGP armored data 
->15     string          PUBLIC\040KEY\040BLOCK- public key block
->15     string          MESSAGE-                message
->15     string          SIGNED\040MESSAGE-      signed message
->15     string          PGP\040SIGNATURE-       signature
-0       beshort         0x8501                  data
-#
-# GnuPG Magic:
-# 
-0       beshort         0x9901                  text/GnuPG key public ring
-0       beshort         0x8501                  text/OpenPGP data
+## Debian has entries for the old PGP formats:
+## pgp:  file(1) magic for Pretty Good Privacy
+## see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
+#0       beshort         0x9900                  text/PGP key public ring
+#0       beshort         0x9501                  text/PGP key security ring
+#0       beshort         0x9500                  text/PGP key security ring
+#0       beshort         0xa600                  text/PGP encrypted data
+#0       string          -----BEGIN\040PGP       text/PGP armored data 
+#>15     string          PUBLIC\040KEY\040BLOCK- public key block
+#>15     string          MESSAGE-                message
+#>15     string          SIGNED\040MESSAGE-      signed message
+#>15     string          PGP\040SIGNATURE-       signature
+#0       beshort         0x8501                  data
+##
+## GnuPG Magic:
+## 
+#0       beshort         0x9901                  text/GnuPG key public ring
+#0       beshort         0x8501                  text/OpenPGP data
 
 # flash:        file(1) magic for Macromedia Flash file format
 #



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (900, 'unstable'), (500, 'oldstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-1-686
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)

Versions of packages php5 depends on:
ii  libapache2-mod-php5        5.0.5-3       server-side, HTML-embedded scripti
ii  php5-cgi                   5.0.5-3       server-side, HTML-embedded scripti
ii  php5-common                5.0.5-3       Common files for packages built fr

php5 recommends no packages.

-- no debconf information




More information about the pkg-php-maint mailing list